diff --git a/Sources/Icons/SplashScreen.png b/Sources/Icons/SplashScreen.png index c0d46a0d..bc57cc0d 100644 Binary files a/Sources/Icons/SplashScreen.png and b/Sources/Icons/SplashScreen.png differ diff --git a/Sources/Package.appxmanifest.in b/Sources/Package.appxmanifest.in index 3003892d..cf39d0ac 100644 --- a/Sources/Package.appxmanifest.in +++ b/Sources/Package.appxmanifest.in @@ -18,7 +18,7 @@ diff --git a/Sources/nCine/Backends/ImGuiGlfwInput.cpp b/Sources/nCine/Backends/ImGuiGlfwInput.cpp index 17f44a0b..31fb4c15 100644 --- a/Sources/nCine/Backends/ImGuiGlfwInput.cpp +++ b/Sources/nCine/Backends/ImGuiGlfwInput.cpp @@ -4,7 +4,10 @@ #include "ImGuiGlfwInput.h" #include "../Input/ImGuiJoyMappedInput.h" -#if defined(DEATH_TARGET_APPLE) +#if defined(DEATH_TARGET_EMSCRIPTEN) +# include +# include +#elif defined(DEATH_TARGET_APPLE) # if !defined(GLFW_EXPOSE_NATIVE_COCOA) # define GLFW_EXPOSE_NATIVE_COCOA # endif @@ -22,11 +25,6 @@ # endif #endif -#if defined(DEATH_TARGET_EMSCRIPTEN) -# include -# include -#endif - // We gather version tests as define in order to easily see which features are version-dependent. #define GLFW_VERSION_COMBINED (GLFW_VERSION_MAJOR * 1000 + GLFW_VERSION_MINOR * 100 + GLFW_VERSION_REVISION) #define GLFW_HAS_WINDOW_TOPMOST (GLFW_VERSION_COMBINED >= 3200) // 3.2+ GLFW_FLOATING @@ -62,11 +60,11 @@ namespace nCine struct ViewportData { GLFWwindow* Window; - bool WindowOwned; - int IgnoreWindowPosEventFrame; - int IgnoreWindowSizeEventFrame; + bool WindowOwned; + int IgnoreWindowPosEventFrame; + int IgnoreWindowSizeEventFrame; #if defined(DEATH_TARGET_WINDOWS) - WNDPROC PrevWndProc; + WNDPROC PrevWndProc; #endif ViewportData() @@ -314,7 +312,7 @@ namespace nCine } } - LRESULT CALLBACK ImGui_ImplGlfw_WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + LRESULT CALLBACK wndProcHook(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { WNDPROC prevWndproc = glfwWndProc; #if defined(IMGUI_HAS_VIEWPORT) @@ -483,7 +481,7 @@ namespace nCine #if defined(DEATH_TARGET_WINDOWS) glfwWndProc = (WNDPROC)::GetWindowLongPtr((HWND)mainViewport->PlatformHandleRaw, GWLP_WNDPROC); IM_ASSERT(glfwWndProc != nullptr); - ::SetWindowLongPtr((HWND)mainViewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc); + ::SetWindowLongPtr((HWND)mainViewport->PlatformHandleRaw, GWLP_WNDPROC, (LONG_PTR)wndProcHook); #endif } @@ -1140,7 +1138,7 @@ namespace nCine # if !GLFW_HAS_MOUSE_PASSTHROUGH && GLFW_HAS_WINDOW_HOVERED && defined(DEATH_TARGET_WINDOWS) ::SetPropA(hwnd, "IMGUI_VIEWPORT", viewport); vd->PrevWndProc = (WNDPROC)::GetWindowLongPtrW(hwnd, GWLP_WNDPROC); - ::SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)ImGui_ImplGlfw_WndProc); + ::SetWindowLongPtrW(hwnd, GWLP_WNDPROC, (LONG_PTR)wndProcHook); # endif # if !GLFW_HAS_FOCUS_ON_SHOW @@ -1227,7 +1225,6 @@ namespace nCine return glfwGetWindowAttrib(vd->Window, GLFW_ICONIFIED) != 0; } - void ImGuiGlfwInput::onSetWindowAlpha(ImGuiViewport* viewport, float alpha) { # if GLFW_HAS_WINDOW_ALPHA diff --git a/Sources/nCine/Graphics/ImGuiDrawing.cpp b/Sources/nCine/Graphics/ImGuiDrawing.cpp index 87e0867e..62146b59 100644 --- a/Sources/nCine/Graphics/ImGuiDrawing.cpp +++ b/Sources/nCine/Graphics/ImGuiDrawing.cpp @@ -33,16 +33,16 @@ using namespace Death::Containers::Literals; using namespace Death::IO; #if defined(DEATH_TRACE_GL_ERRORS) -# define GL_CALL(_CALL) \ - do { \ - _CALL; \ - GLenum glErr_ = glGetError(); \ - if (glErr_ != 0) { \ - LOGE("GL error 0x%x returned from '%s'", glErr_, #_CALL); \ - } \ +# define GL_CALL(op) \ + do { \ + op; \ + GLenum glErr_ = glGetError(); \ + if (glErr_ != 0) { \ + LOGE("GL error 0x%x returned from '%s'", glErr_, #op); \ + } \ } while (0) #else -# define GL_CALL(_CALL) _CALL +# define GL_CALL(op) op #endif namespace nCine @@ -443,6 +443,7 @@ namespace nCine attribLocationVtxColor_ = (GLuint)glGetAttribLocation(shaderHandle, "aColor"); // Create buffers + // TODO: Use nCine GLBufferObject directly glGenBuffers(1, &vboHandle_); glGenBuffers(1, &elementsHandle_); diff --git a/cmake/ncine_imported_targets.cmake b/cmake/ncine_imported_targets.cmake index 5fdaebd2..0cad9b64 100644 --- a/cmake/ncine_imported_targets.cmake +++ b/cmake/ncine_imported_targets.cmake @@ -61,8 +61,10 @@ if(EMSCRIPTEN) if(NCINE_PREFERRED_BACKEND STREQUAL "GLFW") add_library(GLFW::GLFW INTERFACE IMPORTED) + #set_target_properties(GLFW::GLFW PROPERTIES + # INTERFACE_LINK_OPTIONS "SHELL:-s USE_GLFW=3") set_target_properties(GLFW::GLFW PROPERTIES - INTERFACE_LINK_OPTIONS "SHELL:-s USE_GLFW=3") + INTERFACE_LINK_OPTIONS "SHELL:--use-port=contrib.glfw3") set(GLFW_FOUND 1) elseif(NCINE_PREFERRED_BACKEND STREQUAL "SDL2") add_library(SDL2::SDL2 INTERFACE IMPORTED)