X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=a37cdda07b671cc376182fc44b44374f951f3e86;hb=055013bac06c70d04b46bc2e66bde847bdada1d4;hp=244e13505d85949f081aa5db625b5c6f1e471194;hpb=76798663af96758c0894d583ca0e1aa7b58728c3;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 244e135..a37cdda 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -470,6 +470,7 @@ static inline int clamp_sdl_mouse_button(Uint8 button) static void sdlEventProc(const SDL_Event &e, Game &game) { int val; + bool skipkey = false; SDLMod mod; switch(e.type) @@ -508,6 +509,7 @@ static void sdlEventProc(const SDL_Event &e, Game &game) { if (e.key.keysym.mod & KMOD_CTRL) { + skipkey = true; SDL_GrabMode mode = SDL_GRAB_ON; if ((SDL_GetVideoSurface()->flags & SDL_FULLSCREEN) == 0) { @@ -521,10 +523,13 @@ static void sdlEventProc(const SDL_Event &e, Game &game) else if (e.key.keysym.sym == SDLK_RETURN) { if (e.key.keysym.mod & KMOD_ALT) + { + skipkey = true; SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); + } } - if (e.key.keysym.sym < SDLK_LAST) + if ((!skipkey) && (e.key.keysym.sym < SDLK_LAST)) { if (KeyTable[e.key.keysym.sym] != 0xffff) SetKey(KeyTable[e.key.keysym.sym]); @@ -928,6 +933,8 @@ Boolean SetUp (Game & game) SDL_ShowCursor(0); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + if (SDL_SetVideoMode(kContextWidth, kContextHeight, 0, sdlflags) == NULL) { fprintf(stderr, "SDL_SetVideoMode() failed: %s\n", SDL_GetError()); @@ -947,6 +954,14 @@ Boolean SetUp (Game & game) } } + int dblbuf = 0; + if ((SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &dblbuf) == -1) || (!dblbuf)) + { + fprintf(stderr, "Failed to get double buffered GL context!\n"); + SDL_Quit(); + return false; + } + if (!lookup_all_glsyms()) { SDL_Quit();