Add "lock aspect ratio" setting

Uses new Aurora functionality: https://github.com/encounter/aurora/pull/97

Fixes #138
This commit is contained in:
PJB3005
2026-04-05 22:45:46 +02:00
parent c006baaf63
commit 4311f91c37
5 changed files with 23 additions and 3 deletions
+8
View File
@@ -5,4 +5,12 @@
extern AuroraInfo auroraInfo;
constexpr u32 defaultWindowWidth = 608;
constexpr u32 defaultWindowHeight = 448;
constexpr u32 defaultAspectRatioW = 19;
constexpr u32 defaultAspectRatioH = 14;
static_assert(defaultWindowWidth / defaultAspectRatioW == defaultWindowHeight / defaultAspectRatioH);
#endif // DUSK_DUSK_H
+1
View File
@@ -11,6 +11,7 @@ struct UserSettings {
struct {
// Video
bool enableFullscreen;
bool lockAspectRatio;
} video;
struct {
+11 -1
View File
@@ -6,8 +6,9 @@
#include <imgui_internal.h>
#include "JSystem/JUtility/JUTGamePad.h"
#include "dusk/audio/DuskDsp.hpp"
#include "dusk/audio/DuskAudioSystem.h"
#include "dusk/audio/DuskDsp.hpp"
#include "dusk/dusk.h"
#include "dusk/hotkeys.h"
#include "dusk/settings.h"
#include "m_Do/m_Do_controller_pad.h"
@@ -29,6 +30,15 @@ namespace dusk {
VISetWindowFullscreen(getSettings().video.enableFullscreen);
}
bool& lockAspect = getSettings().video.lockAspectRatio;
if (ImGui::Checkbox("Lock Aspect Ratio", &lockAspect)) {
if (lockAspect) {
VILockAspectRatio(defaultAspectRatioW, defaultAspectRatioH);
} else {
VIUnlockAspectRatio();
}
}
ImGui::EndMenu();
}
+1
View File
@@ -8,6 +8,7 @@ UserSettings g_userSettings = {
// Video
.video = {
.enableFullscreen = false,
.lockAspectRatio = false,
},
// Audio
+2 -2
View File
@@ -269,8 +269,8 @@ int game_main(int argc, char* argv[]) {
config.appName = "Dusk";
config.windowPosX = -1;
config.windowPosY = -1;
config.windowWidth = 608 * 2;
config.windowHeight = 448 * 2;
config.windowWidth = defaultWindowWidth * 2;
config.windowHeight = defaultWindowHeight * 2;
config.desiredBackend = ParseAuroraBackend(parsed_arg_options["backend"].as<std::string>());
config.logCallback = &aurora_log_callback;
config.logLevel = (AuroraLogLevel)parsed_arg_options["log-level"].as<uint8_t>();