Working on minor stuff, arts, settings, cutscenes

This commit is contained in:
Vladislav Khorev committed 2026-07-04 17:33:01 +03:00
1 parent 5516d02e2c
commit f7e63f933b
31 files changed
+237 -1881

No files matched your search

+22
View File
@@ -360,9 +360,17 @@ namespace ZL {
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
};
auto refreshFullscreenToggle = [this]() {
const bool on = Environment::isFullscreen;
uiManager.setTextButtonText("fullScreenToggleButton", on ? "Full Screen: ON" : "Full Screen: OFF");
uiManager.setTextButtonColor("fullScreenToggleButton", on
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
};
refreshMusicToggle();
refreshSoundToggle();
refreshFullscreenToggle();
uiManager.setTextButtonCallback("musicToggleButton", [this](const std::string&) {
audioPlayer_.setMusicEnabled(!audioPlayer_.isMusicEnabled());
@@ -380,6 +388,10 @@ namespace ZL {
? std::array<float, 4>{ 0.2f, 0.9f, 0.2f, 1.0f }
: std::array<float, 4>{ 0.9f, 0.2f, 0.2f, 1.0f });
});
uiManager.setTextButtonCallback("fullScreenToggleButton", [this, refreshFullscreenToggle](const std::string&) {
Environment::setFullscreen(!Environment::isFullscreen);
refreshFullscreenToggle();
});
}
void MenuManager::showLoadGameScreen()
@@ -1783,6 +1795,7 @@ namespace ZL {
root["soundVolume"] = audioPlayer_.getSoundVolume();
root["musicEnabled"] = audioPlayer_.isMusicEnabled();
root["soundEnabled"] = audioPlayer_.isSoundEnabled();
root["fullscreen"] = Environment::isFullscreen;
std::ofstream file("settings.json");
if (file.is_open()) {
@@ -1793,6 +1806,10 @@ namespace ZL {
}
void MenuManager::loadSettings() {
// Note: on desktop, main() already reads settings.json and creates the window
// directly in the right fullscreen state (see WIN32 main() in main.cpp) to avoid
// a windowed -> fullscreen flash. The block below just keeps Environment::isFullscreen
// in sync in case this is ever called from a path that didn't pre-apply it.
const std::string content = ZL::readTextFile("settings.json");
if (content.empty()) return;
try {
@@ -1805,6 +1822,11 @@ namespace ZL {
audioPlayer_.setMusicEnabled(root["musicEnabled"].get<bool>());
if (root.contains("soundEnabled"))
audioPlayer_.setSoundEnabled(root["soundEnabled"].get<bool>());
if (root.contains("fullscreen")) {
#ifndef EMSCRIPTEN
Environment::setFullscreen(root["fullscreen"].get<bool>());
#endif
}
} catch (const std::exception& e) {
std::cerr << "[settings] Failed to parse settings.json: " << e.what() << std::endl;
}