Fix SDL2 compile-errors, made it work on Win64

.. when compiled with MSVC2012
This commit is contained in:
Kevin Doyon 2013-04-19 14:40:34 -04:00 committed by Daniel Gibson
parent cedc129a0e
commit 6407881cff
3 changed files with 12 additions and 9 deletions

View file

@ -213,6 +213,7 @@ elseif(MSVC)
add_definitions(/wd4714) # 'function' marked as __forceinline not inlined
add_definitions(/wd4996) # 'function': was declared deprecated
add_definitions(/wd4068) # unknown pragma
add_definitions(-D_ALLOW_KEYWORD_MACROS) # because of the "#define private public" and "#define protected public" in TypeInfo.cpp
set(CMAKE_C_FLAGS_DEBUG "-D_DEBUG /Od /Zi /MDd")
set(CMAKE_C_FLAGS_RELEASE "/Ox /Oy /MD")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/Ox /Oy /Zi /MD")

View file

@ -424,15 +424,17 @@ sysEvent_t Sys_GetEvent() {
#if SDL_VERSION_ATLEAST(2, 0, 0)
case SDL_WINDOWEVENT:
switch (ev.window.event) {
case SDL_WINDOWEVENT_FOCUS_GAINED:
// unset modifier, in case alt-tab was used to leave window and ALT is still set
// as that can cause fullscreen-toggling when pressing enter...
SDL_Keymod currentmod = SDL_GetModState();
int newmod = KMOD_NONE;
if (currentmod & KMOD_CAPS) // preserve capslock
newmod |= KMOD_CAPS;
case SDL_WINDOWEVENT_FOCUS_GAINED: {
// unset modifier, in case alt-tab was used to leave window and ALT is still set
// as that can cause fullscreen-toggling when pressing enter...
SDL_Keymod currentmod = SDL_GetModState();
int newmod = KMOD_NONE;
if (currentmod & KMOD_CAPS) // preserve capslock
newmod |= KMOD_CAPS;
SDL_SetModState((SDL_Keymod)newmod);
SDL_SetModState((SDL_Keymod)newmod);
} // new context because visual studio complains about newmod and currentmod not initialized because of the case SDL_WINDOWEVENT_FOCUS_LOST
GLimp_GrabInput(GRAB_ENABLE | GRAB_REENABLE | GRAB_HIDECURSOR);
break;

View file

@ -393,7 +393,7 @@ Sys_ListFiles
int Sys_ListFiles( const char *directory, const char *extension, idStrList &list ) {
idStr search;
struct _finddata_t findinfo;
int findhandle;
intptr_t findhandle;
int flag;
if ( !extension) {