feat: fullscreen mode
This commit is contained in:
@@ -79,6 +79,10 @@ BOOL g_bWidescreen = TRUE;
|
|||||||
int g_iScreenWidth = 1920;
|
int g_iScreenWidth = 1920;
|
||||||
int g_iScreenHeight = 1080;
|
int g_iScreenHeight = 1080;
|
||||||
|
|
||||||
|
// Fullscreen toggle state
|
||||||
|
static bool g_isFullscreen = false;
|
||||||
|
static WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) };
|
||||||
|
|
||||||
void DefineActions(void)
|
void DefineActions(void)
|
||||||
{
|
{
|
||||||
// The app needs to define the actions required, and the possible mappings for these
|
// The app needs to define the actions required, and the possible mappings for these
|
||||||
@@ -641,6 +645,36 @@ void Render()
|
|||||||
g_pSwapChain->Present( 0, 0 );
|
g_pSwapChain->Present( 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// Toggle borderless fullscreen
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
void ToggleFullscreen()
|
||||||
|
{
|
||||||
|
DWORD dwStyle = GetWindowLong(g_hWnd, GWL_STYLE);
|
||||||
|
if (!g_isFullscreen)
|
||||||
|
{
|
||||||
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
|
if (GetWindowPlacement(g_hWnd, &g_wpPrev) &&
|
||||||
|
GetMonitorInfo(MonitorFromWindow(g_hWnd, MONITOR_DEFAULTTOPRIMARY), &mi))
|
||||||
|
{
|
||||||
|
SetWindowLong(g_hWnd, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
|
||||||
|
SetWindowPos(g_hWnd, HWND_TOP,
|
||||||
|
mi.rcMonitor.left, mi.rcMonitor.top,
|
||||||
|
mi.rcMonitor.right - mi.rcMonitor.left,
|
||||||
|
mi.rcMonitor.bottom - mi.rcMonitor.top,
|
||||||
|
SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetWindowLong(g_hWnd, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
|
||||||
|
SetWindowPlacement(g_hWnd, &g_wpPrev);
|
||||||
|
SetWindowPos(g_hWnd, NULL, 0, 0, 0, 0,
|
||||||
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
|
||||||
|
}
|
||||||
|
g_isFullscreen = !g_isFullscreen;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Clean up the objects we've created
|
// Clean up the objects we've created
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -1149,8 +1183,14 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
|||||||
KMInput.SetCapture(true);
|
KMInput.SetCapture(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// F11 toggles fullscreen
|
||||||
|
if (KMInput.IsKeyPressed(VK_F11))
|
||||||
|
{
|
||||||
|
ToggleFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
PIXBeginNamedEvent(0,"Profile load check");
|
|
||||||
// has the game defined profile data been changed (by a profile load)
|
// has the game defined profile data been changed (by a profile load)
|
||||||
if(app.uiGameDefinedDataChangedBitmask!=0)
|
if(app.uiGameDefinedDataChangedBitmask!=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ This project contains the source code of Minecraft Legacy Console Edition v1.3.0
|
|||||||
|
|
||||||
- Fixed compilation and execution in both Debug and Release mode on Windows using Visual Studio 2022
|
- Fixed compilation and execution in both Debug and Release mode on Windows using Visual Studio 2022
|
||||||
- Added support for keyboard and mouse input
|
- Added support for keyboard and mouse input
|
||||||
|
- Added fullscreen mode support (toggle using F11)
|
||||||
|
- Disabled V-Sync for better performance
|
||||||
|
|
||||||
## Build & Run
|
## Build & Run
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user