Webclient: Try to support mouse 4/5 presses, and also intercept clicking mouse4 closing the page

This commit is contained in:
UnknownShadow200 2021-03-10 21:10:52 +11:00
parent 7a6402d988
commit b4ec7a31e2
2 changed files with 7 additions and 2 deletions

View file

@ -655,8 +655,11 @@ cc_bool Game_ShouldClose(void) {
/* Close if map was saved within last 5 seconds */
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
static void Game_RunLoop(void) {

View file

@ -2793,6 +2793,8 @@ static EM_BOOL OnMouseButton(int type, const EmscriptenMouseEvent* ev, void* dat
case 0: Input_Set(KEY_LMOUSE, down); break;
case 1: Input_Set(KEY_MMOUSE, 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();