From b5b2c4d784a9e6bf06feb6a2502985afb3290a88 Mon Sep 17 00:00:00 2001 From: VoxelTek <53562267+VoxelTek@users.noreply.github.com> Date: Tue, 15 Jul 2025 12:26:23 +1000 Subject: [PATCH] Add full screen video mode When full screen is enabled, the game goes full-screen, and the screen resolution changes. --- CONFIG/res/maindialog.ui | 72 ++++++++++++++++++++-------------------- ISLE/isleapp.cpp | 19 +++++++++-- ISLE/isleapp.h | 1 + 3 files changed, 54 insertions(+), 38 deletions(-) diff --git a/CONFIG/res/maindialog.ui b/CONFIG/res/maindialog.ui index fe2563c7..1e42b729 100644 --- a/CONFIG/res/maindialog.ui +++ b/CONFIG/res/maindialog.ui @@ -597,10 +597,45 @@ The game will gradually increase the number of actors until this maximum is reac Display + + + + General + + + + + + fps + + + Max Framerate: + + + 200 + + + 100 + + + + + + + Toggle fullscreen display mode. + + + Fullscreen + + + + + + - Resolution + Windowed Resolution @@ -700,41 +735,6 @@ The game will gradually increase the number of actors until this maximum is reac - - - - Screen - - - - - - fps - - - Max Framerate: - - - 200 - - - 100 - - - - - - - Toggle fullscreen display mode. - - - Fullscreen - - - - - - diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 7e183aab..9455e91d 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -153,7 +153,7 @@ IsleApp::IsleApp() m_videoParam = MxVideoParam(r, NULL, 1, flags); } #else - m_videoParam = MxVideoParam(MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1)), NULL, 1, MxVideoParamFlags()); + m_videoParam = MxVideoParam(MxRect32(0, 0, 639, 479), NULL, 1, MxVideoParamFlags()); #endif m_videoParam.Flags().Set16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); @@ -178,6 +178,7 @@ IsleApp::IsleApp() m_haptic = TRUE; m_xRes = 640; m_yRes = 480; + m_frameRate = 100.0f; } // FUNCTION: ISLE 0x4011a0 @@ -839,6 +840,17 @@ MxResult IsleApp::SetupWindow() #endif window = SDL_CreateWindowWithProperties(props); + + if (m_fullScreen) { + SDL_DisplayMode closestMode; + SDL_DisplayID displayID = SDL_GetDisplayForWindow(window); + bool findModeSuccess = + SDL_GetClosestFullscreenDisplayMode(displayID, m_xRes, m_yRes, m_frameRate, true, &closestMode); + if (findModeSuccess) { + bool setModeSuccess = SDL_SetWindowFullscreenMode(window, &closestMode); + } + } + #ifdef MINIWIN m_windowHandle = reinterpret_cast(window); #else @@ -1092,7 +1104,10 @@ bool IsleApp::LoadConfig() m_haptic = iniparser_getboolean(dict, "isle:Haptic", m_haptic); m_xRes = iniparser_getint(dict, "isle:Horizontal Resolution", m_xRes); m_yRes = iniparser_getint(dict, "isle:Vertical Resolution", m_yRes); - m_videoParam.GetRect() = MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1)); + if (!m_fullScreen) { // 2D elements break otherwise, not sure why + m_videoParam.GetRect() = MxRect32(0, 0, (m_xRes - 1), (m_yRes - 1)); + } + m_frameRate = (1000.0f / iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta)); m_frameDelta = static_cast(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta))); const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL); diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index ab4ccfd5..380ad719 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -110,6 +110,7 @@ class IsleApp { MxBool m_haptic; MxS32 m_xRes; MxS32 m_yRes; + MxFloat m_frameRate; }; extern IsleApp* g_isle;