Add full screen video mode

When full screen is enabled, the game goes full-screen, and the screen resolution changes.
This commit is contained in:
VoxelTek 2025-07-15 12:26:23 +10:00
parent 41a95aa62e
commit b5b2c4d784
3 changed files with 54 additions and 38 deletions

View File

@ -597,10 +597,45 @@ The game will gradually increase the number of actors until this maximum is reac
<string>Display</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QGroupBox" name="screenSettingsBox">
<property name="title">
<string>General</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QSpinBox" name="framerateSpinBox">
<property name="suffix">
<string>fps</string>
</property>
<property name="prefix">
<string>Max Framerate: </string>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="fullscreenCheckBox">
<property name="toolTip">
<string>Toggle fullscreen display mode.</string>
</property>
<property name="text">
<string>Fullscreen</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="resolutionBox">
<property name="title">
<string>Resolution</string>
<string>Windowed Resolution</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
@ -700,41 +735,6 @@ The game will gradually increase the number of actors until this maximum is reac
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="screenSettingsBox">
<property name="title">
<string>Screen</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QSpinBox" name="framerateSpinBox">
<property name="suffix">
<string>fps</string>
</property>
<property name="prefix">
<string>Max Framerate: </string>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="fullscreenCheckBox">
<property name="toolTip">
<string>Toggle fullscreen display mode.</string>
</property>
<property name="text">
<string>Fullscreen</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">

View File

@ -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<HWND>(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<int>(std::round(iniparser_getdouble(dict, "isle:Frame Delta", m_frameDelta)));
const char* deviceId = iniparser_getstring(dict, "isle:3D Device ID", NULL);

View File

@ -110,6 +110,7 @@ class IsleApp {
MxBool m_haptic;
MxS32 m_xRes;
MxS32 m_yRes;
MxFloat m_frameRate;
};
extern IsleApp* g_isle;