]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
vid: clean up some globals
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 15 Apr 2024 20:06:54 +0000 (06:06 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sun, 21 Apr 2024 14:00:32 +0000 (00:00 +1000)
Fixes vid_stick_mouse assuming window width and height couldn't change

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
vid.h
vid_sdl.c

diff --git a/vid.h b/vid.h
index e360c712b3210cb4acb1b28590c371041380becf..182d6e3865c27bf2324749935038840670bd1a9e 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -95,8 +95,6 @@ typedef struct viddef_s
 
 // global video state
 extern viddef_t vid;
-extern void (*vid_menudrawfn)(void);
-extern void (*vid_menukeyfn)(int key);
 
 #define MAXJOYAXIS 16
 // if this is changed, the corresponding code in vid_shared.c must be updated
index 742dd0b137556150dca2c131effb9bf0642ff49e..2a9bb0c3baa2d8e0fcf83d362755722915d5c5ef 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -77,9 +77,6 @@ static cvar_t joy_sdl2_trigger_deadzone = {CF_ARCHIVE | CF_CLIENT, "joy_sdl2_tri
 static cvar_t *steelstorm_showing_map = NULL; // detect but do not create the cvar
 static cvar_t *steelstorm_showing_mousecursor = NULL; // detect but do not create the cvar
 
-static int win_half_width = 50;
-static int win_half_height = 50;
-
 static SDL_GLContext context;
 static SDL_Window *window;
 
@@ -981,6 +978,8 @@ void IN_Move( void )
                        {
                                // have the mouse stuck in the middle, example use: prevent expose effect of beryl during the game when not using
                                // window grabbing. --blub
+                               int win_half_width = vid.mode.width>>1;
+                               int win_half_height = vid.mode.height>>1;
        
                                // we need 2 frames to initialize the center position
                                if(!stuck)
@@ -1679,9 +1678,6 @@ static qbool VID_InitModeGL(viddef_mode_t *mode)
        vid.yPos = SDL_WINDOWPOS_CENTERED_DISPLAY(vid.displayindex);
        vid_wmborder_waiting = vid_wmborderless = false;
 
-       win_half_width = mode->width>>1;
-       win_half_height = mode->height>>1;
-
        if(vid_resizable.integer)
                windowflags |= SDL_WINDOW_RESIZABLE;