windowed_mouse_always zum permanenten Freigeben der Maus

This commit is contained in:
Yamagi Burmeister 2010-01-08 16:05:18 +00:00
parent 315f07cae7
commit 2a82db9509
2 changed files with 49 additions and 39 deletions

3
README
View file

@ -236,7 +236,8 @@ My OpenGL is not working!
====== ======
How do I open the console? How do I open the console?
- Press "^" or "~", depending on your keyboard layout. - Press "^" or "~", depending on your keyboard layout. If you want
Quake II to never grap the mouse set "windowed_mouse_always" to 1.
How do I get the frame counter? How do I get the frame counter?
- Set cl_drawfps to 1 - Set cl_drawfps to 1

View file

@ -67,9 +67,11 @@ int mx, my, mouse_buttonstate;
static float old_windowed_mouse; static float old_windowed_mouse;
static cvar_t *windowed_mouse; static cvar_t *windowed_mouse;
static cvar_t *windowed_mouse_always;
void RW_IN_PlatformInit() { void RW_IN_PlatformInit() {
windowed_mouse = ri.Cvar_Get ("windowed_mouse", "1", CVAR_ARCHIVE); windowed_mouse = ri.Cvar_Get ("windowed_mouse", "1", CVAR_ARCHIVE);
windowed_mouse_always = ri.Cvar_Get ("windowed_mouse_always", "1", CVAR_ARCHIVE);
} }
void RW_IN_Activate(qboolean active) void RW_IN_Activate(qboolean active)
@ -525,7 +527,8 @@ void KBD_Update(void)
if (SDL_BUTTON(7) & bstate) if (SDL_BUTTON(7) & bstate)
mouse_buttonstate |= (1 << 4); mouse_buttonstate |= (1 << 4);
if (windowed_mouse_always->value == 1)
{
if (old_windowed_mouse != windowed_mouse->value) { if (old_windowed_mouse != windowed_mouse->value) {
old_windowed_mouse = windowed_mouse->value; old_windowed_mouse = windowed_mouse->value;
@ -535,6 +538,12 @@ void KBD_Update(void)
SDL_WM_GrabInput(SDL_GRAB_ON); SDL_WM_GrabInput(SDL_GRAB_ON);
} }
} }
}
else
{
SDL_WM_GrabInput(SDL_GRAB_OFF);
}
while (keyq_head != keyq_tail) while (keyq_head != keyq_tail)
{ {
in_state->Key_Event_fp(keyq[keyq_tail].key, keyq[keyq_tail].down); in_state->Key_Event_fp(keyq[keyq_tail].key, keyq[keyq_tail].down);