treballant en sdl3gpu
This commit is contained in:
@@ -2,11 +2,16 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
// Tecles GUI (capa de presentació — finestra, zoom, etc.)
|
||||
// Tecles GUI (capa de presentació — finestra, zoom, shaders, etc.)
|
||||
namespace Defaults::KeysGUI {
|
||||
constexpr SDL_Scancode DEC_ZOOM = SDL_SCANCODE_F1;
|
||||
constexpr SDL_Scancode INC_ZOOM = SDL_SCANCODE_F2;
|
||||
constexpr SDL_Scancode FULLSCREEN = SDL_SCANCODE_F3;
|
||||
constexpr SDL_Scancode TOGGLE_SHADER = SDL_SCANCODE_F4;
|
||||
constexpr SDL_Scancode TOGGLE_ASPECT_RATIO = SDL_SCANCODE_F5;
|
||||
constexpr SDL_Scancode TOGGLE_SUPERSAMPLING = SDL_SCANCODE_F6;
|
||||
constexpr SDL_Scancode NEXT_SHADER = SDL_SCANCODE_F7;
|
||||
constexpr SDL_Scancode NEXT_SHADER_PRESET = SDL_SCANCODE_F8;
|
||||
} // namespace Defaults::KeysGUI
|
||||
|
||||
// Tecles de joc (moviment del personatge, accions)
|
||||
@@ -18,6 +23,16 @@ namespace Defaults::KeysGame {
|
||||
constexpr SDL_Scancode EXIT = SDL_SCANCODE_ESCAPE;
|
||||
} // namespace Defaults::KeysGame
|
||||
|
||||
namespace Defaults::Video {
|
||||
constexpr bool GPU_ACCELERATION = true;
|
||||
constexpr bool SHADER_ENABLED = false;
|
||||
constexpr bool SUPERSAMPLING = false;
|
||||
constexpr bool INTEGER_SCALE = true;
|
||||
constexpr bool ASPECT_RATIO_4_3 = true; // CRT original estira 200→240
|
||||
constexpr int DOWNSCALE_ALGO = 1; // 0=bilinear, 1=Lanczos2, 2=Lanczos3
|
||||
constexpr bool LINEAR_UPSCALE = false;
|
||||
} // namespace Defaults::Video
|
||||
|
||||
namespace Defaults::Audio {
|
||||
constexpr float VOLUME = 1.0F;
|
||||
constexpr bool MUSIC_ENABLED = true;
|
||||
|
||||
@@ -41,6 +41,26 @@ namespace Options {
|
||||
}
|
||||
}
|
||||
|
||||
static void loadVideoConfigFromYaml(const fkyaml::node& yaml) {
|
||||
if (!yaml.contains("video")) return;
|
||||
const auto& node = yaml["video"];
|
||||
|
||||
if (node.contains("gpu_acceleration"))
|
||||
video.gpu_acceleration = node["gpu_acceleration"].get_value<bool>();
|
||||
if (node.contains("shader_enabled"))
|
||||
video.shader_enabled = node["shader_enabled"].get_value<bool>();
|
||||
if (node.contains("supersampling"))
|
||||
video.supersampling = node["supersampling"].get_value<bool>();
|
||||
if (node.contains("integer_scale"))
|
||||
video.integer_scale = node["integer_scale"].get_value<bool>();
|
||||
if (node.contains("aspect_ratio_4_3"))
|
||||
video.aspect_ratio_4_3 = node["aspect_ratio_4_3"].get_value<bool>();
|
||||
if (node.contains("downscale_algo"))
|
||||
video.downscale_algo = node["downscale_algo"].get_value<int>();
|
||||
if (node.contains("linear_upscale"))
|
||||
video.linear_upscale = node["linear_upscale"].get_value<bool>();
|
||||
}
|
||||
|
||||
static void loadWindowConfigFromYaml(const fkyaml::node& yaml) {
|
||||
if (!yaml.contains("window")) return;
|
||||
const auto& node = yaml["window"];
|
||||
@@ -94,6 +114,7 @@ namespace Options {
|
||||
return true;
|
||||
}
|
||||
|
||||
loadVideoConfigFromYaml(yaml);
|
||||
loadWindowConfigFromYaml(yaml);
|
||||
loadAudioConfigFromYaml(yaml);
|
||||
loadGameConfigFromYaml(yaml);
|
||||
@@ -129,6 +150,18 @@ namespace Options {
|
||||
file << "version: \"" << Texts::VERSION << "\"\n";
|
||||
file << "\n";
|
||||
|
||||
// VIDEO
|
||||
file << "# VIDEO\n";
|
||||
file << "video:\n";
|
||||
file << " gpu_acceleration: " << (video.gpu_acceleration ? "true" : "false") << "\n";
|
||||
file << " shader_enabled: " << (video.shader_enabled ? "true" : "false") << "\n";
|
||||
file << " supersampling: " << (video.supersampling ? "true" : "false") << "\n";
|
||||
file << " integer_scale: " << (video.integer_scale ? "true" : "false") << "\n";
|
||||
file << " aspect_ratio_4_3: " << (video.aspect_ratio_4_3 ? "true" : "false") << "\n";
|
||||
file << " downscale_algo: " << video.downscale_algo << " # 0=bilinear, 1=Lanczos2, 2=Lanczos3\n";
|
||||
file << " linear_upscale: " << (video.linear_upscale ? "true" : "false") << "\n";
|
||||
file << "\n";
|
||||
|
||||
// WINDOW
|
||||
file << "# WINDOW\n";
|
||||
file << "window:\n";
|
||||
|
||||
@@ -7,11 +7,16 @@
|
||||
|
||||
namespace Options {
|
||||
|
||||
// Tecles GUI (finestra, zoom)
|
||||
// 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};
|
||||
};
|
||||
|
||||
// Tecles de joc (moviment, accions)
|
||||
@@ -23,6 +28,17 @@ namespace Options {
|
||||
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};
|
||||
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};
|
||||
@@ -49,6 +65,7 @@ namespace Options {
|
||||
inline std::string version{};
|
||||
inline KeysGUI keys_gui{};
|
||||
inline KeysGame keys_game{};
|
||||
inline Video video{};
|
||||
inline Audio audio{};
|
||||
inline Window window{};
|
||||
inline Game game{};
|
||||
|
||||
Reference in New Issue
Block a user