clang format

This commit is contained in:
2026-03-28 12:50:00 +01:00
parent 065f66d40e
commit b459e2106f
18 changed files with 18502 additions and 1962 deletions

View File

@@ -96,15 +96,17 @@ void RenderInfo::render() const {
.x = 0.0F, .x = 0.0F,
.y = static_cast<float>(Y), .y = static_cast<float>(Y),
.w = Options::game.width, .w = Options::game.width,
.h = static_cast<float>(TEXT_SIZE + (PADDING_V * 2)) .h = static_cast<float>(TEXT_SIZE + (PADDING_V * 2))};
};
auto game_surface = Screen::get()->getGameSurface(); auto game_surface = Screen::get()->getGameSurface();
game_surface->fillRect(&RECT, BG_COLOR); game_surface->fillRect(&RECT, BG_COLOR);
game_surface->drawRectBorder(&RECT, BORDER_COLOR); game_surface->drawRectBorder(&RECT, BORDER_COLOR);
text_obj->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, text_obj->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG,
static_cast<int>(Options::game.width / 2), static_cast<int>(Options::game.width / 2),
Y + PADDING_V, line, 1, MSG_COLOR); Y + PADDING_V,
line,
1,
MSG_COLOR);
} }
// Activa o desactiva el overlay y notifica a Notifier del cambio de offset // Activa o desactiva el overlay y notifica a Notifier del cambio de offset

View File

@@ -12,6 +12,7 @@
#include <string> // Para char_traits, string, operator+, operator== #include <string> // Para char_traits, string, operator+, operator==
#include "core/input/mouse.hpp" // Para updateCursorVisibility #include "core/input/mouse.hpp" // Para updateCursorVisibility
#include "core/rendering/render_info.hpp" // Para RenderInfo
#include "core/rendering/sdl3gpu/sdl3gpu_shader.hpp" // Para SDL3GPUShader #include "core/rendering/sdl3gpu/sdl3gpu_shader.hpp" // Para SDL3GPUShader
#include "core/rendering/surface.hpp" // Para Surface, readPalFile #include "core/rendering/surface.hpp" // Para Surface, readPalFile
#include "core/rendering/text.hpp" // Para Text #include "core/rendering/text.hpp" // Para Text
@@ -19,7 +20,6 @@
#include "core/resources/resource_helper.hpp" // Para ResourceHelper #include "core/resources/resource_helper.hpp" // Para ResourceHelper
#include "core/resources/resource_list.hpp" // Para Asset, AssetType #include "core/resources/resource_list.hpp" // Para Asset, AssetType
#include "game/options.hpp" // Para Options, options, OptionsVideo, Border #include "game/options.hpp" // Para Options, options, OptionsVideo, Border
#include "core/rendering/render_info.hpp" // Para RenderInfo
#include "game/ui/console.hpp" // Para Console #include "game/ui/console.hpp" // Para Console
#include "game/ui/notifier.hpp" // Para Notifier #include "game/ui/notifier.hpp" // Para Notifier
@@ -402,12 +402,14 @@ void Screen::textureToRenderer() {
// Franjas superior e inferior (ancho completo) // Franjas superior e inferior (ancho completo)
std::fill_n(border_pixel_buffer_.data(), OFF_Y * BORDER_W, border_argb_color_); std::fill_n(border_pixel_buffer_.data(), OFF_Y * BORDER_W, border_argb_color_);
std::fill_n(&border_pixel_buffer_[(OFF_Y + GAME_H) * BORDER_W], std::fill_n(&border_pixel_buffer_[(OFF_Y + GAME_H) * BORDER_W],
(BORDER_H - OFF_Y - GAME_H) * BORDER_W, border_argb_color_); (BORDER_H - OFF_Y - GAME_H) * BORDER_W,
border_argb_color_);
// Columnas laterales en las filas del área de juego // Columnas laterales en las filas del área de juego
for (int y = OFF_Y; y < OFF_Y + GAME_H; ++y) { for (int y = OFF_Y; y < OFF_Y + GAME_H; ++y) {
std::fill_n(&border_pixel_buffer_[y * BORDER_W], OFF_X, border_argb_color_); std::fill_n(&border_pixel_buffer_[y * BORDER_W], OFF_X, border_argb_color_);
std::fill_n(&border_pixel_buffer_[y * BORDER_W + OFF_X + GAME_W], std::fill_n(&border_pixel_buffer_[y * BORDER_W + OFF_X + GAME_W],
BORDER_W - OFF_X - GAME_W, border_argb_color_); BORDER_W - OFF_X - GAME_W,
border_argb_color_);
} }
} else { } else {
// Path B: borde dinámico (escena de carga — bandas de colores animadas) // Path B: borde dinámico (escena de carga — bandas de colores animadas)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -682,11 +682,7 @@ namespace Rendering {
: 1.0F; : 1.0F;
// ---- Determinar si usar el path Lanczos (SS activo + algo seleccionado) ---- // ---- Determinar si usar el path Lanczos (SS activo + algo seleccionado) ----
const bool USE_LANCZOS = (oversample_ > 1 && downscale_algo_ > 0 const bool USE_LANCZOS = (oversample_ > 1 && downscale_algo_ > 0 && scaled_texture_ != nullptr && postfx_texture_ != nullptr && postfx_offscreen_pipeline_ != nullptr && downscale_pipeline_ != nullptr);
&& scaled_texture_ != nullptr
&& postfx_texture_ != nullptr
&& postfx_offscreen_pipeline_ != nullptr
&& downscale_pipeline_ != nullptr);
if (USE_LANCZOS) { if (USE_LANCZOS) {
// ---- Pass A: PostFX → postfx_texture_ (full scaled size, sin viewport) ---- // ---- Pass A: PostFX → postfx_texture_ (full scaled size, sin viewport) ----
@@ -1029,14 +1025,20 @@ namespace Rendering {
scaled_texture_ = SDL_CreateGPUTexture(device_, &info); scaled_texture_ = SDL_CreateGPUTexture(device_, &info);
if (scaled_texture_ == nullptr) { if (scaled_texture_ == nullptr) {
SDL_Log("SDL3GPUShader: failed to create scaled texture %dx%d (factor %d): %s", SDL_Log("SDL3GPUShader: failed to create scaled texture %dx%d (factor %d): %s",
W, H, factor, SDL_GetError()); W,
H,
factor,
SDL_GetError());
return false; return false;
} }
postfx_texture_ = SDL_CreateGPUTexture(device_, &info); postfx_texture_ = SDL_CreateGPUTexture(device_, &info);
if (postfx_texture_ == nullptr) { if (postfx_texture_ == nullptr) {
SDL_Log("SDL3GPUShader: failed to create postfx texture %dx%d (factor %d): %s", SDL_Log("SDL3GPUShader: failed to create postfx texture %dx%d (factor %d): %s",
W, H, factor, SDL_GetError()); W,
H,
factor,
SDL_GetError());
SDL_ReleaseGPUTexture(device_, scaled_texture_); SDL_ReleaseGPUTexture(device_, scaled_texture_);
scaled_texture_ = nullptr; scaled_texture_ = nullptr;
return false; return false;

View File

@@ -1,59 +1,633 @@
#pragma once #pragma once
#include <cstdint>
#include <cstddef> #include <cstddef>
#include <cstdint>
static const uint8_t kupscale_frag_spv[] = { static const uint8_t kupscale_frag_spv[] = {
0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x00, 0x0d, 0x00, 0x03,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x02, 0x00, 0x02,
0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x23,
0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x73, 0x74, 0x64, 0x2e, 0x34, 0x35, 0x30, 0x07,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x01,
0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x0b,
0x02, 0x00, 0x00, 0x00, 0xc2, 0x01, 0x00, 0x00, 0x04, 0x00, 0x0a, 0x00, 0x00,
0x47, 0x4c, 0x5f, 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x45, 0x5f, 0x63, 0x70, 0x0d,
0x70, 0x5f, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x00,
0x5f, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x00, 0x00, 0x14,
0x04, 0x00, 0x08, 0x00, 0x47, 0x4c, 0x5f, 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x00,
0x45, 0x5f, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x64, 0x69, 0x00,
0x72, 0x65, 0x63, 0x74, 0x69, 0x76, 0x65, 0x00, 0x05, 0x00, 0x04, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x05, 0x00, 0x09, 0x00, 0x00, 0x00, 0x6f, 0x75, 0x74, 0x5f, 0x00,
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x04, 0x00, 0x00,
0x0d, 0x00, 0x00, 0x00, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00,
0x05, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, 0x76, 0x5f, 0x75, 0x76, 0x11,
0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x02,
0x0d, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x47, 0x00, 0x04, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01,
0x02, 0x00, 0x00, 0x00, 0x47, 0x00, 0x04, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x02, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0b,
0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x04, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x06,
0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
0x3b, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01,
0x03, 0x00, 0x00, 0x00, 0x19, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x47,
0x0a, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4c,
0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x53,
0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c,
0x17, 0x00, 0x04, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2e,
0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00, 0x10, 0x00, 0x00, 0x00, 0x73,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x04, 0x00, 0x74,
0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64,
0x36, 0x00, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x2e,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x02, 0x00, 0x34,
0x05, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x35,
0x0e, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x04, 0x00, 0x30,
0x0f, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00,
0x57, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x01, 0x00, 0x00,
0x38, 0x00, 0x01, 0x00 0x0e,
}; 0x00,
0x03,
0x00,
0x00,
0x00,
0x00,
0x00,
0x01,
0x00,
0x00,
0x00,
0x0f,
0x00,
0x07,
0x00,
0x04,
0x00,
0x00,
0x00,
0x04,
0x00,
0x00,
0x00,
0x6d,
0x61,
0x69,
0x6e,
0x00,
0x00,
0x00,
0x00,
0x09,
0x00,
0x00,
0x00,
0x11,
0x00,
0x00,
0x00,
0x10,
0x00,
0x03,
0x00,
0x04,
0x00,
0x00,
0x00,
0x07,
0x00,
0x00,
0x00,
0x03,
0x00,
0x03,
0x00,
0x02,
0x00,
0x00,
0x00,
0xc2,
0x01,
0x00,
0x00,
0x04,
0x00,
0x0a,
0x00,
0x47,
0x4c,
0x5f,
0x47,
0x4f,
0x4f,
0x47,
0x4c,
0x45,
0x5f,
0x63,
0x70,
0x70,
0x5f,
0x73,
0x74,
0x79,
0x6c,
0x65,
0x5f,
0x6c,
0x69,
0x6e,
0x65,
0x5f,
0x64,
0x69,
0x72,
0x65,
0x63,
0x74,
0x69,
0x76,
0x65,
0x00,
0x00,
0x04,
0x00,
0x08,
0x00,
0x47,
0x4c,
0x5f,
0x47,
0x4f,
0x4f,
0x47,
0x4c,
0x45,
0x5f,
0x69,
0x6e,
0x63,
0x6c,
0x75,
0x64,
0x65,
0x5f,
0x64,
0x69,
0x72,
0x65,
0x63,
0x74,
0x69,
0x76,
0x65,
0x00,
0x05,
0x00,
0x04,
0x00,
0x04,
0x00,
0x00,
0x00,
0x6d,
0x61,
0x69,
0x6e,
0x00,
0x00,
0x00,
0x00,
0x05,
0x00,
0x05,
0x00,
0x09,
0x00,
0x00,
0x00,
0x6f,
0x75,
0x74,
0x5f,
0x63,
0x6f,
0x6c,
0x6f,
0x72,
0x00,
0x00,
0x00,
0x05,
0x00,
0x04,
0x00,
0x0d,
0x00,
0x00,
0x00,
0x73,
0x63,
0x65,
0x6e,
0x65,
0x00,
0x00,
0x00,
0x05,
0x00,
0x04,
0x00,
0x11,
0x00,
0x00,
0x00,
0x76,
0x5f,
0x75,
0x76,
0x00,
0x00,
0x00,
0x00,
0x47,
0x00,
0x04,
0x00,
0x09,
0x00,
0x00,
0x00,
0x1e,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x47,
0x00,
0x04,
0x00,
0x0d,
0x00,
0x00,
0x00,
0x21,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x47,
0x00,
0x04,
0x00,
0x0d,
0x00,
0x00,
0x00,
0x22,
0x00,
0x00,
0x00,
0x02,
0x00,
0x00,
0x00,
0x47,
0x00,
0x04,
0x00,
0x11,
0x00,
0x00,
0x00,
0x1e,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x13,
0x00,
0x02,
0x00,
0x02,
0x00,
0x00,
0x00,
0x21,
0x00,
0x03,
0x00,
0x03,
0x00,
0x00,
0x00,
0x02,
0x00,
0x00,
0x00,
0x16,
0x00,
0x03,
0x00,
0x06,
0x00,
0x00,
0x00,
0x20,
0x00,
0x00,
0x00,
0x17,
0x00,
0x04,
0x00,
0x07,
0x00,
0x00,
0x00,
0x06,
0x00,
0x00,
0x00,
0x04,
0x00,
0x00,
0x00,
0x20,
0x00,
0x04,
0x00,
0x08,
0x00,
0x00,
0x00,
0x03,
0x00,
0x00,
0x00,
0x07,
0x00,
0x00,
0x00,
0x3b,
0x00,
0x04,
0x00,
0x08,
0x00,
0x00,
0x00,
0x09,
0x00,
0x00,
0x00,
0x03,
0x00,
0x00,
0x00,
0x19,
0x00,
0x09,
0x00,
0x0a,
0x00,
0x00,
0x00,
0x06,
0x00,
0x00,
0x00,
0x01,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x01,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x1b,
0x00,
0x03,
0x00,
0x0b,
0x00,
0x00,
0x00,
0x0a,
0x00,
0x00,
0x00,
0x20,
0x00,
0x04,
0x00,
0x0c,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x0b,
0x00,
0x00,
0x00,
0x3b,
0x00,
0x04,
0x00,
0x0c,
0x00,
0x00,
0x00,
0x0d,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x17,
0x00,
0x04,
0x00,
0x0f,
0x00,
0x00,
0x00,
0x06,
0x00,
0x00,
0x00,
0x02,
0x00,
0x00,
0x00,
0x20,
0x00,
0x04,
0x00,
0x10,
0x00,
0x00,
0x00,
0x01,
0x00,
0x00,
0x00,
0x0f,
0x00,
0x00,
0x00,
0x3b,
0x00,
0x04,
0x00,
0x10,
0x00,
0x00,
0x00,
0x11,
0x00,
0x00,
0x00,
0x01,
0x00,
0x00,
0x00,
0x36,
0x00,
0x05,
0x00,
0x02,
0x00,
0x00,
0x00,
0x04,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x03,
0x00,
0x00,
0x00,
0xf8,
0x00,
0x02,
0x00,
0x05,
0x00,
0x00,
0x00,
0x3d,
0x00,
0x04,
0x00,
0x0b,
0x00,
0x00,
0x00,
0x0e,
0x00,
0x00,
0x00,
0x0d,
0x00,
0x00,
0x00,
0x3d,
0x00,
0x04,
0x00,
0x0f,
0x00,
0x00,
0x00,
0x12,
0x00,
0x00,
0x00,
0x11,
0x00,
0x00,
0x00,
0x57,
0x00,
0x05,
0x00,
0x07,
0x00,
0x00,
0x00,
0x13,
0x00,
0x00,
0x00,
0x0e,
0x00,
0x00,
0x00,
0x12,
0x00,
0x00,
0x00,
0x3e,
0x00,
0x03,
0x00,
0x09,
0x00,
0x00,
0x00,
0x13,
0x00,
0x00,
0x00,
0xfd,
0x00,
0x01,
0x00,
0x38,
0x00,
0x01,
0x00};
static const size_t kupscale_frag_spv_size = 628; static const size_t kupscale_frag_spv_size = 628;

View File

@@ -533,7 +533,9 @@ namespace Options {
const auto& a = yaml["audio"]; const auto& a = yaml["audio"];
if (a.contains("enabled")) { if (a.contains("enabled")) {
try { audio.enabled = a["enabled"].get_value<bool>(); } catch (...) {} try {
audio.enabled = a["enabled"].get_value<bool>();
} catch (...) {}
} }
if (a.contains("volume")) { if (a.contains("volume")) {
try { try {
@@ -543,7 +545,9 @@ namespace Options {
if (a.contains("music")) { if (a.contains("music")) {
const auto& m = a["music"]; const auto& m = a["music"];
if (m.contains("enabled")) { if (m.contains("enabled")) {
try { audio.music.enabled = m["enabled"].get_value<bool>(); } catch (...) {} try {
audio.music.enabled = m["enabled"].get_value<bool>();
} catch (...) {}
} }
if (m.contains("volume")) { if (m.contains("volume")) {
try { try {
@@ -554,7 +558,9 @@ namespace Options {
if (a.contains("sound")) { if (a.contains("sound")) {
const auto& s = a["sound"]; const auto& s = a["sound"];
if (s.contains("enabled")) { if (s.contains("enabled")) {
try { audio.sound.enabled = s["enabled"].get_value<bool>(); } catch (...) {} try {
audio.sound.enabled = s["enabled"].get_value<bool>();
} catch (...) {}
} }
if (s.contains("volume")) { if (s.contains("volume")) {
try { try {

View File

@@ -8,13 +8,13 @@
#include <vector> // Para vector #include <vector> // Para vector
#include "core/audio/audio.hpp" // Para Audio #include "core/audio/audio.hpp" // Para Audio
#include "core/rendering/render_info.hpp" // Para RenderInfo
#include "core/rendering/screen.hpp" // Para Screen #include "core/rendering/screen.hpp" // Para Screen
#include "core/rendering/sprite/sprite.hpp" // Para Sprite #include "core/rendering/sprite/sprite.hpp" // Para Sprite
#include "core/rendering/surface.hpp" // Para Surface #include "core/rendering/surface.hpp" // Para Surface
#include "core/rendering/text.hpp" // Para Text #include "core/rendering/text.hpp" // Para Text
#include "core/resources/resource_cache.hpp" // Para Resource #include "core/resources/resource_cache.hpp" // Para Resource
#include "game/options.hpp" // Para Options #include "game/options.hpp" // Para Options
#include "core/rendering/render_info.hpp" // Para RenderInfo
#include "game/scene_manager.hpp" // Para SceneManager #include "game/scene_manager.hpp" // Para SceneManager
#include "game/ui/notifier.hpp" // Para Notifier #include "game/ui/notifier.hpp" // Para Notifier
@@ -54,11 +54,13 @@ static auto parseTokens(const std::string& input) -> std::vector<std::string> {
} \ } \
if (args[0] == "ON") { \ if (args[0] == "ON") { \
if (getter) { return label " already ON"; } \ if (getter) { return label " already ON"; } \
(toggle_fn); return label " ON"; \ (toggle_fn); \
return label " ON"; \
} \ } \
if (args[0] == "OFF") { \ if (args[0] == "OFF") { \
if (!(getter)) { return label " already OFF"; } \ if (!(getter)) { return label " already OFF"; } \
(toggle_fn); return label " OFF"; \ (toggle_fn); \
return label " OFF"; \
} \ } \
return "Usage: " label " [ON|OFF]"; \ return "Usage: " label " [ON|OFF]"; \
} }
@@ -92,9 +94,7 @@ static void printHelp() {
// Tabla de comandos disponibles // Tabla de comandos disponibles
static const std::vector<ConsoleCommand> COMMANDS = { static const std::vector<ConsoleCommand> COMMANDS = {
// SS [ON|OFF] — Supersampling (Ctrl+F4) // SS [ON|OFF] — Supersampling (Ctrl+F4)
{.keyword = "SS", .execute = BOOL_TOGGLE_CMD("Supersampling", {.keyword = "SS", .execute = BOOL_TOGGLE_CMD("Supersampling", Options::video.supersampling, Screen::get()->toggleSupersampling())},
Options::video.supersampling,
Screen::get()->toggleSupersampling())},
// POSTFX [ON|OFF|NEXT] — PostFX y presets (F4 / Shift+F4) // POSTFX [ON|OFF|NEXT] — PostFX y presets (F4 / Shift+F4)
{.keyword = "POSTFX", .execute = [](const std::vector<std::string>& args) -> std::string { {.keyword = "POSTFX", .execute = [](const std::vector<std::string>& args) -> std::string {
@@ -104,11 +104,13 @@ static const std::vector<ConsoleCommand> COMMANDS = {
} }
if (args[0] == "ON") { if (args[0] == "ON") {
if (Options::video.postfx) { return "PostFX already ON"; } if (Options::video.postfx) { return "PostFX already ON"; }
Screen::get()->togglePostFX(); return "PostFX ON"; Screen::get()->togglePostFX();
return "PostFX ON";
} }
if (args[0] == "OFF") { if (args[0] == "OFF") {
if (!Options::video.postfx) { return "PostFX already OFF"; } if (!Options::video.postfx) { return "PostFX already OFF"; }
Screen::get()->togglePostFX(); return "PostFX OFF"; Screen::get()->togglePostFX();
return "PostFX OFF";
} }
if (args[0] == "NEXT") { if (args[0] == "NEXT") {
if (Options::postfx_presets.empty()) { return "No presets available"; } if (Options::postfx_presets.empty()) { return "No presets available"; }
@@ -123,9 +125,7 @@ static const std::vector<ConsoleCommand> COMMANDS = {
}}, }},
// BORDER [ON|OFF] — Borde decorativo (B) // BORDER [ON|OFF] — Borde decorativo (B)
{.keyword = "BORDER", .execute = BOOL_TOGGLE_CMD("Border", {.keyword = "BORDER", .execute = BOOL_TOGGLE_CMD("Border", Options::video.border.enabled, Screen::get()->toggleBorder())},
Options::video.border.enabled,
Screen::get()->toggleBorder())},
// FULLSCREEN [ON|OFF [PLEASE]] — Pantalla completa (F3); OFF bloqueado en kiosk sin PLEASE // FULLSCREEN [ON|OFF [PLEASE]] — Pantalla completa (F3); OFF bloqueado en kiosk sin PLEASE
{.keyword = "FULLSCREEN", .execute = [](const std::vector<std::string>& args) -> std::string { {.keyword = "FULLSCREEN", .execute = [](const std::vector<std::string>& args) -> std::string {
@@ -140,11 +140,13 @@ static const std::vector<ConsoleCommand> COMMANDS = {
} }
if (EXPLICIT_ON) { if (EXPLICIT_ON) {
if (Options::video.fullscreen) { return "Fullscreen already ON"; } if (Options::video.fullscreen) { return "Fullscreen already ON"; }
Screen::get()->toggleVideoMode(); return "Fullscreen ON"; Screen::get()->toggleVideoMode();
return "Fullscreen ON";
} }
if (EXPLICIT_OFF) { if (EXPLICIT_OFF) {
if (!Options::video.fullscreen) { return "Fullscreen already OFF"; } if (!Options::video.fullscreen) { return "Fullscreen already OFF"; }
Screen::get()->toggleVideoMode(); return "Fullscreen OFF"; Screen::get()->toggleVideoMode();
return "Fullscreen OFF";
} }
if (IS_TOGGLE) { if (IS_TOGGLE) {
Screen::get()->toggleVideoMode(); Screen::get()->toggleVideoMode();
@@ -190,11 +192,13 @@ static const std::vector<ConsoleCommand> COMMANDS = {
} }
if (args[0] == "NEAREST") { if (args[0] == "NEAREST") {
if (!Options::video.linear_upscale) { return "Upscale already Nearest"; } if (!Options::video.linear_upscale) { return "Upscale already Nearest"; }
Screen::get()->setLinearUpscale(false); return "Upscale: Nearest"; Screen::get()->setLinearUpscale(false);
return "Upscale: Nearest";
} }
if (args[0] == "LINEAR") { if (args[0] == "LINEAR") {
if (Options::video.linear_upscale) { return "Upscale already Linear"; } if (Options::video.linear_upscale) { return "Upscale already Linear"; }
Screen::get()->setLinearUpscale(true); return "Upscale: Linear"; Screen::get()->setLinearUpscale(true);
return "Upscale: Linear";
} }
return "Usage: UPSCALE [NEAREST|LINEAR]"; return "Usage: UPSCALE [NEAREST|LINEAR]";
}}, }},
@@ -218,9 +222,7 @@ static const std::vector<ConsoleCommand> COMMANDS = {
}}, }},
// VSYNC [ON|OFF] — Sincronización vertical // VSYNC [ON|OFF] — Sincronización vertical
{.keyword = "VSYNC", .execute = BOOL_TOGGLE_CMD("VSync", {.keyword = "VSYNC", .execute = BOOL_TOGGLE_CMD("VSync", Options::video.vertical_sync, Screen::get()->toggleVSync())},
Options::video.vertical_sync,
Screen::get()->toggleVSync())},
// DRIVER [LIST|AUTO|<nombre>] — Driver GPU (aplica en el próximo arranque) // DRIVER [LIST|AUTO|<nombre>] — Driver GPU (aplica en el próximo arranque)
{.keyword = "DRIVER", .execute = [](const std::vector<std::string>& args) -> std::string { {.keyword = "DRIVER", .execute = [](const std::vector<std::string>& args) -> std::string {
@@ -294,20 +296,20 @@ static const std::vector<ConsoleCommand> COMMANDS = {
#ifdef _DEBUG #ifdef _DEBUG
// DEBUG [ON|OFF] — Overlay de debug (F12, solo en builds debug) // DEBUG [ON|OFF] — Overlay de debug (F12, solo en builds debug)
{.keyword = "DEBUG", .execute = BOOL_TOGGLE_CMD("Debug overlay", {.keyword = "DEBUG", .execute = BOOL_TOGGLE_CMD("Debug overlay", RenderInfo::get()->isActive(), RenderInfo::get()->toggle())},
RenderInfo::get()->isActive(),
RenderInfo::get()->toggle())},
// SHOW FPS / HIDE FPS — Aliases de DEBUG ON / DEBUG OFF // SHOW FPS / HIDE FPS — Aliases de DEBUG ON / DEBUG OFF
{.keyword = "SHOW", .execute = [](const std::vector<std::string>& args) -> std::string { {.keyword = "SHOW", .execute = [](const std::vector<std::string>& args) -> std::string {
if (args.empty() || args[0] != "FPS") { return "Usage: SHOW FPS"; } if (args.empty() || args[0] != "FPS") { return "Usage: SHOW FPS"; }
if (RenderInfo::get()->isActive()) { return "Debug overlay already ON"; } if (RenderInfo::get()->isActive()) { return "Debug overlay already ON"; }
RenderInfo::get()->toggle(); return "Debug overlay ON"; RenderInfo::get()->toggle();
return "Debug overlay ON";
}}, }},
{.keyword = "HIDE", .execute = [](const std::vector<std::string>& args) -> std::string { {.keyword = "HIDE", .execute = [](const std::vector<std::string>& args) -> std::string {
if (args.empty() || args[0] != "FPS") { return "Usage: HIDE FPS"; } if (args.empty() || args[0] != "FPS") { return "Usage: HIDE FPS"; }
if (!RenderInfo::get()->isActive()) { return "Debug overlay already OFF"; } if (!RenderInfo::get()->isActive()) { return "Debug overlay already OFF"; }
RenderInfo::get()->toggle(); return "Debug overlay OFF"; RenderInfo::get()->toggle();
return "Debug overlay OFF";
}}, }},
#endif #endif
@@ -489,10 +491,12 @@ static const std::vector<ConsoleCommand> COMMANDS = {
// HELP / ? — Muestra ayuda en la terminal del sistema // HELP / ? — Muestra ayuda en la terminal del sistema
{.keyword = "HELP", .execute = [](const std::vector<std::string>&) -> std::string { {.keyword = "HELP", .execute = [](const std::vector<std::string>&) -> std::string {
printHelp(); return "Help printed to terminal"; printHelp();
return "Help printed to terminal";
}}, }},
{.keyword = "?", .execute = [](const std::vector<std::string>&) -> std::string { {.keyword = "?", .execute = [](const std::vector<std::string>&) -> std::string {
printHelp(); return "Help printed to terminal"; printHelp();
return "Help printed to terminal";
}}, }},
}; };