mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-23 09:34:35 -05:00
Webclient: Try to support mouse 4/5 presses, and also intercept clicking mouse4 closing the page
This commit is contained in:
parent
7a6402d988
commit
b4ec7a31e2
2 changed files with 7 additions and 2 deletions
|
@ -655,8 +655,11 @@ cc_bool Game_ShouldClose(void) {
|
||||||
/* Close if map was saved within last 5 seconds */
|
/* Close if map was saved within last 5 seconds */
|
||||||
return World.LastSave + 5 >= Game.Time;
|
return World.LastSave + 5 >= Game.Time;
|
||||||
}
|
}
|
||||||
/* Intercept Ctrl+W or Cmd+W for multiplayer */
|
|
||||||
return !(Key_IsCtrlPressed() || Key_IsWinPressed());
|
/* Try to intercept Ctrl+W or Cmd+W for multiplayer */
|
||||||
|
if (Key_IsCtrlPressed() || Key_IsWinPressed()) return false;
|
||||||
|
/* Also try to intercept mouse back button (Mouse4) */
|
||||||
|
return !Input_Pressed[KEY_XBUTTON1];
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static void Game_RunLoop(void) {
|
static void Game_RunLoop(void) {
|
||||||
|
|
|
@ -2793,6 +2793,8 @@ static EM_BOOL OnMouseButton(int type, const EmscriptenMouseEvent* ev, void* dat
|
||||||
case 0: Input_Set(KEY_LMOUSE, down); break;
|
case 0: Input_Set(KEY_LMOUSE, down); break;
|
||||||
case 1: Input_Set(KEY_MMOUSE, down); break;
|
case 1: Input_Set(KEY_MMOUSE, down); break;
|
||||||
case 2: Input_Set(KEY_RMOUSE, down); break;
|
case 2: Input_Set(KEY_RMOUSE, down); break;
|
||||||
|
case 3: Input_Set(KEY_XBUTTON1, down); break;
|
||||||
|
case 4: Input_Set(KEY_XBUTTON2, down); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeferredEnableRawMouse();
|
DeferredEnableRawMouse();
|
||||||
|
|
Loading…
Add table
Reference in a new issue