diff --git a/libs/sdl/sdl.c b/libs/sdl/sdl.c index 70ea07a2b..7422dcb4a 100644 --- a/libs/sdl/sdl.c +++ b/libs/sdl/sdl.c @@ -5,6 +5,7 @@ #if defined(_WIN32) || defined(__ANDROID__) || defined(HL_IOS) || defined(HL_TVOS) # include +# include # include #else # include @@ -515,12 +516,20 @@ DEFINE_PRIM(_BOOL, hint_value, _BYTES _BYTES); HL_PRIM SDL_Window *HL_NAME(win_create_ex)(int x, int y, int width, int height, int sdlFlags) { // force window to match device resolution on mobile + if (sdlFlags & ( +#ifdef HL_MAC + SDL_WINDOW_METAL | +#endif + SDL_WINDOW_VULKAN ) == 0) { + sdlFlags |= SDL_WINDOW_OPENGL; + } + #ifdef HL_MOBILE SDL_DisplayMode displayMode; SDL_GetDesktopDisplayMode(0, &displayMode); - SDL_Window* win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | sdlFlags); + SDL_Window* win = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_BORDERLESS | sdlFlags); #else - SDL_Window* win = SDL_CreateWindow("", x, y, width, height, SDL_WINDOW_OPENGL | sdlFlags); + SDL_Window* win = SDL_CreateWindow("", x, y, width, height, sdlFlags); #endif # ifdef HL_WIN // force window to show even if the debugger force process windows to be hidden diff --git a/libs/sdl/sdl/Window.hx b/libs/sdl/sdl/Window.hx index ed66f4fbb..e043a7b59 100644 --- a/libs/sdl/sdl/Window.hx +++ b/libs/sdl/sdl/Window.hx @@ -45,6 +45,7 @@ class Window { public static inline var SDL_WINDOW_TOOLTIP = 0x00040000; public static inline var SDL_WINDOW_POPUP_MENU = 0x00080000; public static inline var SDL_WINDOW_VULKAN = 0x10000000; + public static inline var SDL_WINDOW_METAL = 0x20000000; var win : WinPtr; var glctx : GLContext;