#define tenoh 0,0,0,0,0, 0,0,0,0,0
#define fiftyoh tenoh, tenoh, tenoh, tenoh, tenoh
#define hundredoh fiftyoh, fiftyoh
#define tenoh 0,0,0,0,0, 0,0,0,0,0
#define fiftyoh tenoh, tenoh, tenoh, tenoh, tenoh
#define hundredoh fiftyoh, fiftyoh
{
0,0,0,0, //SDLK_UNKNOWN = 0,
0,0,0,0, //SDLK_FIRST = 0,
{
0,0,0,0, //SDLK_UNKNOWN = 0,
0,0,0,0, //SDLK_FIRST = 0,
-static void IN_Activate( void )
-{
- SDL_WM_GrabInput( SDL_GRAB_ON );
- SDL_ShowCursor( SDL_DISABLE );
-}
-
-static void IN_Deactivate( void )
-{
- SDL_WM_GrabInput( SDL_GRAB_OFF );
- SDL_ShowCursor( SDL_ENABLE );
-}
-
-void IN_Commands (void)
+static void IN_Activate( qboolean grab )
-}
-
-static void IN_MouseMove (usercmd_t *cmd)
-{
- int x, y;
-
- if( !vid_usingmouse ) {
- IN_Mouse( cmd, 0, 0 );
- return;
+ if (grab)
+ {
+ if (!vid_usingmouse)
+ {
+ vid_usingmouse = true;
+ cl_ignoremousemove = true;
+ SDL_WM_GrabInput( SDL_GRAB_ON );
+ SDL_ShowCursor( SDL_DISABLE );
+ }
+ }
+ else
+ {
+ if (vid_usingmouse)
+ {
+ vid_usingmouse = false;
+ cl_ignoremousemove = true;
+ SDL_WM_GrabInput( SDL_GRAB_OFF );
+ SDL_ShowCursor( SDL_ENABLE );
+ }
-
- SDL_GetRelativeMouseState( &x, &y );
- IN_Mouse( cmd, x, y );
-}
-
-void IN_Move( usercmd_t *cmd )
-{
- IN_MouseMove( cmd );
-}
-
-static void IN_Init( void )
-{
- // init keyboard
- SDL_EnableUNICODE( SDL_ENABLE );
-
- // init mouse
- vid_usingmouse = false;
{
//TODO: Add a quit query in linux, too - though linux user are more likely to know what they do
#ifdef WIN32
if( event->type == SDL_QUIT && MessageBox( NULL, "Are you sure you want to quit?", "Confirm Exit", MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION ) == IDNO )
return 0;
{
//TODO: Add a quit query in linux, too - though linux user are more likely to know what they do
#ifdef WIN32
if( event->type == SDL_QUIT && MessageBox( NULL, "Are you sure you want to quit?", "Confirm Exit", MB_YESNO | MB_SETFOREGROUND | MB_ICONQUESTION ) == IDNO )
return 0;
- 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) );
event.button.button = SDL_BUTTON_RIGHT;
else if( event.button.button == SDL_BUTTON_RIGHT )
event.button.button = SDL_BUTTON_MIDDLE;
Key_Event( K_MOUSE1 + event.button.button - 1, 0, true );
break;
case SDL_MOUSEBUTTONUP:
event.button.button = SDL_BUTTON_RIGHT;
else if( event.button.button == SDL_BUTTON_RIGHT )
event.button.button = SDL_BUTTON_MIDDLE;
Key_Event( K_MOUSE1 + event.button.button - 1, 0, true );
break;
case SDL_MOUSEBUTTONUP:
event.button.button = SDL_BUTTON_RIGHT;
else if( event.button.button == SDL_BUTTON_RIGHT )
event.button.button = SDL_BUTTON_MIDDLE;
event.button.button = SDL_BUTTON_RIGHT;
else if( event.button.button == SDL_BUTTON_RIGHT )
event.button.button = SDL_BUTTON_MIDDLE;
if (SDL_Init(SDL_INIT_VIDEO) < 0)
Sys_Error ("Failed to init video: %s\n", SDL_GetError());
vid_isfullscreen = false;
if (SDL_Init(SDL_INIT_VIDEO) < 0)
Sys_Error ("Failed to init video: %s\n", SDL_GetError());
vid_isfullscreen = false;
- //icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) );
- icon = LoadIcon( NULL, IDI_ERROR );
+ icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) );
"Using SDL library version %d.%d.%d\n",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL,
"Using SDL library version %d.%d.%d\n",
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL,
}
int VID_InitMode(int fullscreen, int width, int height, int bpp)
}
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.
*/
We cant switch from one OpenGL video mode to another.
Thus we first switch to some stupid 2D mode and then back to OpenGL.
*/
SDL_SetVideoMode( 0, 0, 0, 0 );
SDL_SetVideoMode( 0, 0, 0, 0 );
-// COMMANDLINEOPTION: SDL GL: -gl_driver <drivername> 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 <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];
i = COM_CheckParm("-gl_driver");
if (i && i < com_argc - 1)
drivername = com_argv[i + 1];
- if (SDL_GL_LoadLibrary(drivername))
- {
- Con_Printf("Unable to load GL driver \"%s\": ", drivername, SDL_GetError());
+ if (SDL_GL_LoadLibrary(drivername) < 0)
+ {
+ Con_Printf("Unable to load GL driver \"%s\": %s\n", drivername, SDL_GetError());
+ // set up an event filter to ask confirmation on close button in WIN32
+ SDL_SetEventFilter( (SDL_EventFilter) Sys_EventFilter );
+ // init keyboard
+ SDL_EnableUNICODE( SDL_ENABLE );
+ // enable key repeat since everyone expects it
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+
gl_renderer = qglGetString(GL_RENDERER);
gl_vendor = qglGetString(GL_VENDOR);
gl_version = qglGetString(GL_VERSION);
gl_renderer = qglGetString(GL_RENDERER);
gl_vendor = qglGetString(GL_VENDOR);
gl_version = qglGetString(GL_VERSION);
if( !( appstate & SDL_APPMOUSEFOCUS ) || !( appstate & SDL_APPINPUTFOCUS ) )
vid_activewindow = false;
if( !( appstate & SDL_APPMOUSEFOCUS ) || !( appstate & SDL_APPINPUTFOCUS ) )
vid_activewindow = false;