renombrades extensions .h a .hpp

This commit is contained in:
2025-10-17 21:45:19 +02:00
parent 50ccb2ccc2
commit 46974ef2eb
144 changed files with 1758 additions and 1783 deletions

View File

@@ -1,4 +1,4 @@
#include "screen.h"
#include "screen.hpp"
#include <SDL3/SDL.h> // Para SDL_SetRenderTarget, SDL_LogCategory, SDL_LogInfo, SDL_RenderTexture, SDL_SetRenderDrawColor, SDL_SetRenderVSync, SDL_GetError, SDL_LogError, SDL_RendererLogicalPresentation, SDL_SetRenderLogicalPresentation, SDL_CreateTexture, SDL_DestroyTexture, SDL_DestroyWindow, SDL_GetTicks, SDL_Quit, SDL_RENDERER_VSYNC_DISABLED, SDL_RenderClear, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyRenderer, SDL_DisplayID, SDL_FRect, SDL_GetCurrentDisplayMode, SDL_GetDisplayName, SDL_GetDisplays, SDL_GetRenderTarget, SDL_GetWindowPosition, SDL_GetWindowSize, SDL_Init, SDL_LogWarn, SDL_PixelFormat, SDL_RenderFillRect, SDL_RenderPresent, SDL_SetHint, SDL_SetRenderDrawBlendMode, SDL_SetTextureScaleMode, SDL_SetWindowFullscreen, SDL_SetWindowPosition, SDL_SetWindowSize, SDL_TextureAccess, SDL_free, SDL_BLENDMODE_BLEND, SDL_HINT_RENDER_DRIVER, SDL_INIT_VIDEO, SDL_PRIu32, SDL_ScaleMode, SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WindowFlags
@@ -8,19 +8,19 @@
#include <memory> // Para allocator, shared_ptr, make_shared, __shared_ptr_access
#include <string> // Para operator+, char_traits, to_string, string
#include "asset.h" // Para Asset
#include "mouse.h" // Para updateCursorVisibility
#include "rendering/opengl/opengl_shader.h" // Para OpenGLShader
#include "options.h" // Para VideoOptions, video, WindowOptions, window
#include "param.h" // Para Param, param, ParamGame, ParamDebug
#include "text.h" // Para Text, Text::COLOR, Text::STROKE
#include "texture.h" // Para Texture
#include "ui/notifier.h" // Para Notifier
#include "ui/service_menu.h" // Para ServiceMenu
#include "utils.h" // Para Zone
#include "asset.hpp" // Para Asset
#include "mouse.hpp" // Para updateCursorVisibility
#include "options.hpp" // Para VideoOptions, video, WindowOptions, window
#include "param.hpp" // Para Param, param, ParamGame, ParamDebug
#include "rendering/opengl/opengl_shader.hpp" // Para OpenGLShader
#include "text.hpp" // Para Text, Text::COLOR, Text::STROKE
#include "texture.hpp" // Para Texture
#include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.hpp" // Para Zone
// Singleton
Screen *Screen::instance = nullptr;
Screen* Screen::instance = nullptr;
// Inicializa la instancia única del singleton
void Screen::init() { Screen::instance = new Screen(); }
@@ -29,7 +29,7 @@ void Screen::init() { Screen::instance = new Screen(); }
void Screen::destroy() { delete Screen::instance; }
// Obtiene la instancia
auto Screen::get() -> Screen * { return Screen::instance; }
auto Screen::get() -> Screen* { return Screen::instance; }
// Constructor
Screen::Screen()
@@ -189,10 +189,10 @@ void Screen::renderFlash() {
void Screen::renderShake() {
if (shake_effect_.enabled) {
// Guarda el renderizador actual para dejarlo despues como estaba
auto *current_target = SDL_GetRenderTarget(renderer_);
auto* current_target = SDL_GetRenderTarget(renderer_);
// Crea una textura temporal
auto *temp_texture = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height);
auto* temp_texture = SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height);
// Vuelca game_canvas_ a la textura temporal
SDL_SetRenderTarget(renderer_, temp_texture);
@@ -221,7 +221,7 @@ void Screen::renderInfo() {
debug_info_.text->writeDX(Text::COLOR | Text::STROKE, param.game.width - debug_info_.text->length(FPS_TEXT) - 2, 1 + debug_info_.text->getCharacterSize(), FPS_TEXT, 1, param.debug.color, 1, param.debug.color.DARKEN(150));
#ifdef RECORDING
// RECORDING
debug_info_.text->writeDX(Text::COLOR | Text::STROKE, param.game.width - debug_info_.text->length("RECORDING"), 2*(1 + debug_info_.text->getCharacterSize()), "RECORDING", 1, param.debug.color, 1, param.debug.color.DARKEN(150));
debug_info_.text->writeDX(Text::COLOR | Text::STROKE, param.game.width - debug_info_.text->length("RECORDING"), 2 * (1 + debug_info_.text->getCharacterSize()), "RECORDING", 1, param.debug.color, 1, param.debug.color.DARKEN(150));
#endif
}
}
@@ -239,10 +239,10 @@ void Screen::loadShaders() {
VERTEX_FILE = "crtpi_vertex.glsl";
data = Asset::get()->loadData(VERTEX_FILE);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Usando shaders OpenGL Desktop 3.3");
"Usando shaders OpenGL Desktop 3.3");
} else {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Usando shaders OpenGL ES 3.0 (Raspberry Pi)");
"Usando shaders OpenGL ES 3.0 (Raspberry Pi)");
}
if (!data.empty()) {
@@ -280,7 +280,7 @@ void Screen::initShaders() {
// En macOS, OpenGL está deprecated y rinde mal
// TODO: Implementar backend de Metal para shaders en macOS
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.");
"Shaders no disponibles en macOS (OpenGL deprecated). Usa Metal backend.");
#endif
}
@@ -415,19 +415,19 @@ auto Screen::initSDLVideo() -> bool {
void Screen::getDisplayInfo() {
int i;
int num_displays = 0;
SDL_DisplayID *displays = SDL_GetDisplays(&num_displays);
SDL_DisplayID* displays = SDL_GetDisplays(&num_displays);
if (displays != nullptr) {
for (i = 0; i < num_displays; ++i) {
SDL_DisplayID instance_id = displays[i];
const char *name = SDL_GetDisplayName(instance_id);
const char* name = SDL_GetDisplayName(instance_id);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Display %" SDL_PRIu32 ": %s", instance_id, (name != nullptr) ? name : "Unknown");
}
const auto *dm = SDL_GetCurrentDisplayMode(displays[0]);
const auto* dm = SDL_GetCurrentDisplayMode(displays[0]);
// Guarda información del monitor en display_monitor_
const char *first_display_name = SDL_GetDisplayName(displays[0]);
const char* first_display_name = SDL_GetDisplayName(displays[0]);
display_monitor_.name = (first_display_name != nullptr) ? first_display_name : "Unknown";
display_monitor_.width = static_cast<int>(dm->w);
display_monitor_.height = static_cast<int>(dm->h);