#ifndef __App__
#define __App__

#include <windows.h>
#include "resource.h"

#include "../Core/AppConfig.h"
#include "../Core/RenderDevice.h"
#include "../DeviceRegistry/DeviceRegistry.h"
#include "../WindowManager/WindowManager.h"
#include "../WindowManager/Label.h"
#include "../WindowManager/Button.h"
#include "../WindowManager/CheckBox.h"
#include "../WindowManager/RadioButton.h"
#include "../WindowManager/Slider.h"
#include "../WindowManager/StepSlider.h"
#include "../WindowManager/ListBox.h"
#include "../WindowManager/MenuBar.h"
#include "../WindowManager/EditBox.h"
#include "../WindowManager/Dialog.h"
#include "../Core/SceneGraph/Geode.h"
#include "../Core/ResourceManager.h"
#include "../Core/SceneGraph/CameraManipulator.h"
#include "../Core/SceneGraph/SpectatorCameraManipulator.h"
#include "../Core/SceneGraph/Light.h"


class App {
public:

    static App& instance();

    int run(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow);

    void onActivate(bool status);

    void onSize(int width, int height);

protected:
    App();

    HRESULT createWindow();
    void destroyWindow();

    static LRESULT CALLBACK wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);


    AppConfig&      _appConfig;
    DeviceRegistry& _deviceRegistry;

    WindowManager*  _windowManager;
    RenderDevice*   _renderDevice;

    HINSTANCE   _hInstance;
    HINSTANCE   _hPrevInstance;
    LPWSTR      _lpCmdLine;
    int         _nCmdShow;

    HWND        _hWnd;
    DEVMODE     _dmScreenSettings;
    bool        _fullscreen;
    bool        _inSizeMove;

    bool        _active;

    Sprite*     _background;
    MenuBar*    _menuBar;

    CameraManipulator* _cameraManipulator;

    DirectionalLight* _dirLight;
};

#endif