Add vsync toggle & honor fullscreen setting

This commit is contained in:
Luke Street
2026-04-06 23:07:48 -06:00
parent f489cc2786
commit 12af5b212f
5 changed files with 15 additions and 1 deletions
+1 -1
+1
View File
@@ -15,6 +15,7 @@ struct UserSettings {
struct {
// Video
ConfigVar<bool> enableFullscreen;
ConfigVar<bool> enableVsync;
} video;
struct {
+9
View File
@@ -14,6 +14,8 @@
#include "m_Do/m_Do_controller_pad.h"
#include "m_Do/m_Do_graphic.h"
#include <aurora/gfx.h>
namespace dusk {
void ImGuiMenuGame::ToggleFullscreen() {
getSettings().video.enableFullscreen.setValue(!getSettings().video.enableFullscreen);
@@ -36,6 +38,13 @@ namespace dusk {
ToggleFullscreen();
}
bool vsync = getSettings().video.enableVsync;
if (ImGui::Checkbox("Enable Vsync", &vsync)) {
getSettings().video.enableVsync.setValue(vsync);
aurora_enable_vsync(vsync);
config::Save();
}
if (ImGui::MenuItem("Default Window Size")) {
getSettings().video.enableFullscreen.setValue(false);
VISetWindowFullscreen(false);
+2
View File
@@ -6,6 +6,7 @@ namespace dusk {
UserSettings g_userSettings = {
.video = {
.enableFullscreen {"video.enableFullscreen", false},
.enableVsync {"video.enableVsync", true},
},
.audio = {
@@ -63,6 +64,7 @@ UserSettings& getSettings() {
void registerSettings() {
// Video
Register(g_userSettings.video.enableFullscreen);
Register(g_userSettings.video.enableVsync);
// Audio
Register(g_userSettings.audio.masterVolume);
+2
View File
@@ -319,6 +319,8 @@ int game_main(int argc, char* argv[]) {
AuroraConfig config{};
config.appName = dusk::AppName;
config.configPath = configPath;
config.vsync = dusk::getSettings().video.enableVsync;
config.startFullscreen = dusk::getSettings().video.enableFullscreen;
config.windowPosX = -1;
config.windowPosY = -1;
config.windowWidth = FB_WIDTH * 2;