From 4e0aaaa620aade1daa8580011f83783d1b576056 Mon Sep 17 00:00:00 2001 From: luciusDXL Date: Sun, 2 Jan 2022 13:33:06 -0800 Subject: [PATCH 1/4] * Fixes mouse speed in 2D in-game menus when using high resolution monitors (> 1080p). * Added System UI scaling based on monitor resolution, to make the System UI usable when using > 1080p resolutions. --- .../TFE_DarkForces/GameUI/escapeMenu.cpp | 8 + TheForceEngine/TFE_DarkForces/GameUI/menu.cpp | 10 +- TheForceEngine/TFE_FrontEndUI/console.cpp | 14 +- TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp | 198 ++++++++---------- .../Win32OpenGL/renderBackend.cpp | 25 ++- .../TFE_RenderBackend/renderBackend.h | 1 + 6 files changed, 138 insertions(+), 118 deletions(-) diff --git a/TheForceEngine/TFE_DarkForces/GameUI/escapeMenu.cpp b/TheForceEngine/TFE_DarkForces/GameUI/escapeMenu.cpp index f3cdd07c7..d3a617974 100644 --- a/TheForceEngine/TFE_DarkForces/GameUI/escapeMenu.cpp +++ b/TheForceEngine/TFE_DarkForces/GameUI/escapeMenu.cpp @@ -318,6 +318,14 @@ namespace TFE_DarkForces s32 dx, dy; TFE_Input::getAccumulatedMouseMove(&dx, &dy); + MonitorInfo monitorInfo; + TFE_RenderBackend::getCurrentMonitorInfo(&monitorInfo); + + // Scale the mouse delta based on monitor resolution. + s32 uiScale = max(100, 100 * monitorInfo.h / 1080); + dx = (dx * uiScale) / 100; + dy = (dy * uiScale) / 100; + s_cursorPosAccum.x = clamp(s_cursorPosAccum.x + dx, 0, displayInfo.width); s_cursorPosAccum.z = clamp(s_cursorPosAccum.z + dy, 0, displayInfo.height); if (displayInfo.width >= displayInfo.height) diff --git a/TheForceEngine/TFE_DarkForces/GameUI/menu.cpp b/TheForceEngine/TFE_DarkForces/GameUI/menu.cpp index 6fd0b455f..049a701bf 100644 --- a/TheForceEngine/TFE_DarkForces/GameUI/menu.cpp +++ b/TheForceEngine/TFE_DarkForces/GameUI/menu.cpp @@ -66,14 +66,22 @@ namespace TFE_DarkForces DisplayInfo displayInfo; TFE_RenderBackend::getDisplayInfo(&displayInfo); + MonitorInfo monitorInfo; + TFE_RenderBackend::getCurrentMonitorInfo(&monitorInfo); + LRect bounds; lcanvas_getBounds(&bounds); - s32 width = bounds.right - bounds.left; + s32 width = bounds.right - bounds.left; s32 height = bounds.bottom - bounds.top; s32 dx, dy; TFE_Input::getAccumulatedMouseMove(&dx, &dy); + // Scale the mouse delta based on monitor resolution. + s32 uiScale = max(100, 100 * monitorInfo.h / 1080); + dx = (dx * uiScale) / 100; + dy = (dy * uiScale) / 100; + s_cursorPosAccum.x = clamp(s_cursorPosAccum.x + dx, 0, displayInfo.width); s_cursorPosAccum.z = clamp(s_cursorPosAccum.z + dy, 0, displayInfo.height); if (displayInfo.width >= displayInfo.height) diff --git a/TheForceEngine/TFE_FrontEndUI/console.cpp b/TheForceEngine/TFE_FrontEndUI/console.cpp index 491fcae08..08347fbae 100644 --- a/TheForceEngine/TFE_FrontEndUI/console.cpp +++ b/TheForceEngine/TFE_FrontEndUI/console.cpp @@ -34,6 +34,7 @@ namespace TFE_Console static ImFont* s_consoleFont; static f32 s_height; static f32 s_anim; + static s32 s_fontSize; static s32 s_historyIndex; static s32 s_historyScroll; @@ -55,8 +56,11 @@ namespace TFE_Console bool init() { + s32 scale = TFE_Ui::getUiScale(); + s_fontSize = (scale * 20) / 100; + ImGuiIO& io = ImGui::GetIO(); - s_consoleFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", 20); + s_consoleFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", s_fontSize); s_height = 0.0f; s_anim = 0.0f; s_historyIndex = -1; @@ -561,12 +565,12 @@ namespace TFE_Console } const s32 count = (s32)s_history.size(); - const s32 elementsPerPage = ((s32)consoleHeight - 36) / 20; + const s32 elementsPerPage = ((s32)consoleHeight - 16 - s_fontSize) / s_fontSize; s_historyScroll = std::max(0, std::min(s_historyScroll, count - elementsPerPage)); s32 start = count - 1 - s_historyScroll; - s32 y = (s32)consoleHeight - 56; - for (s32 i = start; i >= 0 && y > -20; i--, y -= 20) + s32 y = (s32)consoleHeight - 16 - 2*s_fontSize; + for (s32 i = start; i >= 0 && y > -s_fontSize; i--, y -= s_fontSize) { ImGui::SetCursorPosY(f32(y)); ImGui::TextColored(ImVec4(s_history[i].color.x, s_history[i].color.y, s_history[i].color.z, s_history[i].color.w), s_history[i].text.c_str()); @@ -574,7 +578,7 @@ namespace TFE_Console ImGui::SetKeyboardFocusHere(); ImGui::SetNextItemWidth(f32(w - 16)); - ImGui::SetCursorPosY(consoleHeight - 32.0f); + ImGui::SetCursorPosY(consoleHeight - 12.0f - s_fontSize); u32 flags = ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_NoHorizontalScroll | ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory; // Make sure the key to close the console doesn't make its was into the command line. diff --git a/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp b/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp index 3602a2bd2..347875d08 100644 --- a/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp +++ b/TheForceEngine/TFE_FrontEndUI/frontEndUi.cpp @@ -134,6 +134,7 @@ namespace TFE_FrontEndUI static s32 s_resIndex = 0; static s32 s_rendererIndex = 0; + static f32 s_uiScale = 1.0f; static char* s_aboutDisplayStr = nullptr; static char* s_manualDisplayStr = nullptr; static char* s_creditsDisplayStr = nullptr; @@ -210,11 +211,13 @@ namespace TFE_FrontEndUI s_subUI = FEUI_NONE; s_relativeMode = false; + s_uiScale = (f32)TFE_Ui::getUiScale() * 0.01f; + ImGuiIO& io = ImGui::GetIO(); - s_menuFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", 32); - s_versionFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", 16); - s_titleFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", 48); - s_dialogFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", 20); + s_menuFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", floorf(32*s_uiScale + 0.5f)); + s_versionFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", floorf(16*s_uiScale + 0.5f)); + s_titleFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", floorf(48*s_uiScale + 0.5f)); + s_dialogFont = io.Fonts->AddFontFromFileTTF("Fonts/DroidSansMono.ttf", floorf(20*s_uiScale + 0.5f)); if (!loadGpuImage("UI_Images/TFE_TitleLogo.png", &s_logoGpuImage)) { @@ -437,42 +440,15 @@ namespace TFE_FrontEndUI ImGui::PushFont(s_versionFont); char versionText[256]; sprintf(versionText, "Version %s", TFE_System::getVersionString()); - const f32 stringWidth = s_versionFont->CalcTextSizeA(16.0f, 1024.0f, 0.0f, versionText).x; + const f32 stringWidth = s_versionFont->CalcTextSizeA(s_versionFont->FontSize, 1024.0f, 0.0f, versionText).x; - ImGui::SetNextWindowPos(ImVec2(f32(w) - stringWidth - 32.0f, f32(h) - 64.0f)); + ImGui::SetNextWindowPos(ImVec2(f32(w) - stringWidth - s_versionFont->FontSize*2.0f, f32(h) - s_versionFont->FontSize*4.0f)); ImGui::Begin("##Version", &titleActive, windowInvisFlags); ImGui::Text(versionText); ImGui::End(); ImGui::PopFont(); s32 menuHeight = (textHeight + 24) * 7 + 4; - // Warning Text - Note this is temporary and will be removed once things have settled. - { - f32 warningWidth; - s32 yOffset; - if (h > 700) - { - yOffset = 96; - ImGui::PushFont(s_menuFont); - warningWidth = s_menuFont->CalcTextSizeA(32.0f, 1024.0f, 0.0f, "Expect Bugs and Missing Features").x; - } - else - { - yOffset = 32; - warningWidth = ImGui::GetFont()->CalcTextSizeA(16.0f, 1024.0f, 0.0f, "Expect Bugs and Missing Features").x; - } - - ImGui::SetNextWindowPos(ImVec2(f32((w - warningWidth) / 2), f32(h - menuHeight - topOffset - yOffset))); - ImGui::Begin("##Warning", &titleActive, windowInvisFlags); - ImGui::Text(" Pre-Release Test Build -"); - ImGui::Text("Expect Bugs and Missing Features"); - ImGui::End(); - - if (h > 700) - { - ImGui::PopFont(); - } - } // Main Menu ImGui::PushFont(s_menuFont); @@ -559,10 +535,10 @@ namespace TFE_FrontEndUI TFE_Input::clearAccumulatedMouseMove(); ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f)); - ImGui::SetNextWindowSize(ImVec2(160.0f, f32(h))); + ImGui::SetNextWindowSize(ImVec2(160.0f*s_uiScale, f32(h))); ImGui::Begin("##Sidebar", &active, window_flags); - ImVec2 sideBarButtonSize(144, 24); + ImVec2 sideBarButtonSize(144*s_uiScale, 24*s_uiScale); ImGui::PushFont(s_dialogFont); if (ImGui::Button("About", sideBarButtonSize)) { @@ -624,13 +600,13 @@ namespace TFE_FrontEndUI ImGui::End(); // adjust the width based on tab. - s32 tabWidth = w - 160; + s32 tabWidth = w - 160*s_uiScale; if (s_configTab >= CONFIG_INPUT) { - tabWidth = 414; + tabWidth = 414*s_uiScale; } - ImGui::SetNextWindowPos(ImVec2(160.0f, 0.0f)); + ImGui::SetNextWindowPos(ImVec2(160.0f*s_uiScale, 0.0f)); ImGui::SetNextWindowSize(ImVec2(f32(tabWidth), f32(h))); ImGui::SetNextWindowBgAlpha(0.95f); ImGui::Begin("##Settings", &active, window_flags); @@ -754,14 +730,14 @@ namespace TFE_FrontEndUI ImGui::LabelText("##ConfigLabel", "Game Source Data"); ImGui::PopFont(); - ImGui::Text("Dark Forces:"); ImGui::SameLine(100); + ImGui::Text("Dark Forces:"); ImGui::SameLine(100*s_uiScale); ImGui::InputText("##DarkForcesSource", darkForces->sourcePath, 1024); ImGui::SameLine(); if (ImGui::Button("Browse##DarkForces")) { browseWinOpen = 0; } - ImGui::Text("Outlaws:"); ImGui::SameLine(100); + ImGui::Text("Outlaws:"); ImGui::SameLine(100*s_uiScale); ImGui::InputText("##OutlawsSource", outlaws->sourcePath, 1024); ImGui::SameLine(); if (ImGui::Button("Browse##Outlaws")) { @@ -910,7 +886,7 @@ namespace TFE_FrontEndUI char inputName1[256] = "##Input1"; char inputName2[256] = "##Input2"; - ImGui::LabelText("##ConfigLabel", name); ImGui::SameLine(132); + ImGui::LabelText("##ConfigLabel", name); ImGui::SameLine(132*s_uiScale); if (count >= 1) { InputBinding* binding = inputMapping_getBindindByIndex(indices[0]); @@ -935,7 +911,7 @@ namespace TFE_FrontEndUI strcat(inputName2, name); } - if (ImGui::Button(inputName1, ImVec2(120.0f, 0.0f))) + if (ImGui::Button(inputName1, ImVec2(120.0f*s_uiScale, 0.0f))) { // Press Key Popup. s_keyIndex = s32(action); @@ -944,7 +920,7 @@ namespace TFE_FrontEndUI ImGui::OpenPopup("##ChangeBinding"); } ImGui::SameLine(); - if (ImGui::Button(inputName2, ImVec2(120.0f, 0.0f))) + if (ImGui::Button(inputName2, ImVec2(120.0f*s_uiScale, 0.0f))) { // Press Key Popup. s_keyIndex = s32(action); @@ -967,19 +943,19 @@ namespace TFE_FrontEndUI s_inputConfig = inputMapping_get(); - ImGui::SetNextWindowPos(ImVec2(165.0f, yNext - scroll)); + ImGui::SetNextWindowPos(ImVec2(165.0f*s_uiScale, yNext - scroll)); if (ImGui::Button("Reset To Defaults")) { inputMapping_resetToDefaults(); } - yNext += 32.0f; + yNext += 32.0f*s_uiScale; - ImGui::SetNextWindowPos(ImVec2(165.0f, yNext - scroll)); + ImGui::SetNextWindowPos(ImVec2(165.0f*s_uiScale, yNext - scroll)); ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 0.0f, 0.0f }); - if (ImGui::BeginChild("Controller Options", ImVec2(390.0f, s_controllerWinOpen ? 400.0f : 29.0f), true, window_flags)) + if (ImGui::BeginChild("Controller Options", ImVec2(390.0f*s_uiScale, (s_controllerWinOpen ? 400.0f : 29.0f)*s_uiScale), true, window_flags)) { - if (ImGui::Button("Controller Options", ImVec2(370.0f, 0.0f))) + if (ImGui::Button("Controller Options", ImVec2(370.0f*s_uiScale, 0.0f))) { s_controllerWinOpen = !s_controllerWinOpen; } @@ -999,20 +975,20 @@ namespace TFE_FrontEndUI ImGui::LabelText("##ConfigLabel", "Controller Axis"); ImGui::PopFont(); - ImGui::LabelText("##ConfigLabel", "Horizontal Turn"); ImGui::SameLine(175); - ImGui::SetNextItemWidth(196); + ImGui::LabelText("##ConfigLabel", "Horizontal Turn"); ImGui::SameLine(175*s_uiScale); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##CtrlLookHorz", (s32*)&s_inputConfig->axis[AA_LOOK_HORZ], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); - ImGui::LabelText("##ConfigLabel", "Vertical Look"); ImGui::SameLine(175); - ImGui::SetNextItemWidth(196); + ImGui::LabelText("##ConfigLabel", "Vertical Look"); ImGui::SameLine(175*s_uiScale); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##CtrlLookVert", (s32*)&s_inputConfig->axis[AA_LOOK_VERT], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); - ImGui::LabelText("##ConfigLabel", "Move"); ImGui::SameLine(175); - ImGui::SetNextItemWidth(196); + ImGui::LabelText("##ConfigLabel", "Move"); ImGui::SameLine(175*s_uiScale); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##CtrlStrafe", (s32*)&s_inputConfig->axis[AA_STRAFE], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); - ImGui::LabelText("##ConfigLabel", "Strafe"); ImGui::SameLine(175); - ImGui::SetNextItemWidth(196); + ImGui::LabelText("##ConfigLabel", "Strafe"); ImGui::SameLine(175*s_uiScale); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##CtrlMove", (s32*)&s_inputConfig->axis[AA_MOVE], c_axisBinding, IM_ARRAYSIZE(c_axisBinding)); ImGui::Separator(); @@ -1022,15 +998,15 @@ namespace TFE_FrontEndUI ImGui::PopFont(); ImGui::LabelText("##ConfigLabel", "Left Stick"); - ImGui::SetNextItemWidth(196); - ImGui::SliderFloat("##LeftSensitivity", &s_inputConfig->ctrlSensitivity[0], 0.0f, 4.0f); ImGui::SameLine(220); - ImGui::SetNextItemWidth(64); + ImGui::SetNextItemWidth(196*s_uiScale); + ImGui::SliderFloat("##LeftSensitivity", &s_inputConfig->ctrlSensitivity[0], 0.0f, 4.0f); ImGui::SameLine(220*s_uiScale); + ImGui::SetNextItemWidth(64*s_uiScale); ImGui::InputFloat("##LeftSensitivityInput", &s_inputConfig->ctrlSensitivity[0]); ImGui::LabelText("##ConfigLabel", "Right Stick"); - ImGui::SetNextItemWidth(196); - ImGui::SliderFloat("##RightSensitivity", &s_inputConfig->ctrlSensitivity[1], 0.0f, 4.0f); ImGui::SameLine(220); - ImGui::SetNextItemWidth(64); + ImGui::SetNextItemWidth(196*s_uiScale); + ImGui::SliderFloat("##RightSensitivity", &s_inputConfig->ctrlSensitivity[1], 0.0f, 4.0f); ImGui::SameLine(220*s_uiScale); + ImGui::SetNextItemWidth(64*s_uiScale); ImGui::InputFloat("##RightSensitivityInput", &s_inputConfig->ctrlSensitivity[1]); ImGui::Separator(); @@ -1041,7 +1017,7 @@ namespace TFE_FrontEndUI bool invertLeftHorz = (s_inputConfig->controllerFlags & CFLAG_INVERT_LEFT_HORZ) != 0; bool invertLeftVert = (s_inputConfig->controllerFlags & CFLAG_INVERT_LEFT_VERT) != 0; - ImGui::LabelText("##ConfigLabel", "Left Stick Invert: "); ImGui::SameLine(175); + ImGui::LabelText("##ConfigLabel", "Left Stick Invert: "); ImGui::SameLine(175*s_uiScale); ImGui::Checkbox("Horizontal##Left", &invertLeftHorz); ImGui::SameLine(); ImGui::Checkbox("Vertical##Left", &invertLeftVert); if (invertLeftHorz) { s_inputConfig->controllerFlags |= CFLAG_INVERT_LEFT_HORZ; } @@ -1051,7 +1027,7 @@ namespace TFE_FrontEndUI bool invertRightHorz = (s_inputConfig->controllerFlags & CFLAG_INVERT_RIGHT_HORZ) != 0; bool invertRightVert = (s_inputConfig->controllerFlags & CFLAG_INVERT_RIGHT_VERT) != 0; - ImGui::LabelText("##ConfigLabel", "Right Stick Invert: "); ImGui::SameLine(175); + ImGui::LabelText("##ConfigLabel", "Right Stick Invert: "); ImGui::SameLine(175*s_uiScale); ImGui::Checkbox("Horizontal##Right", &invertRightHorz); ImGui::SameLine(); ImGui::Checkbox("Vertical##Right", &invertRightVert); if (invertRightHorz) { s_inputConfig->controllerFlags |= CFLAG_INVERT_RIGHT_HORZ; } @@ -1059,25 +1035,25 @@ namespace TFE_FrontEndUI if (invertRightVert) { s_inputConfig->controllerFlags |= CFLAG_INVERT_RIGHT_VERT; } else { s_inputConfig->controllerFlags &= ~CFLAG_INVERT_RIGHT_VERT; } - yNext += 400.0f; + yNext += 400.0f*s_uiScale; } else { - yNext += 29.0f; + yNext += 29.0f*s_uiScale; } } else { - yNext += s_controllerWinOpen ? 400.0f : 29.0f; + yNext += (s_controllerWinOpen ? 400.0f : 29.0f)*s_uiScale; ImGui::PopStyleVar(); } ImGui::EndChild(); - ImGui::SetNextWindowPos(ImVec2(165.0f, yNext - scroll)); + ImGui::SetNextWindowPos(ImVec2(165.0f*s_uiScale, yNext - scroll)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 0.0f, 0.0f }); - if (ImGui::BeginChild("##Mouse Options", ImVec2(390.0f, s_mouseWinOpen ? 250.0f : 29.0f), true, window_flags)) + if (ImGui::BeginChild("##Mouse Options", ImVec2(390.0f*s_uiScale, (s_mouseWinOpen ? 250.0f : 29.0f)*s_uiScale), true, window_flags)) { - if (ImGui::Button("Mouse Options", ImVec2(370.0f, 0.0f))) + if (ImGui::Button("Mouse Options", ImVec2(370.0f*s_uiScale, 0.0f))) { s_mouseWinOpen = !s_mouseWinOpen; } @@ -1087,8 +1063,8 @@ namespace TFE_FrontEndUI { ImGui::Spacing(); - ImGui::LabelText("##ConfigLabel", "Mouse Mode"); ImGui::SameLine(100); - ImGui::SetNextItemWidth(160); + ImGui::LabelText("##ConfigLabel", "Mouse Mode"); ImGui::SameLine(100*s_uiScale); + ImGui::SetNextItemWidth(160*s_uiScale); ImGui::Combo("##MouseMode", (s32*)&s_inputConfig->mouseMode, c_mouseMode, IM_ARRAYSIZE(c_mouseMode)); ImGui::Separator(); @@ -1098,15 +1074,15 @@ namespace TFE_FrontEndUI ImGui::PopFont(); ImGui::LabelText("##ConfigLabel", "Horizontal"); - ImGui::SetNextItemWidth(196); - ImGui::SliderFloat("##HorzSensitivity", &s_inputConfig->mouseSensitivity[0], 0.0f, 4.0f); ImGui::SameLine(220); - ImGui::SetNextItemWidth(64); + ImGui::SetNextItemWidth(196*s_uiScale); + ImGui::SliderFloat("##HorzSensitivity", &s_inputConfig->mouseSensitivity[0], 0.0f, 4.0f); ImGui::SameLine(220*s_uiScale); + ImGui::SetNextItemWidth(64*s_uiScale); ImGui::InputFloat("##HorzSensitivityInput", &s_inputConfig->mouseSensitivity[0]); ImGui::LabelText("##ConfigLabel", "Vertical"); - ImGui::SetNextItemWidth(196); - ImGui::SliderFloat("##VertSensitivity", &s_inputConfig->mouseSensitivity[1], 0.0f, 4.0f); ImGui::SameLine(220); - ImGui::SetNextItemWidth(64); + ImGui::SetNextItemWidth(196*s_uiScale); + ImGui::SliderFloat("##VertSensitivity", &s_inputConfig->mouseSensitivity[1], 0.0f, 4.0f); ImGui::SameLine(220*s_uiScale); + ImGui::SetNextItemWidth(64*s_uiScale); ImGui::InputFloat("##VertSensitivityInput", &s_inputConfig->mouseSensitivity[1]); ImGui::Separator(); @@ -1124,25 +1100,25 @@ namespace TFE_FrontEndUI if (invertVert) { s_inputConfig->mouseFlags |= MFLAG_INVERT_VERT; } else { s_inputConfig->mouseFlags &= ~MFLAG_INVERT_VERT; } - yNext += 250.0f; + yNext += 250.0f*s_uiScale; } else { - yNext += 29.0f; + yNext += 29.0f*s_uiScale; } } else { - yNext += s_controllerWinOpen ? 250.0f : 29.0f; + yNext += (s_controllerWinOpen ? 250.0f : 29.0f)*s_uiScale; ImGui::PopStyleVar(); } ImGui::End(); - ImGui::SetNextWindowPos(ImVec2(165.0f, yNext - scroll)); + ImGui::SetNextWindowPos(ImVec2(165.0f*s_uiScale, yNext - scroll)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 0.0f, 0.0f }); - f32 inputMappingHeight = 1376.0f; - if (ImGui::BeginChild("##Input Mapping", ImVec2(390.0f, s_inputMappingOpen ? inputMappingHeight : 29.0f), true, window_flags)) + f32 inputMappingHeight = 1376.0f*s_uiScale; + if (ImGui::BeginChild("##Input Mapping", ImVec2(390.0f*s_uiScale, s_inputMappingOpen ? inputMappingHeight : 29.0f*s_uiScale), true, window_flags)) { - if (ImGui::Button("Input Mapping", ImVec2(370.0f, 0.0f))) + if (ImGui::Button("Input Mapping", ImVec2(370.0f*s_uiScale, 0.0f))) { s_inputMappingOpen = !s_inputMappingOpen; } @@ -1314,7 +1290,7 @@ namespace TFE_FrontEndUI } ImGui::End(); ImGui::PopStyleVar(); - ImGui::SetCursorPosY(yNext + (s_inputMappingOpen ? inputMappingHeight : 29.0f)); + ImGui::SetCursorPosY(yNext + (s_inputMappingOpen ? inputMappingHeight : 29.0f*s_uiScale)); } void configGraphics() @@ -1361,7 +1337,7 @@ namespace TFE_FrontEndUI ImGui::LabelText("##ConfigLabel", "Virtual Resolution"); ImGui::PopFont(); - ImGui::LabelText("##ConfigLabel", "Standard Resolution:"); ImGui::SameLine(150); + ImGui::LabelText("##ConfigLabel", "Standard Resolution:"); ImGui::SameLine(150*s_uiScale); ImGui::SetNextItemWidth(196); ImGui::Combo("##Resolution", &s_resIndex, widescreen ? c_resolutionsWide : c_resolutions, IM_ARRAYSIZE(c_resolutions)); if (s_resIndex == TFE_ARRAYSIZE(c_resolutionDim)) @@ -1374,7 +1350,7 @@ namespace TFE_FrontEndUI } else if (s_resIndex == TFE_ARRAYSIZE(c_resolutionDim) + 1) { - ImGui::LabelText("##ConfigLabel", "Custom:"); ImGui::SameLine(100); + ImGui::LabelText("##ConfigLabel", "Custom:"); ImGui::SameLine(100*s_uiScale); ImGui::SetNextItemWidth(196); ImGui::InputInt2("##CustomInput", graphics->gameResolution.m); @@ -1400,8 +1376,8 @@ namespace TFE_FrontEndUI ImGui::LabelText("##ConfigLabel", "Rendering"); ImGui::PopFont(); - ImGui::LabelText("##ConfigLabel", "Renderer:"); ImGui::SameLine(75); - ImGui::SetNextItemWidth(196); + ImGui::LabelText("##ConfigLabel", "Renderer:"); ImGui::SameLine(75*s_uiScale); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##Renderer", &s_rendererIndex, c_renderer, IM_ARRAYSIZE(c_renderer)); if (s_rendererIndex == 0) { @@ -1432,11 +1408,11 @@ namespace TFE_FrontEndUI static s32 s_msaa = 3; static f32 s_filterSharpness = 0.8f; - const s32 comboOffset = 170; + const s32 comboOffset = 170*s_uiScale; // Hardware ImGui::LabelText("##ConfigLabel", "Color Depth"); ImGui::SameLine(comboOffset); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); if (ImGui::Combo("##ColorDepth", &s_colorDepth, c_colorDepth, IM_ARRAYSIZE(c_colorDepth))) { if (s_colorDepth == 0) { s_nearTexFilter = 0; s_farTexFilter = 0; } @@ -1446,31 +1422,31 @@ namespace TFE_FrontEndUI if (s_colorDepth == 1) { ImGui::LabelText("##ConfigLabel", "Colormap Interpolation"); ImGui::SameLine(comboOffset); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##ColormapInterp", &s_colormapInterp, c_colormap_interp, IM_ARRAYSIZE(c_colormap_interp)); } ImGui::LabelText("##ConfigLabel", "3D Polygon Sorting"); ImGui::SameLine(comboOffset); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##3DSort", &s_objectSort, c_3d_object_sort, IM_ARRAYSIZE(c_3d_object_sort)); ImGui::LabelText("##ConfigLabel", "Texture Filter Near"); ImGui::SameLine(comboOffset); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##TexFilterNear", &s_nearTexFilter, c_near_tex_filter, IM_ARRAYSIZE(c_near_tex_filter)); if (s_nearTexFilter == 2) { - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Sharpness", &s_filterSharpness, 0.0f, 1.0f); ImGui::Spacing(); } ImGui::LabelText("##ConfigLabel", "Texture Filter Far"); ImGui::SameLine(comboOffset); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##TexFilterFar", &s_farTexFilter, c_far_tex_filter, IM_ARRAYSIZE(c_far_tex_filter)); ImGui::LabelText("##ConfigLabel", "Anti-aliasing"); ImGui::SameLine(comboOffset); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##MSAA", &s_msaa, c_aa, IM_ARRAYSIZE(c_aa)); } ImGui::Separator(); @@ -1485,16 +1461,16 @@ namespace TFE_FrontEndUI ImGui::Checkbox("Enable", &graphics->colorCorrection); if (graphics->colorCorrection) { - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Brightness", &graphics->brightness, 0.0f, 2.0f); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Contrast", &graphics->contrast, 0.0f, 2.0f); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Saturation", &graphics->saturation, 0.0f, 2.0f); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Gamma", &graphics->gamma, 0.0f, 2.0f); } else @@ -1526,9 +1502,9 @@ namespace TFE_FrontEndUI ImGui::TextColored({ 1.0f, 1.0f, 1.0f, 0.33f }, "Bloom [TODO]"); if (s_bloom) { - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Softness", &s_bloomSoftness, 0.0f, 1.0f); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Intensity", &s_bloomIntensity, 0.0f, 1.0f); } @@ -1543,23 +1519,23 @@ namespace TFE_FrontEndUI TFE_Settings_Hud* hud = TFE_Settings::getHudSettings(); TFE_Settings_Window* window = TFE_Settings::getWindowSettings(); - ImGui::LabelText("##ConfigLabel", "Hud Scale Type:"); ImGui::SameLine(150); - ImGui::SetNextItemWidth(196); + ImGui::LabelText("##ConfigLabel", "Hud Scale Type:"); ImGui::SameLine(150*s_uiScale); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##HudScaleType", (s32*)&hud->hudScale, c_tfeHudScaleStrings, IM_ARRAYSIZE(c_tfeHudScaleStrings)); - ImGui::LabelText("##ConfigLabel", "Hud Position Type:"); ImGui::SameLine(150); - ImGui::SetNextItemWidth(196); + ImGui::LabelText("##ConfigLabel", "Hud Position Type:"); ImGui::SameLine(150*s_uiScale); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::Combo("##HudPosType", (s32*)&hud->hudPos, c_tfeHudPosStrings, IM_ARRAYSIZE(c_tfeHudPosStrings)); ImGui::Separator(); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderFloat("Scale", &hud->scale, 0.0f, 15.0f, "%.2f"); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderInt("Offset X", &hud->pixelOffset[0], -512, 512); - ImGui::SetNextItemWidth(196); + ImGui::SetNextItemWidth(196*s_uiScale); ImGui::SliderInt("Offset Y", &hud->pixelOffset[1], -512, 512); if (s_menuRetState != APP_STATE_MENU) diff --git a/TheForceEngine/TFE_RenderBackend/Win32OpenGL/renderBackend.cpp b/TheForceEngine/TFE_RenderBackend/Win32OpenGL/renderBackend.cpp index 80afcb592..e71d76f26 100644 --- a/TheForceEngine/TFE_RenderBackend/Win32OpenGL/renderBackend.cpp +++ b/TheForceEngine/TFE_RenderBackend/Win32OpenGL/renderBackend.cpp @@ -101,8 +101,20 @@ namespace TFE_RenderBackend OpenGL_Caps::queryCapabilities(); TFE_System::logWrite(LOG_MSG, "RenderBackend", "OpenGL Device Tier: %d", OpenGL_Caps::getDeviceTier()); - TFE_Ui::init(window, context, 100); + MonitorInfo monitorInfo; + getDisplayMonitorInfo(displayIndex, &monitorInfo); + // High resolution displays (> 1080p) tend to be very high density, so increase the scale somewhat. + s32 uiScale = 100; + if (monitorInfo.h >= 2160) // 4k+ + { + uiScale = 125 * monitorInfo.h / 1080; // scale based on 1080p being the base. + } + else if (monitorInfo.h >= 1440) // 1440p + { + uiScale = 150; + } + TFE_Ui::init(window, context, uiScale); return window; } @@ -309,6 +321,17 @@ namespace TFE_RenderBackend return 0.0f; } + void getCurrentMonitorInfo(MonitorInfo* monitorInfo) + { + TFE_Settings_Window* windowSettings = TFE_Settings::getWindowSettings(); + + s32 x = windowSettings->x, y = windowSettings->y; + s32 displayIndex = getDisplayIndex(x, y); + assert(displayIndex >= 0); + + getDisplayMonitorInfo(displayIndex, monitorInfo); + } + void enableFullscreen(bool enable) { TFE_Settings_Window* windowSettings = TFE_Settings::getWindowSettings(); diff --git a/TheForceEngine/TFE_RenderBackend/renderBackend.h b/TheForceEngine/TFE_RenderBackend/renderBackend.h index c43faf0c9..dfef74ce2 100644 --- a/TheForceEngine/TFE_RenderBackend/renderBackend.h +++ b/TheForceEngine/TFE_RenderBackend/renderBackend.h @@ -105,6 +105,7 @@ namespace TFE_RenderBackend s32 getDisplayIndex(s32 x, s32 y); bool getDisplayMonitorInfo(s32 displayIndex, MonitorInfo* monitorInfo); f32 getDisplayRefreshRate(); + void getCurrentMonitorInfo(MonitorInfo* monitorInfo); void enableFullscreen(bool enable); void clearWindow(); From 5298819563be0cebe6e11fb61632bef59464c694 Mon Sep 17 00:00:00 2001 From: luciusDXL Date: Sun, 2 Jan 2022 16:11:30 -0800 Subject: [PATCH 2/4] Mod Loader now supports ui scale. Mod loading posters are now bilinear filtered (improves visual quality at higher ui scales). --- .../TFE_FrontEndUI/editorTexture.cpp | 4 +- TheForceEngine/TFE_FrontEndUI/editorTexture.h | 2 +- TheForceEngine/TFE_FrontEndUI/modLoader.cpp | 88 ++++++++++--------- 3 files changed, 51 insertions(+), 43 deletions(-) diff --git a/TheForceEngine/TFE_FrontEndUI/editorTexture.cpp b/TheForceEngine/TFE_FrontEndUI/editorTexture.cpp index b2aa1085c..28dcdd000 100644 --- a/TheForceEngine/TFE_FrontEndUI/editorTexture.cpp +++ b/TheForceEngine/TFE_FrontEndUI/editorTexture.cpp @@ -42,7 +42,7 @@ namespace TFE_FrontEndUI } } - bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex) + bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex, MagFilter filter) { if (!src || !tex) { return false; } tex->scale = { 1.0f, 1.0f }; @@ -51,7 +51,7 @@ namespace TFE_FrontEndUI u32* image = s_imageBuffer.data(); convertDfTextureToTrueColor(src, palette, image); - tex->texture = TFE_RenderBackend::createTexture(src->width, src->height, image); + tex->texture = TFE_RenderBackend::createTexture(src->width, src->height, image, filter); tex->scale.x = 1.0f; tex->scale.z = 1.0f; diff --git a/TheForceEngine/TFE_FrontEndUI/editorTexture.h b/TheForceEngine/TFE_FrontEndUI/editorTexture.h index 7c35a87d1..0b2ba1b7a 100644 --- a/TheForceEngine/TFE_FrontEndUI/editorTexture.h +++ b/TheForceEngine/TFE_FrontEndUI/editorTexture.h @@ -24,5 +24,5 @@ namespace TFE_FrontEndUI { bool convertPalette(const u8* srcPalette, u32* dstPalette); void convertDfTextureToTrueColor(const TextureData* src, const u32* palette, u32* image); - bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex); + bool createTexture(const TextureData* src, const u32* palette, EditorTexture* tex, MagFilter filter = MAG_FILTER_NONE); } \ No newline at end of file diff --git a/TheForceEngine/TFE_FrontEndUI/modLoader.cpp b/TheForceEngine/TFE_FrontEndUI/modLoader.cpp index c2fac4d06..bd734d56d 100644 --- a/TheForceEngine/TFE_FrontEndUI/modLoader.cpp +++ b/TheForceEngine/TFE_FrontEndUI/modLoader.cpp @@ -170,11 +170,11 @@ namespace TFE_FrontEndUI return s_viewMode; } - void modLoader_imageListUI() + void modLoader_imageListUI(f32 uiScale) { DisplayInfo dispInfo; TFE_RenderBackend::getDisplayInfo(&dispInfo); - s32 columns = max(1, (dispInfo.width - 16) / 268); + s32 columns = max(1, (dispInfo.width - s32(16*uiScale)) / s32(268*uiScale)); f32 y = ImGui::GetCursorPosY(); ImDrawList* drawList = ImGui::GetWindowDrawList(); @@ -184,8 +184,8 @@ namespace TFE_FrontEndUI { char label[32]; sprintf(label, "###%zd", i); - ImGui::SetCursorPos(ImVec2(f32(x) * 268.0f + 16.0f, y)); - ImGui::InvisibleButton(label, ImVec2(256, 192)); + ImGui::SetCursorPos(ImVec2((f32(x) * 268.0f + 16.0f)*uiScale, y)); + ImGui::InvisibleButton(label, ImVec2(256*uiScale, 192*uiScale)); if (ImGui::IsItemClicked() && s_selectedMod < 0) { s_selectedMod = s32(i); @@ -196,15 +196,21 @@ namespace TFE_FrontEndUI if (ImGui::IsItemHovered() || ImGui::IsItemActive()) { - drawList->AddImageRounded(TFE_RenderBackend::getGpuPtr(s_mods[i].image.texture), ImVec2(f32(x) * 268 + 16 - 2, yScrolled - 2), ImVec2(f32(x) * 268 + 16 + 256 + 2, yScrolled + 192 + 2), ImVec2(0.0f, s_mods[i].invertImage ? 1.0f : 0.0f), ImVec2(1.0f, s_mods[i].invertImage ? 0.0f : 1.0f), 0xffffffff, 8.0f, ImDrawCornerFlags_All); - drawList->AddImageRounded(getGradientTexture(), ImVec2(f32(x) * 268 + 16 - 2, yScrolled - 2), ImVec2(f32(x) * 268 + 16 + 256 + 2, yScrolled + 192 + 2), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), 0x40ffb080, 8.0f, ImDrawCornerFlags_All); + drawList->AddImageRounded(TFE_RenderBackend::getGpuPtr(s_mods[i].image.texture), ImVec2((f32(x) * 268 + 16 - 2)*uiScale, yScrolled - 2*uiScale), + ImVec2((f32(x) * 268 + 16 + 256 + 2)*uiScale, yScrolled + (192 + 2)*uiScale), ImVec2(0.0f, s_mods[i].invertImage ? 1.0f : 0.0f), + ImVec2(1.0f, s_mods[i].invertImage ? 0.0f : 1.0f), 0xffffffff, 8.0f, ImDrawCornerFlags_All); + drawList->AddImageRounded(getGradientTexture(), ImVec2((f32(x) * 268 + 16 - 2)*uiScale, yScrolled - 2*uiScale), + ImVec2((f32(x) * 268 + 16 + 256 + 2)*uiScale, yScrolled + (192 + 2)*uiScale), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), + 0x40ffb080, 8.0f, ImDrawCornerFlags_All); } else { - drawList->AddImageRounded(TFE_RenderBackend::getGpuPtr(s_mods[i].image.texture), ImVec2(f32(x) * 268 + 16, yScrolled), ImVec2(f32(x) * 268 + 16 + 256, yScrolled + 192), ImVec2(0.0f, s_mods[i].invertImage ? 1.0f : 0.0f), ImVec2(1.0f, s_mods[i].invertImage ? 0.0f : 1.0f), 0xffffffff, 8.0f, ImDrawCornerFlags_All); + drawList->AddImageRounded(TFE_RenderBackend::getGpuPtr(s_mods[i].image.texture), ImVec2((f32(x) * 268 + 16)*uiScale, yScrolled), + ImVec2((f32(x) * 268 + 16 + 256)*uiScale, yScrolled + 192*uiScale), ImVec2(0.0f, s_mods[i].invertImage ? 1.0f : 0.0f), + ImVec2(1.0f, s_mods[i].invertImage ? 0.0f : 1.0f), 0xffffffff, 8.0f, ImDrawCornerFlags_All); } - ImGui::SetCursorPos(ImVec2(f32(x) * 268 + 20, y + 192)); + ImGui::SetCursorPos(ImVec2((f32(x) * 268 + 20)*uiScale, y + 192*uiScale)); // Limit the name to 36 characters to avoid going into the next cell. if (s_mods[i].name.length() <= 36) @@ -222,15 +228,15 @@ namespace TFE_FrontEndUI ImGui::LabelText("###Label", name); } } - y += 232; + y += 232*uiScale; } } - void modLoader_NameListUI() + void modLoader_NameListUI(f32 uiScale) { DisplayInfo dispInfo; TFE_RenderBackend::getDisplayInfo(&dispInfo); - s32 rowCount = (dispInfo.height - 112) / 28; + s32 rowCount = (dispInfo.height - s32(112*uiScale)) / s32(28*uiScale); char buttonLabel[32]; ImGui::PushFont(getDialogFont()); @@ -240,15 +246,15 @@ namespace TFE_FrontEndUI for (s32 y = 0; y < rowCount && i < s_mods.size(); y++, i++) { sprintf(buttonLabel, "###mod%zd", i); - ImVec2 cursor(8.0f + x * 410, 88.0f + y * 28); + ImVec2 cursor((8.0f + x * 410)*uiScale, (88.0f + y * 28)*uiScale); ImGui::SetCursorPos(cursor); - if (ImGui::Button(buttonLabel, ImVec2(400, 24)) && s_selectedMod < 0) + if (ImGui::Button(buttonLabel, ImVec2(400*uiScale, 24*uiScale)) && s_selectedMod < 0) { s_selectedMod = s32(i); TFE_System::logWrite(LOG_MSG, "Mods", "Selected Mod = %d", i); } - ImGui::SetCursorPos(ImVec2(cursor.x + 8.0f, cursor.y - 2.0f)); + ImGui::SetCursorPos(ImVec2(cursor.x + 8.0f*uiScale, cursor.y - 2.0f*uiScale)); char name[TFE_MAX_PATH]; strcpy(name, s_mods[i].name.c_str()); size_t len = strlen(name); @@ -266,11 +272,11 @@ namespace TFE_FrontEndUI ImGui::PopFont(); } - void modLoader_FileListUI() + void modLoader_FileListUI(f32 uiScale) { DisplayInfo dispInfo; TFE_RenderBackend::getDisplayInfo(&dispInfo); - s32 rowCount = (dispInfo.height - 112) / 28; + s32 rowCount = (dispInfo.height - s32(112*uiScale)) / s32(28*uiScale); char buttonLabel[32]; ImGui::PushFont(getDialogFont()); @@ -280,15 +286,15 @@ namespace TFE_FrontEndUI for (s32 y = 0; y < rowCount && i < s_mods.size(); y++, i++) { sprintf(buttonLabel, "###mod%zd", i); - ImVec2 cursor(8.0f + x * 410, 88.0f + y * 28); + ImVec2 cursor((8.0f + x * 410)*uiScale, (88.0f + y * 28)*uiScale); ImGui::SetCursorPos(cursor); - if (ImGui::Button(buttonLabel, ImVec2(400, 24)) && s_selectedMod < 0) + if (ImGui::Button(buttonLabel, ImVec2(400*uiScale, 24*uiScale)) && s_selectedMod < 0) { s_selectedMod = s32(i); TFE_System::logWrite(LOG_MSG, "Mods", "Selected Mod = %d", i); } - ImGui::SetCursorPos(ImVec2(cursor.x + 8.0f, cursor.y - 2.0f)); + ImGui::SetCursorPos(ImVec2(cursor.x + 8.0f*uiScale, cursor.y - 2.0f*uiScale)); char name[TFE_MAX_PATH]; strcpy(name, s_mods[i].gobFiles[0].c_str()); size_t len = strlen(name); @@ -308,6 +314,8 @@ namespace TFE_FrontEndUI void modLoader_selectionUI() { + f32 uiScale = (f32)TFE_Ui::getUiScale() * 0.01f; + // Load in the mod data a few at a time so to limit waiting for loading. readFromQueue(1); clearSelectedMod(); @@ -317,7 +325,7 @@ namespace TFE_FrontEndUI ImGui::PushFont(getDialogFont()); ImGui::LabelText("###", "VIEW"); - ImGui::SameLine(128.0f); + ImGui::SameLine(128.0f*uiScale); bool viewImages = s_viewMode == VIEW_IMAGES; bool viewNameList = s_viewMode == VIEW_NAME_LIST; @@ -333,7 +341,7 @@ namespace TFE_FrontEndUI s_viewMode = VIEW_NAME_LIST; } } - ImGui::SameLine(236.0f); + ImGui::SameLine(236.0f*uiScale); if (ImGui::Checkbox("Name List", &viewNameList)) { if (viewNameList) @@ -345,7 +353,7 @@ namespace TFE_FrontEndUI s_viewMode = VIEW_FILE_LIST; } } - ImGui::SameLine(380.0f); + ImGui::SameLine(380.0f*uiScale); if (ImGui::Checkbox("File List", &viewFileList)) { if (viewFileList) @@ -363,15 +371,15 @@ namespace TFE_FrontEndUI if (s_viewMode == VIEW_IMAGES) { - modLoader_imageListUI(); + modLoader_imageListUI(uiScale); } else if (s_viewMode == VIEW_NAME_LIST) { - modLoader_NameListUI(); + modLoader_NameListUI(uiScale); } else if (s_viewMode == VIEW_FILE_LIST) { - modLoader_FileListUI(); + modLoader_FileListUI(uiScale); } if (s_selectedMod >= 0) @@ -381,37 +389,37 @@ namespace TFE_FrontEndUI bool open = true; bool retFromLoader = false; - s32 infoWidth = dispInfo.width - 120; - s32 infoHeight = dispInfo.height - 120; + s32 infoWidth = dispInfo.width - s32(120*uiScale); + s32 infoHeight = dispInfo.height - s32(120*uiScale); const u32 window_flags = ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings; - ImGui::SetCursorPos(ImVec2(10, 10)); + ImGui::SetCursorPos(ImVec2(10*uiScale, 10*uiScale)); ImGui::Begin("Mod Info", &open, ImVec2(f32(infoWidth), f32(infoHeight)), 1.0f, window_flags); ImDrawList* drawList = ImGui::GetWindowDrawList(); ImVec2 cursor = ImGui::GetCursorPos(); - drawList->AddImageRounded(TFE_RenderBackend::getGpuPtr(s_mods[s_selectedMod].image.texture), ImVec2(cursor.x + 64, cursor.y + 64), ImVec2(cursor.x + 320 + 64, cursor.y + 200 + 64), + drawList->AddImageRounded(TFE_RenderBackend::getGpuPtr(s_mods[s_selectedMod].image.texture), ImVec2(cursor.x + 64, cursor.y + 64), ImVec2(cursor.x + 64 + 320*uiScale, cursor.y + 64 + 200*uiScale), ImVec2(0.0f, s_mods[s_selectedMod].invertImage ? 1.0f : 0.0f), ImVec2(1.0f, s_mods[s_selectedMod].invertImage ? 0.0f : 1.0f), 0xffffffff, 8.0f, ImDrawCornerFlags_All); ImGui::PushFont(getDialogFont()); - ImGui::SetCursorPosX(cursor.x + 320 + 70); + ImGui::SetCursorPosX(cursor.x + (320 + 70)*uiScale); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.8f, 0.9f, 1.0f, 1.0f)); ImGui::LabelText("###", s_mods[s_selectedMod].name.c_str()); ImGui::PopStyleColor(); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 0.75f)); - ImGui::SetCursorPos(ImVec2(cursor.x + 10, cursor.y + 220)); + ImGui::SetCursorPos(ImVec2(cursor.x + 10*uiScale, cursor.y + 220*uiScale)); ImGui::Text("Game: Dark Forces"); - ImGui::SetCursorPosX(cursor.x + 10); + ImGui::SetCursorPosX(cursor.x + 10*uiScale); ImGui::Text("Type: Vanilla Compatible"); - ImGui::SetCursorPosX(cursor.x + 10); + ImGui::SetCursorPosX(cursor.x + 10*uiScale); ImGui::Text("File: %s", s_mods[s_selectedMod].gobFiles[0].c_str()); ImGui::PopStyleColor(); - ImGui::SetCursorPos(ImVec2(cursor.x + 90, cursor.y + 320)); + ImGui::SetCursorPos(ImVec2(cursor.x + 90*uiScale, cursor.y + 320*uiScale)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.5f, 0.0f, 0.0f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.0f, 0.0f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); - if (ImGui::Button("PLAY", ImVec2(128, 32))) + if (ImGui::Button("PLAY", ImVec2(128*uiScale, 32*uiScale))) { char selectedModCmd[TFE_MAX_PATH]; sprintf(selectedModCmd, "-u%s%s", s_mods[s_selectedMod].relativePath.c_str(), s_mods[s_selectedMod].gobFiles[0].c_str()); @@ -424,16 +432,16 @@ namespace TFE_FrontEndUI } ImGui::PopStyleColor(3); - ImGui::SetCursorPos(ImVec2(cursor.x + 90, cursor.y + 360)); - if (ImGui::Button("CANCEL", ImVec2(128, 32))) + ImGui::SetCursorPos(ImVec2(cursor.x + 90*uiScale, cursor.y + 360*uiScale)); + if (ImGui::Button("CANCEL", ImVec2(128*uiScale, 32*uiScale))) { open = false; } ImGui::PopFont(); - ImGui::SetCursorPos(ImVec2(cursor.x + 320 + 8, cursor.y + 30)); - ImGui::BeginChild("###Mod Info Text", ImVec2(f32(infoWidth - 344), f32(infoHeight - 68)), true, ImGuiWindowFlags_NoBringToFrontOnFocus); + ImGui::SetCursorPos(ImVec2(cursor.x + 328*uiScale, cursor.y + 30*uiScale)); + ImGui::BeginChild("###Mod Info Text", ImVec2(f32(infoWidth - 344*uiScale), f32(infoHeight - 68*uiScale)), true, ImGuiWindowFlags_NoBringToFrontOnFocus); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 0.75f)); ImGui::TextWrapped(s_mods[s_selectedMod].text.c_str()); ImGui::PopStyleColor(); @@ -908,7 +916,7 @@ namespace TFE_FrontEndUI TextureData* imageData = bitmap_loadFromMemory(s_readBuffer[0].data(), s_readBuffer[0].size(), 1); u32 palette[256]; convertPalette(s_readBuffer[1].data(), palette); - createTexture(imageData, palette, poster); + createTexture(imageData, palette, poster, MAG_FILTER_LINEAR); } if (archiveMod && archiveIsGob) From 5a59473de1dcfb3941529ba405eae78170e938ec Mon Sep 17 00:00:00 2001 From: Alexander 'z33ky' Hirsch <1zeeky@gmail.com> Date: Tue, 19 Apr 2022 12:45:52 +0200 Subject: [PATCH 3/4] Sync Linux port with master. Commit 1618b72ca55bd1a08e703166b93fd6314c2c0af3 merged a new master commit, which broke the Linux build. This updates the source files in the Makefile and provides implementations for _strlwr() and Signal. --- Makefile | 28 +++++++++- .../TFE_DarkForces/Landru/lpalette.cpp | 6 ++- .../TFE_DarkForces/briefingList.cpp | 15 ++++-- TheForceEngine/TFE_FileSystem/paths.cpp | 6 ++- .../TFE_System/Threads/Linux/mutexLinux.h | 2 + .../TFE_System/Threads/Linux/signalLinux.cpp | 53 +++++++++++++++++++ .../TFE_System/Threads/Linux/signalLinux.h | 19 +++++++ TheForceEngine/TFE_System/types.h | 10 ++++ 8 files changed, 132 insertions(+), 7 deletions(-) create mode 100644 TheForceEngine/TFE_System/Threads/Linux/signalLinux.cpp create mode 100644 TheForceEngine/TFE_System/Threads/Linux/signalLinux.h diff --git a/Makefile b/Makefile index 0b99b580d..7e8d57410 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,8 @@ AUDIO = TheForceEngine/TFE_Audio/audioDevice.o \ TheForceEngine/TFE_Audio/audioSystem.o \ TheForceEngine/TFE_Audio/midiDevice.o \ TheForceEngine/TFE_Audio/midiPlayer.o \ + TheForceEngine/TFE_Audio/RtAudio.o \ + TheForceEngine/TFE_Audio/RtMidi.o DARKFORCES = TheForceEngine/TFE_DarkForces/Actor/actor.o \ TheForceEngine/TFE_DarkForces/Actor/actorDebug.o \ @@ -66,19 +68,42 @@ DARKFORCES = TheForceEngine/TFE_DarkForces/Actor/actor.o \ TheForceEngine/TFE_DarkForces/GameUI/delt.o \ TheForceEngine/TFE_DarkForces/GameUI/editBox.o \ TheForceEngine/TFE_DarkForces/GameUI/escapeMenu.o \ + TheForceEngine/TFE_DarkForces/GameUI/menu.o \ + TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.o \ + TheForceEngine/TFE_DarkForces/GameUI/pda.o \ TheForceEngine/TFE_DarkForces/GameUI/uiDraw.o \ TheForceEngine/TFE_DarkForces/agent.o \ TheForceEngine/TFE_DarkForces/animLogic.o \ TheForceEngine/TFE_DarkForces/automap.o \ + TheForceEngine/TFE_DarkForces/briefingList.o \ TheForceEngine/TFE_DarkForces/cheats.o \ TheForceEngine/TFE_DarkForces/config.o \ TheForceEngine/TFE_DarkForces/darkForcesMain.o \ - TheForceEngine/TFE_DarkForces/gameList.o \ TheForceEngine/TFE_DarkForces/gameMessage.o \ TheForceEngine/TFE_DarkForces/generator.o \ TheForceEngine/TFE_DarkForces/hitEffect.o \ TheForceEngine/TFE_DarkForces/hud.o \ TheForceEngine/TFE_DarkForces/item.o \ + TheForceEngine/TFE_DarkForces/Landru/cutscene.o \ + TheForceEngine/TFE_DarkForces/Landru/cutsceneList.o \ + TheForceEngine/TFE_DarkForces/Landru/cutscene_film.o \ + TheForceEngine/TFE_DarkForces/Landru/cutscene_player.o \ + TheForceEngine/TFE_DarkForces/Landru/lactor.o \ + TheForceEngine/TFE_DarkForces/Landru/lactorAnim.o \ + TheForceEngine/TFE_DarkForces/Landru/lactorCust.o \ + TheForceEngine/TFE_DarkForces/Landru/lactorDelt.o \ + TheForceEngine/TFE_DarkForces/Landru/lcanvas.o \ + TheForceEngine/TFE_DarkForces/Landru/ldraw.o \ + TheForceEngine/TFE_DarkForces/Landru/lfade.o \ + TheForceEngine/TFE_DarkForces/Landru/lfont.o \ + TheForceEngine/TFE_DarkForces/Landru/lmusic.o \ + TheForceEngine/TFE_DarkForces/Landru/lpalette.o \ + TheForceEngine/TFE_DarkForces/Landru/lrect.o \ + TheForceEngine/TFE_DarkForces/Landru/lsound.o \ + TheForceEngine/TFE_DarkForces/Landru/lsystem.o \ + TheForceEngine/TFE_DarkForces/Landru/ltimer.o \ + TheForceEngine/TFE_DarkForces/Landru/lview.o \ + TheForceEngine/TFE_DarkForces/Landru/textCrawl.o \ TheForceEngine/TFE_DarkForces/logic.o \ TheForceEngine/TFE_DarkForces/mission.o \ TheForceEngine/TFE_DarkForces/pickup.o \ @@ -189,6 +214,7 @@ SYSTEM = TheForceEngine/TFE_System/log.o \ TheForceEngine/TFE_System/profiler.o \ TheForceEngine/TFE_System/system.o \ TheForceEngine/TFE_System/Threads/Linux/mutexLinux.o \ + TheForceEngine/TFE_System/Threads/Linux/signalLinux.o \ TheForceEngine/TFE_System/Threads/Linux/threadLinux.o UI = TheForceEngine/TFE_Ui/imGUI/imgui.o \ diff --git a/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp b/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp index 9f2376cf9..e5f70bd5b 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp @@ -637,6 +637,10 @@ namespace TFE_DarkForces { pal->resType = resType; strcpy(pal->name, name); - _strlwr(pal->name); + #ifdef WIN32 + _strlwr(pal->name); + #else + strlwr(pal->name); + #endif } } \ No newline at end of file diff --git a/TheForceEngine/TFE_DarkForces/briefingList.cpp b/TheForceEngine/TFE_DarkForces/briefingList.cpp index b6fd87b52..56d199980 100644 --- a/TheForceEngine/TFE_DarkForces/briefingList.cpp +++ b/TheForceEngine/TFE_DarkForces/briefingList.cpp @@ -78,10 +78,17 @@ namespace TFE_DarkForces } else { - _strlwr(mission); - _strlwr(archive); - _strlwr(bgAnim); - _strlwr(palette); + #ifdef _WIN32 + _strlwr(mission); + _strlwr(archive); + _strlwr(bgAnim); + _strlwr(palette); + #else + strlwr(mission); + strlwr(archive); + strlwr(bgAnim); + strlwr(palette); + #endif strcpy(info->mission, mission); strcpy(info->archive, archive); diff --git a/TheForceEngine/TFE_FileSystem/paths.cpp b/TheForceEngine/TFE_FileSystem/paths.cpp index ae58041f3..22192eb8c 100644 --- a/TheForceEngine/TFE_FileSystem/paths.cpp +++ b/TheForceEngine/TFE_FileSystem/paths.cpp @@ -232,7 +232,11 @@ namespace TFE_Paths { char fileNameLC[TFE_MAX_PATH]; strcpy(fileNameLC, fileName); - _strlwr(fileNameLC); + #ifdef WIN32 + _strlwr(fileNameLC); + #else + strlwr(fileNameLC); + #endif char filePathFixed[TFE_MAX_PATH]; strcpy(filePathFixed, filePath); diff --git a/TheForceEngine/TFE_System/Threads/Linux/mutexLinux.h b/TheForceEngine/TFE_System/Threads/Linux/mutexLinux.h index 7e228a596..a0e30aba5 100644 --- a/TheForceEngine/TFE_System/Threads/Linux/mutexLinux.h +++ b/TheForceEngine/TFE_System/Threads/Linux/mutexLinux.h @@ -4,6 +4,8 @@ class MutexLinux : public Mutex { + friend class SignalLinux; + public: MutexLinux(); virtual ~MutexLinux(); diff --git a/TheForceEngine/TFE_System/Threads/Linux/signalLinux.cpp b/TheForceEngine/TFE_System/Threads/Linux/signalLinux.cpp new file mode 100644 index 000000000..067056c49 --- /dev/null +++ b/TheForceEngine/TFE_System/Threads/Linux/signalLinux.cpp @@ -0,0 +1,53 @@ +#include "signalLinux.h" + +SignalLinux::SignalLinux() +{ + pthread_cond_init(&m_handle, NULL); + m_signalled = false; +} + +SignalLinux::~SignalLinux() +{ + pthread_cond_destroy(&m_handle); +} + +void SignalLinux::fire() +{ + m_mutex.lock(); + m_signalled = true; + m_mutex.unlock(); + pthread_cond_signal(&m_handle); +} + +bool SignalLinux::wait(u32 timeOutInMS, bool reset) +{ + timespec timeout = { + .tv_sec = timeOutInMS / 1000, + .tv_nsec = (timeOutInMS % 1000) * 1000000, + }; + + m_mutex.lock(); + + int res = 0; + while (!m_signalled && res == 0) + { + res = pthread_cond_timedwait(&m_handle, &m_mutex.m_handle, &timeout); + } + + //reset the event so it can be used again but only if the event was signaled. + if (res == 0 && reset) + { + m_signalled = false; + } + + m_mutex.unlock(); + + return res == 0; +} + +//factory +Signal* Signal::create() +{ + return new SignalLinux(); +} + diff --git a/TheForceEngine/TFE_System/Threads/Linux/signalLinux.h b/TheForceEngine/TFE_System/Threads/Linux/signalLinux.h new file mode 100644 index 000000000..f0b7918b0 --- /dev/null +++ b/TheForceEngine/TFE_System/Threads/Linux/signalLinux.h @@ -0,0 +1,19 @@ +#pragma once +#include +#include "mutexLinux.h" +#include "../signal.h" + +class SignalLinux : public Signal +{ +public: + SignalLinux(); + virtual ~SignalLinux(); + + virtual void fire(); + virtual bool wait(u32 timeOutInMS=TIMEOUT_INFINITE, bool reset=true); + +private: + pthread_cond_t m_handle; + MutexLinux m_mutex; + bool m_signalled; +}; diff --git a/TheForceEngine/TFE_System/types.h b/TheForceEngine/TFE_System/types.h index 91418866f..8dcaebf81 100644 --- a/TheForceEngine/TFE_System/types.h +++ b/TheForceEngine/TFE_System/types.h @@ -3,6 +3,7 @@ #include #include #include +#include #include typedef uint64_t u64; @@ -104,6 +105,15 @@ enum JediBool : u32 #ifdef _WIN32 #define strcasecmp _stricmp #define strncasecmp _strnicmp +#else +inline char* strlwr(char *s) +{ + for (char *c = s; *c != '\0'; ++c) + { + *c = tolower(*c); + } + return s; +} #endif #ifdef _WIN32 From e29742519e4051ccab3652d8d3bd5a2131746022 Mon Sep 17 00:00:00 2001 From: Alexander 'z33ky' Hirsch <1zeeky@gmail.com> Date: Tue, 19 Apr 2022 12:48:25 +0200 Subject: [PATCH 4/4] Fix minor build errors. --- TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.cpp | 2 +- TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.h | 1 - TheForceEngine/TFE_DarkForces/Landru/cutscene_film.cpp | 2 ++ TheForceEngine/TFE_DarkForces/Landru/cutscene_player.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/lactor.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/lcanvas.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/ldraw.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/lfont.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/lmusic.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/lsound.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/lview.cpp | 1 + TheForceEngine/TFE_DarkForces/Landru/textCrawl.cpp | 1 + TheForceEngine/TFE_DarkForces/briefingList.cpp | 1 + TheForceEngine/TFE_System/types.h | 1 + 15 files changed, 15 insertions(+), 2 deletions(-) diff --git a/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.cpp b/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.cpp index 299961894..ccd31ad04 100644 --- a/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.cpp +++ b/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.cpp @@ -50,7 +50,7 @@ namespace TFE_DarkForces s16 s_briefY; s32 s_briefingMaxY; - LRect s_overlayRect; + static LRect s_overlayRect; enum { diff --git a/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.h b/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.h index 096372b4f..c01c699fe 100644 --- a/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.h +++ b/TheForceEngine/TFE_DarkForces/GameUI/missionBriefing.h @@ -22,5 +22,4 @@ namespace TFE_DarkForces extern s16 s_briefY; extern s32 s_briefingMaxY; - extern LRect s_overlayRect; } diff --git a/TheForceEngine/TFE_DarkForces/Landru/cutscene_film.cpp b/TheForceEngine/TFE_DarkForces/Landru/cutscene_film.cpp index ac0f0c5de..6b046b877 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/cutscene_film.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/cutscene_film.cpp @@ -14,6 +14,8 @@ #include #include #include +#include + using namespace TFE_Jedi; diff --git a/TheForceEngine/TFE_DarkForces/Landru/cutscene_player.cpp b/TheForceEngine/TFE_DarkForces/Landru/cutscene_player.cpp index 88a431795..b3082b666 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/cutscene_player.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/cutscene_player.cpp @@ -16,6 +16,7 @@ #include #include #include +#include using namespace TFE_Jedi; diff --git a/TheForceEngine/TFE_DarkForces/Landru/lactor.cpp b/TheForceEngine/TFE_DarkForces/Landru/lactor.cpp index e529f6377..f9117bd3e 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lactor.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lactor.cpp @@ -4,6 +4,7 @@ #include "lview.h" #include "ltimer.h" #include +#include #include namespace TFE_DarkForces diff --git a/TheForceEngine/TFE_DarkForces/Landru/lcanvas.cpp b/TheForceEngine/TFE_DarkForces/Landru/lcanvas.cpp index 461a43dce..08076e802 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lcanvas.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lcanvas.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include using namespace TFE_Jedi; diff --git a/TheForceEngine/TFE_DarkForces/Landru/ldraw.cpp b/TheForceEngine/TFE_DarkForces/Landru/ldraw.cpp index 7eef603cf..c5317e2fb 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/ldraw.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/ldraw.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/TheForceEngine/TFE_DarkForces/Landru/lfont.cpp b/TheForceEngine/TFE_DarkForces/Landru/lfont.cpp index 4200dfb9f..34e6ae236 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lfont.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lfont.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/TheForceEngine/TFE_DarkForces/Landru/lmusic.cpp b/TheForceEngine/TFE_DarkForces/Landru/lmusic.cpp index 066338d4b..3dddc102e 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lmusic.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lmusic.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include namespace TFE_DarkForces diff --git a/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp b/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp index e5f70bd5b..941588267 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lpalette.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include using namespace TFE_Jedi; diff --git a/TheForceEngine/TFE_DarkForces/Landru/lsound.cpp b/TheForceEngine/TFE_DarkForces/Landru/lsound.cpp index ee1808129..e4044266a 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lsound.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lsound.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include using namespace TFE_Jedi; diff --git a/TheForceEngine/TFE_DarkForces/Landru/lview.cpp b/TheForceEngine/TFE_DarkForces/Landru/lview.cpp index 055fb9b21..34f8f0926 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/lview.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/lview.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include using namespace TFE_Jedi; diff --git a/TheForceEngine/TFE_DarkForces/Landru/textCrawl.cpp b/TheForceEngine/TFE_DarkForces/Landru/textCrawl.cpp index 120d46c0f..68a2ed5e5 100644 --- a/TheForceEngine/TFE_DarkForces/Landru/textCrawl.cpp +++ b/TheForceEngine/TFE_DarkForces/Landru/textCrawl.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include using namespace TFE_Jedi; diff --git a/TheForceEngine/TFE_DarkForces/briefingList.cpp b/TheForceEngine/TFE_DarkForces/briefingList.cpp index 56d199980..41d5e96be 100644 --- a/TheForceEngine/TFE_DarkForces/briefingList.cpp +++ b/TheForceEngine/TFE_DarkForces/briefingList.cpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace TFE_DarkForces { diff --git a/TheForceEngine/TFE_System/types.h b/TheForceEngine/TFE_System/types.h index 8dcaebf81..52589b193 100644 --- a/TheForceEngine/TFE_System/types.h +++ b/TheForceEngine/TFE_System/types.h @@ -2,6 +2,7 @@ #include #include +#include #include #include #include