X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=vid_sdl.c;h=c2ece5914dd0b132ed901be4e774ce3f706e8676;hb=e40a37e7e99114e259dffe2e36416f0c238a6b40;hp=b366fd9b18baf70ff7ff427e3be6a8d6c3219cd3;hpb=be78599265318efb91ca18071f3f9356c4e5a7ea;p=xonotic%2Fdarkplaces.git diff --git a/vid_sdl.c b/vid_sdl.c index b366fd9b..c2ece591 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -218,28 +218,30 @@ void IN_Commands (void) { } -static void IN_MouseMove (usercmd_t *cmd) +static void IN_MouseMove (void) { int x, y; if( !vid_usingmouse ) { - IN_Mouse( cmd, 0, 0 ); + IN_Mouse( 0, 0 ); return; } SDL_GetRelativeMouseState( &x, &y ); - IN_Mouse( cmd, x, y ); + IN_Mouse( x, y ); } -void IN_Move( usercmd_t *cmd ) +void IN_Move( void ) { - IN_MouseMove( cmd ); + IN_MouseMove(); } static void IN_Init( void ) { // init keyboard SDL_EnableUNICODE( SDL_ENABLE ); + // enable key repeat since everyone expects it + SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // init mouse vid_usingmouse = false; @@ -277,7 +279,7 @@ void Sys_SendKeyEvents( void ) break; case SDL_KEYDOWN: case SDL_KEYUP: - Key_Event( MapKey( event.key.keysym.sym ), event.key.keysym.unicode, (event.key.state == SDL_PRESSED) ); + Key_Event( MapKey( event.key.keysym.sym ), (char)event.key.keysym.unicode, (event.key.state == SDL_PRESSED) ); break; case SDL_ACTIVEEVENT: if( event.active.state == SDL_APPACTIVE ) @@ -359,7 +361,7 @@ static void VID_OutputVersion() { const SDL_version *version; version = SDL_Linked_Version(); - Con_DPrintf( "Linked against SDL version %d.%d.%d\n" + Con_Printf( "Linked against SDL version %d.%d.%d\n" "Using SDL library version %d.%d.%d\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL, version->major, version->minor, version->patch ); @@ -378,23 +380,20 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) We cant switch from one OpenGL video mode to another. Thus we first switch to some stupid 2D mode and then back to OpenGL. */ +#ifndef MACOSX SDL_SetVideoMode( 0, 0, 0, 0 ); - -#ifdef WIN32 - drivername = "opengl32.dll"; -#elif defined(__APPLE__) && defined(__MACH__) - drivername = "OpenGL.framework"; -#else - drivername = "libGL.so.1"; #endif -// COMMANDLINEOPTION: SDL GL: -gl_driver selects a GL driver library, default is libGL.so.1 (Linux/BSD) or opengl32.dll (windows) or OpenGL.framework (MacOSX), useful only for 3dfxogl.dll/3dfxvgl.dll or fxmesa or similar, if you don't know what this is for, you don't need it + // SDL usually knows best + drivername = NULL; + +// COMMANDLINEOPTION: SDL GL: -gl_driver selects a GL driver library, default is whatever SDL recommends, useful only for 3dfxogl.dll/3dfxvgl.dll or fxmesa or similar, if you don't know what this is for, you don't need it i = COM_CheckParm("-gl_driver"); if (i && i < com_argc - 1) drivername = com_argv[i + 1]; - if (SDL_GL_LoadLibrary(drivername)) + if (SDL_GL_LoadLibrary(drivername) < 0) { - Con_Printf("Unable to load GL driver \"%s\": ", drivername, SDL_GetError()); + Con_Printf("Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError()); return false; }