This commit is contained in:
2025-10-27 18:35:53 +01:00
parent b1dca32a5b
commit 3179a08dac
63 changed files with 686 additions and 693 deletions

View File

@@ -1,11 +1,11 @@
#pragma once
#include <SDL3/SDL.h>
#include <stddef.h> // Para size_t
#include <memory> // Para shared_ptr, __shared_ptr_access
#include <string> // Para string
#include <vector> // Para vector
#include <cstddef> // Para size_t
#include <memory> // Para shared_ptr, __shared_ptr_access
#include <string> // Para string
#include <vector> // Para vector
#include "utils/utils.hpp" // Para Color
class Surface;
@@ -32,15 +32,14 @@ class Screen {
};
struct FPS {
Uint32 ticks; // Tiempo en milisegundos desde que se comenzó a contar.
int frame_count; // Número acumulado de frames en el intervalo.
int last_value; // Número de frames calculado en el último segundo.
Uint32 ticks{0}; // Tiempo en milisegundos desde que se comenzó a contar.
int frame_count{0}; // Número acumulado de frames en el intervalo.
int last_value{0}; // Número de frames calculado en el último segundo.
// Constructor para inicializar la estructura.
FPS()
: ticks(0),
frame_count(0),
last_value(0) {}
{}
// Incrementador que se llama en cada frame.
void increment() {
@@ -48,7 +47,7 @@ class Screen {
}
// Método para calcular y devolver el valor de FPS.
int calculate(Uint32 current_ticks) {
auto calculate(Uint32 current_ticks) -> int {
if (current_ticks - ticks >= 1000) // Si ha pasado un segundo o más.
{
last_value = frame_count; // Actualizamos el valor del último FPS.
@@ -114,7 +113,7 @@ class Screen {
void renderOverlays();
// Localiza la paleta dentro del vector de paletas
size_t findPalette(const std::string& name);
auto findPalette(const std::string& name) -> size_t;
void initShaders(); // Inicializa los shaders
void loadShaders(); // Carga el contenido del archivo GLSL
@@ -136,7 +135,7 @@ class Screen {
static void destroy();
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
static Screen* get();
static auto get() -> Screen*;
// Limpia el renderer
void clearRenderer(Color color = {0x00, 0x00, 0x00});
@@ -163,10 +162,10 @@ class Screen {
void toggleIntegerScale();
// Reduce el tamaño de la ventana
bool decWindowZoom();
auto decWindowZoom() -> bool;
// Aumenta el tamaño de la ventana
bool incWindowZoom();
auto incWindowZoom() -> bool;
// Cambia el color del borde
void setBorderColor(Uint8 color);
@@ -209,7 +208,7 @@ class Screen {
void toggleDebugInfo();
// Getters
SDL_Renderer* getRenderer();
std::shared_ptr<Surface> getRendererSurface();
std::shared_ptr<Surface> getBorderSurface();
auto getRenderer() -> SDL_Renderer*;
auto getRendererSurface() -> std::shared_ptr<Surface>;
auto getBorderSurface() -> std::shared_ptr<Surface>;
};