Skip to content

Commit

Permalink
UWP splash screen, --use-port=contrib.glfw3 for Emscripten, minor c…
Browse files Browse the repository at this point in the history
…hanges
  • Loading branch information
deathkiller committed Jun 15, 2024
1 parent 97dd38d commit fce9397
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
Binary file modified Sources/Icons/SplashScreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Sources/Package.appxmanifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<uap:VisualElements
DisplayName="@NCINE_APP_NAME@"
Description="@NCINE_APP_DESCRIPTION@"
BackgroundColor="#FFFFFF"
BackgroundColor="#000000"
Square150x150Logo="Assets/Logo.png"
Square44x44Logo="Assets/SmallLogo.png">
<uap:SplashScreen Image="Assets/SplashScreen.png" />
Expand Down
25 changes: 11 additions & 14 deletions Sources/nCine/Backends/ImGuiGlfwInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#include "ImGuiGlfwInput.h"
#include "../Input/ImGuiJoyMappedInput.h"

#if defined(DEATH_TARGET_APPLE)
#if defined(DEATH_TARGET_EMSCRIPTEN)
# include <emscripten.h>
# include <emscripten/html5.h>
#elif defined(DEATH_TARGET_APPLE)
# if !defined(GLFW_EXPOSE_NATIVE_COCOA)
# define GLFW_EXPOSE_NATIVE_COCOA
# endif
Expand All @@ -22,11 +25,6 @@
# endif
#endif

#if defined(DEATH_TARGET_EMSCRIPTEN)
# include <emscripten.h>
# include <emscripten/html5.h>
#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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 9 additions & 8 deletions Sources/nCine/Graphics/ImGuiDrawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -443,6 +443,7 @@ namespace nCine
attribLocationVtxColor_ = (GLuint)glGetAttribLocation(shaderHandle, "aColor");

// Create buffers
// TODO: Use nCine GLBufferObject directly
glGenBuffers(1, &vboHandle_);
glGenBuffers(1, &elementsHandle_);

Expand Down
4 changes: 3 additions & 1 deletion cmake/ncine_imported_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fce9397

Please sign in to comment.