ja tenim el control de la finestra i de la imatge

treballant en les tecles de funcio
This commit is contained in:
2026-04-04 17:20:28 +02:00
parent baee62b375
commit abb23071b5
16 changed files with 249 additions and 318 deletions

View File

@@ -8,6 +8,11 @@ namespace Defaults::Audio {
constexpr float SOUND_VOLUME = 1.0F;
} // namespace Defaults::Audio
namespace Defaults::Window {
constexpr int ZOOM = 3;
constexpr bool FULLSCREEN = false;
} // namespace Defaults::Window
namespace Defaults::Game {
constexpr int HABITACIO_INICIAL = 1;
constexpr int PIRAMIDE_INICIAL = 255;

View File

@@ -2,13 +2,13 @@
// Textos
namespace Texts {
constexpr const char* WINDOW_TITLE = "Aventures En Egipte";
constexpr const char* WINDOW_TITLE = "© 2000 Aventures en Egipte — JailDesigner";
constexpr const char* VERSION = "1.00";
} // namespace Texts
// Resolución del juego
namespace Screen {
namespace GameScreen {
constexpr int WIDTH = 320;
constexpr int HEIGHT = 200;
constexpr int BUFFER_SIZE = WIDTH * HEIGHT; // 64000
} // namespace Screen
} // namespace GameScreen

View File

@@ -41,6 +41,16 @@ namespace Options {
}
}
static void loadWindowConfigFromYaml(const fkyaml::node& yaml) {
if (!yaml.contains("window")) return;
const auto& node = yaml["window"];
if (node.contains("zoom"))
window.zoom = node["zoom"].get_value<int>();
if (node.contains("fullscreen"))
window.fullscreen = node["fullscreen"].get_value<bool>();
}
static void loadGameConfigFromYaml(const fkyaml::node& yaml) {
if (!yaml.contains("game")) return;
const auto& node = yaml["game"];
@@ -84,6 +94,7 @@ namespace Options {
return true;
}
loadWindowConfigFromYaml(yaml);
loadAudioConfigFromYaml(yaml);
loadGameConfigFromYaml(yaml);
@@ -118,6 +129,13 @@ namespace Options {
file << "version: \"" << Texts::VERSION << "\"\n";
file << "\n";
// WINDOW
file << "# WINDOW\n";
file << "window:\n";
file << " zoom: " << window.zoom << "\n";
file << " fullscreen: " << (window.fullscreen ? "true" : "false") << "\n";
file << "\n";
// AUDIO
file << "# AUDIO\n";
file << "audio:\n";

View File

@@ -16,6 +16,12 @@ namespace Options {
float volume{Defaults::Audio::VOLUME};
};
// Opcions de finestra
struct Window {
int zoom{Defaults::Window::ZOOM};
bool fullscreen{Defaults::Window::FULLSCREEN};
};
// Opcions de joc
struct Game {
int habitacio_inicial{Defaults::Game::HABITACIO_INICIAL};
@@ -26,6 +32,7 @@ namespace Options {
// --- Variables globals ---
inline std::string version{};
inline Audio audio{};
inline Window window{};
inline Game game{};
inline std::string config_file_path{};