#undef fiftyoh
#undef hundredoh
-static int MapKey( int sdlkey )
+static int MapKey( unsigned int sdlkey )
{
if( sdlkey > sizeof(tbl_sdltoquake)/ sizeof(int) )
return 0;
{
}
-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 )
break;
case SDL_ACTIVEEVENT:
if( event.active.state == SDL_APPACTIVE )
+ {
if( event.active.gain )
vid_hidden = false;
else
vid_hidden = true;
+ }
break;
case SDL_MOUSEBUTTONDOWN:
if( event.button.button == SDL_BUTTON_MIDDLE )
{
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 );
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
+ // SDL usually knows best
+ drivername = NULL;
+
+// COMMANDLINEOPTION: SDL GL: -gl_driver <drivername> 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;
}
vid_isfullscreen = true;
}
- SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 1);
- SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 1);
- SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1);
- SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
+ if (bpp >= 32)
+ {
+ SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 8);
+ SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 8);
+ SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 8);
+ SDL_GL_SetAttribute (SDL_GL_ALPHA_SIZE, 8);
+ SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 24);
+ SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE, 8);
+ }
+ else
+ {
+ SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 1);
+ SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 1);
+ SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1);
+ SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
+ }
screen = SDL_SetVideoMode(width, height, bpp, flags);
if (screen == NULL)
Uint8 appstate;
int vid_usemouse;
- qglFinish();
+ if (r_speeds.integer || gl_finish.integer)
+ qglFinish();
SDL_GL_SwapBuffers();
//react on appstate changes