From f8ef92213d39fb1b9fae3572ebb3340ddd71d7e5 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 1 Jan 2013 03:52:56 +0000 Subject: [PATCH] - fix windows compile --- .../sources/platform/sdl/window_gl.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/shared_lib/sources/platform/sdl/window_gl.cpp b/source/shared_lib/sources/platform/sdl/window_gl.cpp index b1d0e3fac..df569c4ec 100644 --- a/source/shared_lib/sources/platform/sdl/window_gl.cpp +++ b/source/shared_lib/sources/platform/sdl/window_gl.cpp @@ -14,6 +14,12 @@ #include "graphics_interface.h" #include "util.h" #include "platform_util.h" +#include "sdl_private.h" +#include "opengl.h" + +#ifdef WIN32 +#include "SDL_syswm.h" +#endif #include "leak_dumper.h" using namespace Shared::Graphics; @@ -55,9 +61,11 @@ bool WindowGl::ChangeVideoMode(bool preserveContext, int resWidth, int resHeight if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d] preserveContext = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,preserveContext); #ifdef WIN32 - if(preserveContext == true) { - SDL_SysWMinfo info; + SDL_SysWMinfo info; + HDC tempDC = 0; + HGLRC tempRC = 0; + if(preserveContext == true) { // get window handle from SDL SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info) == -1) { @@ -66,10 +74,10 @@ bool WindowGl::ChangeVideoMode(bool preserveContext, int resWidth, int resHeight } // get device context handle - HDC tempDC = GetDC( info.window ); + tempDC = GetDC( info.window ); // create temporary context - HGLRC tempRC = wglCreateContext( tempDC ); + tempRC = wglCreateContext( tempDC ); if (tempRC == NULL) { if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s %d] wglCreateContext failed\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); return false;