#pragma once /* THIS CODE EXISTS ONLY TO DISPLAY A WINDOW, AND IS NOT RELEVANT TO THE EXAMPLE CODE */ #include #include #include #include #include class DummyWindow; typedef std::function windowMessageCallbackType; class DummyWindow { public: DummyWindow(HINSTANCE _instance); ~DummyWindow(void); bool initialize(); void finalize(); int32_t doMessageLoop(); void setMessageHandler(UINT message, windowMessageCallbackType callback); HWND getHandle() { return this->windowHandle; } private: static std::map windowMap; static void registerWindow(DummyWindow* dummy, HWND window); static void unregisterWindow(DummyWindow* dummy, HWND window); static DummyWindow* findWindow(HWND window); static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); private: std::map callbackMap; HWND windowHandle; HINSTANCE instance; LRESULT onMessageReceived(HWND window, UINT message, WPARAM wparam, LPARAM lparam); };