UI scaling improvement

This commit is contained in:
2025-09-13 11:40:28 +02:00
parent 986646e8b1
commit 8ac0373374

View File

@@ -64,10 +64,13 @@ const char* FOG_FIX_SETTING = "FogFIX=";
const char* CAMERA_DISTANCE_FIX_SETTING = "CameraDistanceFIX="; const char* CAMERA_DISTANCE_FIX_SETTING = "CameraDistanceFIX=";
const char* WORLD_FOV_SETTING = "WorldFOV="; const char* WORLD_FOV_SETTING = "WorldFOV=";
const char* CAMERA_DISTANCE_SETTING = "CameraDistance="; const char* CAMERA_DISTANCE_SETTING = "CameraDistance=";
const char* FIX_VERSION = "1.0.5"; const char* FIX_VERSION = "1.0.6";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Unlock ultrawide resolutions.\n - Remove depth of field.\n - Remove vignetting.\n - Remove fog.\n - Re enable console."; const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Unlock ultrawide resolutions.\n - Remove depth of field.\n - Remove vignetting.\n - Remove fog.\n - Re enable console.";
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44"; const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
// Facteur de scaling basé sur la résolution verticale
float scale = 1.f;
bool IsAlreadyInitialized() bool IsAlreadyInitialized()
{ {
// Declare a lock // Declare a lock
@@ -206,125 +209,106 @@ static void LoadSettings()
// Fix informations // Fix informations
static void displayFixInformations() { static void displayFixInformations() {
ImGui::SetNextWindowSize(ImVec2(250, 200)); ImGui::SetNextWindowSize(ImVec2(250 * scale, 200 * scale));
ImGui::Begin("Informations", &popup_Informations); // ImGui::Begin("Informations", &popup_Informations); //
ImGui::SetCursorPos(ImVec2(10, 36)); ImGui::SetCursorPos(ImVec2(10 * scale, 36 * scale));
ImGui::Text("Version : %s", FIX_VERSION); ImGui::Text("Version : %s", FIX_VERSION);
ImGui::SetCursorPos(ImVec2(10, 76)); ImGui::SetCursorPos(ImVec2(10 * scale, 76 * scale));
ImGui::Text(FIX_INFORMATIONS); ImGui::Text(FIX_INFORMATIONS);
ImGui::End(); ImGui::End();
} }
// Initialize ImGui widgets for Reshade
static void on_overlay_draw(reshade::api::effect_runtime* runtime) static void on_overlay_draw(reshade::api::effect_runtime* runtime)
{ {
ImGui::SetNextWindowPos(ImVec2(100, 200), ImGuiCond_Once); ImGuiStyle& style = ImGui::GetStyle();
ImGui::SetNextWindowSize(ImVec2(350, 150), ImGuiCond_Once); style.ItemSpacing = ImVec2(8 * scale, 8 * scale); // Spacing between widgets
style.FramePadding = ImVec2(3 * scale, 3 * scale); // Widgets padding
style.WindowPadding = ImVec2(10 * scale, 10 * scale); // Overlay padding
// Donation ? scale = (float)screenHeight / 1200.f;
ImGui::SetCursorPos(ImVec2(10, 36));
ImGui::Text("Like my work ?");
ImGui::SetCursorPos(ImVec2(130, 33));
if (ImGui::Button("consider donation"))
{
ShellExecuteA(NULL, "open", DONATION_URL, NULL, NULL, SW_SHOWNORMAL);
}
// Fix informations ImGui::SetNextWindowSize(ImVec2(480 * scale, 400 * scale), ImGuiCond_Once);
ImGui::SetCursorPos(ImVec2(270, 33));
if (ImGui::Button("Fix informations")) if (ImGui::Button("Like my work ? Consider donation")) ShellExecuteA(NULL, "open", DONATION_URL, NULL, NULL, SW_SHOWNORMAL); // Donation
popup_Informations = true; ImGui::SameLine();
if (ImGui::Button("Fix informations")) popup_Informations = true; // Fix information
if (popup_Informations) if (popup_Informations)
displayFixInformations(); {
ImGui::Begin("Informations", &popup_Informations);
ImGui::Text("Version : %s", FIX_VERSION);
ImGui::Text(FIX_INFORMATIONS);
ImGui::End();
}
// Generic fix ImGui::Columns(2, NULL, false);
ImGui::SetCursorPos(ImVec2(10, 60));
ImGui::BeginChild("AllFixesHeader", ImVec2(220, 0), false); // true = border // Drawing a left column with slider and general fix
if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::CollapsingHeader("Enable fixes", ImGuiTreeNodeFlags_DefaultOpen))
ImGui::SetCursorPos(ImVec2(5, 30)); if (ImGui::Checkbox("Fix enabled", &fix_enabled)) { if (SetFixEnabled) SetFixEnabled(fix_enabled, false); SaveSettings(); }
if (ImGui::Checkbox("Fix enabled", &fix_enabled)) {
if (SetFixEnabled) SetFixEnabled(fix_enabled, false); // Sliders
SaveSettings(); if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::SetNextItemWidth(150 * scale);
if (ImGui::SliderInt("##FOVValue", &worldFOVvalue, -20, 70)) {
if (SetFOV) SetFOV(worldFOVvalue); SaveSettings();
} }
} }
ImGui::EndChild();
// FOV adjustment if (ImGui::CollapsingHeader("Camera distance (*)", ImGuiTreeNodeFlags_DefaultOpen))
ImGui::SetCursorPos(ImVec2(10, 120)); {
ImGui::BeginChild("FOVHeader", ImVec2(220, 0), false); ImGui::SetNextItemWidth(150 * scale);
if (ImGui::CollapsingHeader("In game additional FOV", ImGuiTreeNodeFlags_DefaultOpen)) { if (ImGui::SliderFloat("##CameraValue", &cameraDistancevalue, 0, 3)) {
ImGui::SetCursorPos(ImVec2(5, 30)); if (SetCameraDistance) SetCameraDistance(cameraDistancevalue); SaveSettings();
ImGui::SetNextItemWidth(150.0f);
if (ImGui::SliderInt("", &worldFOVvalue, -20, 70)) {}
if (ImGui::IsItemDeactivatedAfterEdit()) {
if (SetFOV) SetFOV(worldFOVvalue);
SaveSettings();
} }
} }
ImGui::EndChild(); if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
// Camera distance adjustment ImGui::Text("Value is a multiplier.");
ImGui::SetCursorPos(ImVec2(10, 180)); ImGui::Text("Affects both normal and weapon aiming distance.");
ImGui::BeginChild("CameraHeader", ImVec2(220, 0), false); ImGui::EndTooltip();
if (ImGui::CollapsingHeader("Camera distance multiplier", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::SetCursorPos(ImVec2(5, 30));
ImGui::SetNextItemWidth(150.0f);
if (ImGui::SliderFloat("", &cameraDistancevalue, 0, 3)) {}
if (ImGui::IsItemDeactivatedAfterEdit()) {
if (SetCameraDistance) SetCameraDistance(cameraDistancevalue);
SaveSettings();
}
} }
ImGui::EndChild();
// Individual fixes // Individual fixes
ImGui::SetCursorPos(ImVec2(240, 60)); ImGui::NextColumn();
ImGui::BeginChild("IndividualFixesHeader", ImVec2(250, 0), false); if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen))
if (ImGui::CollapsingHeader("Individual fixes", ImGuiTreeNodeFlags_DefaultOpen)) { {
ImGui::SetCursorPos(ImVec2(5, 30));
if (ImGui::Checkbox("FOV", &fov_fix_enabled)) { if (ImGui::Checkbox("FOV", &fov_fix_enabled)) {
if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, false); if (SetFOVFixEnabled) SetFOVFixEnabled(fov_fix_enabled, false);
SaveSettings(); SaveSettings();
} }
ImGui::SetCursorPos(ImVec2(60, 30));
if (ImGui::Checkbox("Camera distance", &camera_Distance_fix_enabled)) { if (ImGui::Checkbox("Camera distance", &camera_Distance_fix_enabled)) {
if (SetCameraDistanceFixEnabled) SetCameraDistanceFixEnabled(camera_Distance_fix_enabled, false); if (SetCameraDistanceFixEnabled) SetCameraDistanceFixEnabled(camera_Distance_fix_enabled, false);
SaveSettings(); SaveSettings();
} }
ImGui::SetCursorPos(ImVec2(5, 55));
if (ImGui::Checkbox("Aspect ratio", &Aspect_fix_enabled)) { if (ImGui::Checkbox("Aspect ratio", &Aspect_fix_enabled)) {
if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, false); if (SetAspectRatioFixEnabled) SetAspectRatioFixEnabled(Aspect_fix_enabled, false);
SaveSettings(); SaveSettings();
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text("This is intended for ultrawide only."); ImGui::Text("This is intended for ultrawide only.");
ImGui::Text("Set panini to off in settings to avoid blurry textures and narrow FOV."); ImGui::Text("Set panini to off in settings to avoid blurry textures and narrow FOV.");
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::SetCursorPos(ImVec2(5, 80));
if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) { if (ImGui::Checkbox("Depth of field", &DOF_fix_enabled)) {
if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false); if (SetDOFFixEnabled) SetDOFFixEnabled(DOF_fix_enabled, false);
SaveSettings(); SaveSettings();
} }
ImGui::SetCursorPos(ImVec2(5, 105));
if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) { if (ImGui::Checkbox("Vignetting", &Vignetting_fix_enabled)) {
if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, false); if (SetVignettingFixEnabled) SetVignettingFixEnabled(Vignetting_fix_enabled, false);
SaveSettings(); SaveSettings();
} }
ImGui::SetCursorPos(ImVec2(110, 105));
if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) { if (ImGui::Checkbox("Fog", &Fog_fix_enabled)) {
if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, false); if (SetFogFixEnabled) SetFogFixEnabled(Fog_fix_enabled, false);
SaveSettings(); SaveSettings();
} }
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::Text("Enabling this fix is a one way."); ImGui::Text("Enabling this fix is a one way.");
@@ -333,22 +317,17 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
} }
ImGui::EndChild(); ImGui::Columns(1);
// Fix status // Fix status
ImGui::SetCursorPos(ImVec2(10, 240)); if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen))
ImGui::BeginChild("INFOSHeader", ImVec2(480, 85), true); {
if (ImGui::CollapsingHeader("Fix informations", ImGuiTreeNodeFlags_DefaultOpen)) { ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
ImGui::SetCursorPos(ImVec2(5, 30)); if (GetConsoleEnabled && GetConsoleEnabled())
ImGui::Text("Screen infos width: %d, height: %d, aspect ratio: %.2f", screenWidth, screenHeight, aspectRatio);
ImGui::SetCursorPos(ImVec2(5, 45));
if (GetConsoleEnabled && GetConsoleEnabled())
ImGui::Text("Console enabled and bound to key Tilde"); ImGui::Text("Console enabled and bound to key Tilde");
ImGui::SetCursorPos(ImVec2(5, 60)); if (GetFOVIn && GetCompensadedFOV && GetFOVOut)
if (GetFOVIn && GetCompensadedFOV && GetFOVOut) // Test functions in case Core dll is not ready when called ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated: %.2f, Out: %.2f", GetFOVIn(), GetCompensadedFOV(), GetFOVOut());
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Compensated : %.2f, Out : %.2f", GetFOVIn(), GetCompensadedFOV(), GetFOVOut());
} }
ImGui::EndChild();
} }
// Main dll intrance // Main dll intrance