- [Psy-X] added Alt-Enter to toggle fullscreen mode

This commit is contained in:
Ilya Shurumov 2021-04-06 22:25:39 +06:00
parent 9bb5333d80
commit adf26d0f2e
2 changed files with 22 additions and 3 deletions

View File

@ -7,7 +7,6 @@
#include "LIBGTE.H"
#include "LIBGPU.H"
#include "LIBSPU.H"
#include "STDIO.H"
#include "psyx_compat.h"

View File

@ -563,7 +563,9 @@ void PsyX_Exit();
GameDebugKeysHandlerFunc gameDebugKeys = NULL;
GameDebugMouseHandlerFunc gameDebugMouse = NULL;
GameOnTextInputHandler gameOnTextInput = NULL;
int g_activeKeyboardControllers = 0x1;
int g_altKeyState = 0;
void PsyX_Sys_DoPollEvent()
{
@ -603,6 +605,24 @@ void PsyX_Sys_DoPollEvent()
{
int nKey = event.key.keysym.scancode;
if (nKey == SDL_SCANCODE_LALT || nKey == SDL_SCANCODE_RALT)
{
g_altKeyState = (event.type == SDL_KEYDOWN);
}
else if (nKey == SDL_SCANCODE_RETURN)
{
if (g_altKeyState && event.type == SDL_KEYDOWN)
{
bool IsFullscreen = SDL_GetWindowFlags(g_window) & SDL_WINDOW_FULLSCREEN;
SDL_SetWindowFullscreen(g_window, IsFullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_GetWindowSize(g_window, &g_windowWidth, &g_windowHeight);
GR_ResetDevice();
}
break;
}
// lshift/right shift
if (nKey == SDL_SCANCODE_RSHIFT)
nKey = SDL_SCANCODE_LSHIFT;
@ -767,7 +787,6 @@ void PsyX_Sys_DoDebugKeys(int nKey, bool down)
case SDL_SCANCODE_F6:
g_pgxpZBuffer ^= 1;
break;
}
}
}
@ -777,7 +796,8 @@ void PsyX_UpdateInput()
// also poll events here
PsyX_Sys_DoPollEvent();
PsyX_Pad_InternalPadUpdates();
if(!g_altKeyState)
PsyX_Pad_InternalPadUpdates();
}
uint PsyX_CalcFPS()