Files
aee/source/game/options.hpp

82 lines
2.8 KiB
C++

#pragma once
#include <string>
#include "game/defaults.hpp"
#include "game/defines.hpp"
namespace Options {
// Tecles GUI (finestra, zoom, shaders)
struct KeysGUI {
SDL_Scancode dec_zoom{Defaults::KeysGUI::DEC_ZOOM};
SDL_Scancode inc_zoom{Defaults::KeysGUI::INC_ZOOM};
SDL_Scancode fullscreen{Defaults::KeysGUI::FULLSCREEN};
SDL_Scancode toggle_shader{Defaults::KeysGUI::TOGGLE_SHADER};
SDL_Scancode toggle_aspect_ratio{Defaults::KeysGUI::TOGGLE_ASPECT_RATIO};
SDL_Scancode toggle_supersampling{Defaults::KeysGUI::TOGGLE_SUPERSAMPLING};
SDL_Scancode next_shader{Defaults::KeysGUI::NEXT_SHADER};
SDL_Scancode next_shader_preset{Defaults::KeysGUI::NEXT_SHADER_PRESET};
SDL_Scancode toggle_stretch_filter{Defaults::KeysGUI::TOGGLE_STRETCH_FILTER};
};
// Tecles de joc (moviment, accions)
struct KeysGame {
SDL_Scancode up{Defaults::KeysGame::UP};
SDL_Scancode down{Defaults::KeysGame::DOWN};
SDL_Scancode left{Defaults::KeysGame::LEFT};
SDL_Scancode right{Defaults::KeysGame::RIGHT};
SDL_Scancode exit{Defaults::KeysGame::EXIT};
};
// Opcions de vídeo
struct Video {
bool gpu_acceleration{Defaults::Video::GPU_ACCELERATION};
bool shader_enabled{Defaults::Video::SHADER_ENABLED};
bool supersampling{Defaults::Video::SUPERSAMPLING};
bool integer_scale{Defaults::Video::INTEGER_SCALE};
bool aspect_ratio_4_3{Defaults::Video::ASPECT_RATIO_4_3};
bool stretch_filter_linear{Defaults::Video::STRETCH_FILTER_LINEAR};
int downscale_algo{Defaults::Video::DOWNSCALE_ALGO};
bool linear_upscale{Defaults::Video::LINEAR_UPSCALE};
};
// Opcions d'àudio
struct Audio {
bool music_enabled{Defaults::Audio::MUSIC_ENABLED};
float music_volume{Defaults::Audio::MUSIC_VOLUME};
bool sound_enabled{Defaults::Audio::SOUND_ENABLED};
float sound_volume{Defaults::Audio::SOUND_VOLUME};
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};
int piramide_inicial{Defaults::Game::PIRAMIDE_INICIAL};
int vides{Defaults::Game::VIDES};
};
// --- Variables globals ---
inline std::string version{};
inline KeysGUI keys_gui{};
inline KeysGame keys_game{};
inline Video video{};
inline Audio audio{};
inline Window window{};
inline Game game{};
inline std::string config_file_path{};
// --- API ---
void setConfigFile(const std::string& path);
auto loadFromFile() -> bool;
auto saveToFile() -> bool;
} // namespace Options