diff --git a/SConstruct b/SConstruct index 1bb9a6ad1b..c18222a317 100644 --- a/SConstruct +++ b/SConstruct @@ -96,6 +96,7 @@ vars.AddVariables( BoolVariable('lint', 'Set for lint build (extra warnings)', False), BoolVariable('nowx', 'Set For Building with no WX libs (WIP)', False), BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False), + BoolVariable('sdlgl', 'Set For Building with SDL GL libs (WIP)', False), EnumVariable('flavor', 'Choose a build flavor', 'release', allowed_values = ('release', 'devel', 'debug'), ignorecase = 2 @@ -190,15 +191,6 @@ env['HAVE_BLUEZ'] = conf.CheckPKG('bluez') # needed for sound env['HAVE_AO'] = conf.CheckPKG('ao') -# handling wx flags CCFLAGS should be created before -wxmods = ['adv', 'core', 'base'] -env['USE_WX'] = 0 -if env['wxgl']: - wxmods.append('gl') - env['USE_WX'] = 1 - -env['HAVE_WX'] = conf.CheckWXConfig('2.8', wxmods, 0) - #osx 64 specifics if sys.platform == 'darwin': if env['osx'] == '64cocoa': @@ -211,13 +203,34 @@ if sys.platform == 'darwin': else: env['HAVE_X11'] = conf.CheckPKG('x11') env['HAVE_COCOA'] = 0 - + +# handling wx flags CCFLAGS should be created before +wxmods = ['adv', 'core', 'base'] +env['USE_WX'] = 0 +if env['wxgl']: + wxmods.append('gl') + env['USE_WX'] = 1 + env['HAVE_X11'] = 0 + env['HAVE_COCOA'] = 0 + +env['HAVE_WX'] = conf.CheckWXConfig('2.8', wxmods, 0) + +# SDL backend +env['USE_SDL'] = 0 + +if env['sdlgl']: + env['USE_SDL'] = 1 + env['HAVE_X11'] = 0 + env['HAVE_COCOA'] = 0 + env['USE_WX'] = 0 + # Gui less build if env['nowx']: env['HAVE_WX'] = 0; # Creating config.h defines conf.Define('HAVE_SDL', env['HAVE_SDL']) +conf.Define('USE_SDL', env['USE_SDL']) conf.Define('HAVE_BLUEZ', env['HAVE_BLUEZ']) conf.Define('HAVE_AO', env['HAVE_AO']) conf.Define('HAVE_WX', env['HAVE_WX']) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index f882d415f6..9d5bb8555d 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -542,9 +542,14 @@ void OpenGL_Update() { #if USE_SDL SDL_Surface *surface = SDL_GetVideoSurface(); + RECT rcWindow; if (!surface) return; nBackbufferWidth = surface->w; nBackbufferHeight = surface->h; + + rcWindow.right = surface->w; + rcWindow.bottom = surface->h; + #elif defined(HAVE_COCOA) && HAVE_COCOA RECT rcWindow; rcWindow.right = GLWin.width; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index 7a340d901d..9f8cdbffde 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -41,6 +41,8 @@ #elif defined(HAVE_X11) && HAVE_X11 #define I_NEED_OS2_H // HAXXOR #include +#elif defined(USE_SDL) && USE_SDL +#include #elif defined(HAVE_COCOA) && HAVE_COCOA #include #include "cocoaGL.h" diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index 901a3f5f16..e1d26f3773 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -95,17 +95,14 @@ conf.Define('HAVE_XXF86VM', gfxenv['HAVE_XXF86VM']) conf.Finish() -# change to True if you want to compile with SDL -useSDL = not ((gfxenv['HAVE_X11'] and gfxenv['HAVE_XXF86VM']) - or gfxenv['HAVE_COCOA']) +# Sanity check +if gfxenv['USE_WX'] and not gfxenv['HAVE_WX']: + print "Must have wx to use wxgl" + Return() - -if useSDL and not gfxenv['HAVE_SDL']: - print name + " must have either X11 or sdl to be build" - Return() - -if useSDL: - compileFlags += [ '-DUSE_SDL=1' ] +if gfxenv['USE_SDL'] and not gfxenv['HAVE_SDL']: + print "Must have sdl to use SDL gl" + Return() gfxenv.Append( CXXFLAGS = compileFlags,