Changeset View
Changeset View
Standalone View
Standalone View
source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp
Show All 38 Lines | |||||
#include "ps/VideoMode.h" | #include "ps/VideoMode.h" | ||||
#include "ps/GameSetup/Config.h" | #include "ps/GameSetup/Config.h" | ||||
#include "ps/GameSetup/GameSetup.h" | #include "ps/GameSetup/GameSetup.h" | ||||
#include "renderer/Renderer.h" | #include "renderer/Renderer.h" | ||||
#if OS_WIN | #if OS_WIN | ||||
// We don't include wutil header directly to prevent including Windows headers. | // We don't include wutil header directly to prevent including Windows headers. | ||||
extern void wutil_SetAppWindow(void* hwnd); | extern void wutil_SetAppWindow(void* hwnd); | ||||
extern void* wutil_GetAppHDC(SDL_Window* window); | |||||
#endif | #endif | ||||
namespace AtlasMessage | namespace AtlasMessage | ||||
{ | { | ||||
InputProcessor g_Input; | InputProcessor g_Input; | ||||
// This keeps track of the last in-game user input. | // This keeps track of the last in-game user input. | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | MESSAGEHANDLER(InitSDL) | ||||
SDL_GL_LoadLibrary(NULL); // NULL = use default | SDL_GL_LoadLibrary(NULL); // NULL = use default | ||||
// (it shouldn't hurt if this is called multiple times, I think) | // (it shouldn't hurt if this is called multiple times, I think) | ||||
} | } | ||||
MESSAGEHANDLER(InitGraphics) | MESSAGEHANDLER(InitGraphics) | ||||
{ | { | ||||
UNUSED2(msg); | UNUSED2(msg); | ||||
ogl_Init(); | #if OS_WIN | ||||
ogl_Init(SDL_GL_GetProcAddress, wutil_GetAppHDC(SDL_GL_GetCurrentWindow())); | |||||
#elif defined(SDL_VIDEO_DRIVER_X11) && !CONFIG2_GLES | |||||
ogl_Init(SDL_GL_GetProcAddress, GetX11Display(SDL_GL_GetCurrentWindow())); | |||||
#else | |||||
ogl_Init(SDL_GL_GetProcAddress); | |||||
#endif | |||||
vladislavbelov: `SDL_GL_GetCurrentWindow` shouldn't guarantee to work, since wxWidgets creates windows not SDL. | |||||
InitGraphics(g_AtlasGameLoop->args, g_InitFlags, {}); | InitGraphics(g_AtlasGameLoop->args, g_InitFlags, {}); | ||||
#if OS_WIN | #if OS_WIN || defined(SDL_VIDEO_DRIVER_X11) && !CONFIG2_GLES | ||||
// HACK (to stop things looking very ugly when scrolling) - should | ogl_SetVsyncEnabled(true); | ||||
Done Inline ActionsWhy not force always? vladislavbelov: Why not force always? | |||||
Done Inline ActionsTodo said use proper config system but sure I can. Stan: Todo said use proper config system but sure I can. | |||||
// use proper config system. | |||||
if(ogl_HaveExtension("WGL_EXT_swap_control")) | |||||
pwglSwapIntervalEXT(1); | |||||
#endif | #endif | ||||
} | } | ||||
MESSAGEHANDLER(Shutdown) | MESSAGEHANDLER(Shutdown) | ||||
{ | { | ||||
UNUSED2(msg); | UNUSED2(msg); | ||||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
SDL_GL_GetCurrentWindow shouldn't guarantee to work, since wxWidgets creates windows not SDL.