#pragma once #pragma comment(lib, "Shlwapi.lib") #pragma comment(lib, "opengl32.lib") #pragma comment(lib, "dwmapi.lib") #pragma comment(lib, "comctl32.lib") #pragma comment(lib, "Gdi32.lib") #pragma comment(lib, "User32.lib") #ifdef _WIN32 #ifdef IS_DLL #define EMSCRIPTEN_KEEPALIVE __declspec(dllimport) #else #define EMSCRIPTEN_KEEPALIVE __declspec(dllexport) #endif #include #include #include namespace thermion { /// /// Instantiating a ThermionWindow creates a HWND that can be passed /// to Filament to create a swapchain. /// /// class ThermionWindow { public: ThermionWindow( int width, int height, int left, int top); HWND GetHandle(); void Resize(int width, int height, int left, int top); private: HWND _windowHandle; uint32_t _width = 0; uint32_t _height = 0; uint32_t _left = 0; uint32_t _top = 0; }; static ThermionWindow* _window; extern "C" { EMSCRIPTEN_KEEPALIVE intptr_t create_thermion_window(int width, int height, int left, int top) { _window = new ThermionWindow(width, height, left, top); return (intptr_t)_window->GetHandle(); } EMSCRIPTEN_KEEPALIVE void update() { MSG msg; if(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } } } } #endif