mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
More mouse grab/release tuning.
This commit is contained in:
parent
b529eb3a9c
commit
247e2baa3a
3 changed files with 38 additions and 24 deletions
4
README
4
README
|
@ -682,8 +682,8 @@ When playing in window mode my cursor is locked onto the window. Can I change
|
|||
that, so that Quake II behaves like a normal window?
|
||||
- Open the console by pressing ~ or ^ or drop into the menu. If you want Quake
|
||||
II to never grab the mouse set "in_grab" to 0, if Quake II should never
|
||||
release the mouse set 1, for releasing the mouse when the console is opened
|
||||
set to 2. The default is 2.
|
||||
release the mouse set 1, for releasing the mouse when the console or the
|
||||
menu is opened set to 2. The default is 2.
|
||||
|
||||
Hey, my screensaver crashes Quake II or I experience strange crashes after a
|
||||
fixed amount of time!
|
||||
|
|
|
@ -77,6 +77,8 @@ static cvar_t *freelook;
|
|||
static cvar_t *m_filter;
|
||||
static cvar_t *in_mouse;
|
||||
|
||||
cvar_t *vid_fullscreen;
|
||||
|
||||
/*
|
||||
* This function translates the SDL keycodes
|
||||
* to the internal key representation of the
|
||||
|
@ -354,8 +356,6 @@ IN_GetEvent(SDL_Event *event)
|
|||
KeyStates[SDLK_RALT]) &&
|
||||
(event->key.keysym.sym == SDLK_RETURN))
|
||||
{
|
||||
cvar_t *fullscreen;
|
||||
|
||||
SDL_WM_ToggleFullScreen(surface);
|
||||
|
||||
if (surface->flags & SDL_FULLSCREEN)
|
||||
|
@ -367,8 +367,7 @@ IN_GetEvent(SDL_Event *event)
|
|||
ri.Cvar_SetValue("vid_fullscreen", 0);
|
||||
}
|
||||
|
||||
fullscreen = ri.Cvar_Get("vid_fullscreen", "0", 0);
|
||||
fullscreen->modified = false;
|
||||
vid_fullscreen->modified = false;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -470,7 +469,31 @@ IN_Update(void)
|
|||
|
||||
/* Grab and ungrab the mouse if the
|
||||
* console or the menu is opened */
|
||||
if (in_grab->value == 2)
|
||||
if (vid_fullscreen->value)
|
||||
{
|
||||
if (!mouse_grabbed)
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
mouse_grabbed = true;
|
||||
}
|
||||
}
|
||||
if (in_grab->value == 0)
|
||||
{
|
||||
if (mouse_grabbed)
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
mouse_grabbed = false;
|
||||
}
|
||||
}
|
||||
else if (in_grab->value == 1)
|
||||
{
|
||||
if (!mouse_grabbed)
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
mouse_grabbed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (windowed_mouse->value)
|
||||
{
|
||||
|
@ -489,22 +512,6 @@ IN_Update(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (in_grab->value == 1)
|
||||
{
|
||||
if (!mouse_grabbed)
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||
mouse_grabbed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mouse_grabbed)
|
||||
{
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
mouse_grabbed = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Process the key events */
|
||||
while (keyq_head != keyq_tail)
|
||||
|
@ -629,6 +636,8 @@ IN_BackendInit(in_state_t *in_state_p)
|
|||
CVAR_USERINFO | CVAR_ARCHIVE);
|
||||
in_grab = ri.Cvar_Get("in_grab", "2", CVAR_ARCHIVE);
|
||||
|
||||
vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
||||
|
||||
ri.Con_Printf(PRINT_ALL, "Input initialized.\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -692,8 +692,13 @@ CL_FixCvarCheats(void)
|
|||
void
|
||||
CL_UpdateWindowedMouse(void)
|
||||
{
|
||||
if (cls.disable_screen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (cls.key_dest == key_menu || cls.key_dest == key_console ||
|
||||
(cls.key_dest == key_game && cls.state != ca_active && !cls.disable_screen))
|
||||
(cls.key_dest == key_game && (cls.state != ca_active || !cl.refresh_prepped)))
|
||||
{
|
||||
Cvar_SetValue("windowed_mouse", 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue