clang-tidy
clang-format
This commit is contained in:
2025-08-10 22:01:18 +02:00
parent 659a4ced44
commit 41e3fd1d8d
29 changed files with 235 additions and 302 deletions

View File

@@ -2,29 +2,26 @@
#include <SDL3/SDL.h> // Para SDL_LogInfo, SDL_LogCategory, SDL_LogError, SDL_SetRenderDrawColor, SDL_EventType, SDL_PollEvent, SDL_RenderFillRect, SDL_RenderRect, SDLK_ESCAPE, SDL_Event
#include <algorithm> // Para find_if, max
#include <algorithm> // Para find_if, max, find
#include <array> // Para array
#include <cstdlib> // Para exit
#include <iostream> // Para printWithDots
#include <stdexcept> // Para runtime_error
#include <utility> // Para move
#include "asset.h" // Para Asset, AssetType
#include "asset.h" // Para Asset
#include "color.h" // Para Color
#ifndef NO_AUDIO
#include "external/jail_audio.h" // Para JA_DeleteMusic, JA_DeleteSound, JA_LoadMusic, JA_LoadSound
#include "external/jail_audio.h" // Para JA_LoadMusic, JA_LoadSound, JA_DeleteMusic, JA_DeleteSound
#endif
#include "lang.h" // Para getText
#include "param.h" // Para Param, param, ParamResource, ParamGame
#include "screen.h" // Para Screen
#include "text.h" // Para Text, loadTextFile, TextFile (ptr only)
#include "text.h" // Para Text
struct JA_Music_t; // lines 11-11
struct JA_Sound_t; // lines 12-12
// Declaraciones de funciones que necesitas implementar en otros archivos
extern AnimationsFileBuffer loadAnimationsFromFile(const std::string &filename);
extern DemoData loadDemoDataFromFile(const std::string &filename);
// Singleton
Resource *Resource::instance = nullptr;
@@ -93,7 +90,7 @@ void Resource::loadTextFilesQuiet() {
// Carga solo las texturas esenciales (fuentes)
void Resource::loadEssentialTextures() {
const std::vector<std::string> essential_textures = {
const std::vector<std::string> ESSENTIAL_TEXTURES = {
"04b_25.png",
"04b_25_2x.png",
"04b_25_metal.png",
@@ -112,7 +109,7 @@ void Resource::loadEssentialTextures() {
for (const auto &file : texture_list) {
auto name = getFileName(file);
// Solo cargar texturas esenciales
if (std::find(essential_textures.begin(), essential_textures.end(), name) != essential_textures.end()) {
if (std::find(ESSENTIAL_TEXTURES.begin(), ESSENTIAL_TEXTURES.end(), name) != ESSENTIAL_TEXTURES.end()) {
// Buscar en nuestra lista y cargar
auto it = std::find_if(textures_.begin(), textures_.end(), [&name](const auto &t) { return t.name == name; });
if (it != textures_.end()) {
@@ -165,7 +162,7 @@ void Resource::initResourceLists() {
loadDemoDataQuiet();
// Inicializa lista de objetos de texto (sin cargar el contenido)
const std::vector<std::string> text_objects = {
const std::vector<std::string> TEXT_OBJECTS = {
"04b_25",
"04b_25_2x",
"04b_25_metal",
@@ -180,7 +177,7 @@ void Resource::initResourceLists() {
"smb2_grad"};
texts_.clear();
for (const auto &text_name : text_objects) {
for (const auto &text_name : TEXT_OBJECTS) {
texts_.emplace_back(text_name); // Constructor con nullptr por defecto
}
@@ -348,7 +345,7 @@ auto Resource::loadTextLazy(const std::string &name) -> std::shared_ptr<Text> {
std::string text_file;
};
const std::vector<TextMapping> text_mappings = {
const std::vector<TextMapping> TEXT_MAPPINGS = {
{"04b_25", "04b_25.png", "04b_25.txt"},
{"04b_25_2x", "04b_25_2x.png", "04b_25_2x.txt"},
{"04b_25_metal", "04b_25_metal.png", "04b_25.txt"},
@@ -362,7 +359,7 @@ auto Resource::loadTextLazy(const std::string &name) -> std::shared_ptr<Text> {
{"smb2", "smb2.png", "smb2.txt"},
{"smb2_grad", "smb2_grad.png", "smb2.txt"}};
for (const auto &mapping : text_mappings) {
for (const auto &mapping : TEXT_MAPPINGS) {
if (mapping.key == name) {
// Cargar las dependencias automáticamente
auto texture = getTexture(mapping.texture_file); // Esto cargará la textura si no está cargada