linter
This commit is contained in:
@@ -2,31 +2,33 @@
|
||||
|
||||
#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, find
|
||||
#include <array> // Para array
|
||||
#include <cstdlib> // Para exit, getenv
|
||||
#include <filesystem> // Para filesystem::remove, filesystem::exists
|
||||
#include <fstream> // Para ofstream
|
||||
#include <cstdlib> // Para exit
|
||||
#include <exception> // Para exception
|
||||
#include <filesystem> // Para exists, path, remove
|
||||
#include <fstream> // Para basic_ofstream, basic_ios, basic_ostream::write, ios, ofstream
|
||||
#include <ranges> // Para __find_if_fn, find_if, __find_fn, find
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <utility> // Para move
|
||||
|
||||
#include "asset.hpp" // Para Asset
|
||||
#include "color.hpp" // Para Color
|
||||
#include "color.hpp" // Para Color, NO_COLOR_MOD
|
||||
#include "external/jail_audio.h" // Para JA_LoadMusic, JA_LoadSound, JA_DeleteMusic, JA_DeleteSound
|
||||
#include "lang.hpp" // Para getText
|
||||
#include "param.hpp" // Para Param, param, ParamResource, ParamGame
|
||||
#include "resource_helper.hpp" // Para ResourceHelper
|
||||
#include "param.hpp" // Para Param, param, ParamPlayer, ParamResource, ParamGame
|
||||
#include "resource_helper.hpp" // Para loadFile
|
||||
#include "screen.hpp" // Para Screen
|
||||
#include "text.hpp" // Para Text
|
||||
#include "version.h" // Para Version::APP_NAME y Version::GIT_HASH
|
||||
#include "ui/logger.hpp" // Para Logger
|
||||
#include "ui/logger.hpp" // Para info, CR, dots
|
||||
#include "utils.hpp" // Para getFileName
|
||||
#include "version.h" // Para APP_NAME, GIT_HASH
|
||||
|
||||
struct JA_Music_t; // lines 11-11
|
||||
struct JA_Sound_t; // lines 12-12
|
||||
|
||||
// Helper para cargar archivos de audio desde pack o filesystem
|
||||
namespace {
|
||||
std::string createTempAudioFile(const std::string& file_path, std::vector<std::string>& temp_files_tracker) {
|
||||
auto createTempAudioFile(const std::string& file_path, std::vector<std::string>& temp_files_tracker) -> std::string {
|
||||
auto resource_data = ResourceHelper::loadFile(file_path);
|
||||
if (!resource_data.empty()) {
|
||||
// Crear archivo temporal
|
||||
@@ -319,8 +321,8 @@ auto Resource::getAnimation(const std::string& name) -> AnimationsFileBuffer& {
|
||||
auto Resource::getDemoData(int index) -> DemoData& {
|
||||
if (index < 0 || index >= static_cast<int>(demos_.size())) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Index %d out of range for demo data (size: %d)", index, static_cast<int>(demos_.size()));
|
||||
static DemoData empty_demo;
|
||||
return empty_demo;
|
||||
static DemoData empty_demo_;
|
||||
return empty_demo_;
|
||||
}
|
||||
return demos_.at(index);
|
||||
}
|
||||
@@ -446,7 +448,7 @@ void Resource::load() {
|
||||
auto vsync = Screen::getVSync();
|
||||
screen->setVSync(false);
|
||||
|
||||
//SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES");
|
||||
// SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** LOADING RESOURCES");
|
||||
loadSounds(); // Carga sonidos
|
||||
loadMusics(); // Carga músicas
|
||||
loadTextures(); // Carga texturas
|
||||
@@ -456,7 +458,7 @@ void Resource::load() {
|
||||
createText(); // Crea objetos de texto
|
||||
createTextTextures(); // Crea texturas a partir de texto
|
||||
createPlayerTextures(); // Crea las texturas de jugadores con todas sus variantes de paleta
|
||||
//SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** RESOURCES LOADED");
|
||||
// SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n** RESOURCES LOADED");
|
||||
|
||||
// Restablece el sincronismo vertical a su valor original
|
||||
screen->setVSync(vsync);
|
||||
@@ -489,7 +491,7 @@ void Resource::loadSounds() {
|
||||
|
||||
// Carga las músicas del juego
|
||||
void Resource::loadMusics() {
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("MUSIC FILES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::MUSIC);
|
||||
musics_.clear();
|
||||
@@ -505,7 +507,7 @@ void Resource::loadMusics() {
|
||||
|
||||
// Carga las texturas del juego
|
||||
void Resource::loadTextures() {
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("TEXTURES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::BITMAP);
|
||||
textures_.clear();
|
||||
@@ -519,7 +521,7 @@ void Resource::loadTextures() {
|
||||
|
||||
// Carga los ficheros de texto del juego
|
||||
void Resource::loadTextFiles() {
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("TEXT FILES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::FONT);
|
||||
text_files_.clear();
|
||||
@@ -533,7 +535,7 @@ void Resource::loadTextFiles() {
|
||||
|
||||
// Carga las animaciones del juego
|
||||
void Resource::loadAnimations() {
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("ANIMATIONS");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::ANIMATION);
|
||||
animations_.clear();
|
||||
@@ -547,7 +549,7 @@ void Resource::loadAnimations() {
|
||||
|
||||
// Carga los datos para el modo demostración
|
||||
void Resource::loadDemoData() {
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("DEMO FILES");
|
||||
auto list = Asset::get()->getListByType(Asset::Type::DEMODATA);
|
||||
demos_.clear();
|
||||
@@ -561,7 +563,7 @@ void Resource::loadDemoData() {
|
||||
|
||||
// Crea las texturas de jugadores con todas sus variantes de paleta
|
||||
void Resource::createPlayerTextures() {
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("CREATING PLAYER TEXTURES");
|
||||
|
||||
// Configuración de jugadores y sus paletas
|
||||
@@ -650,7 +652,7 @@ void Resource::createTextTextures() {
|
||||
text(std::move(text_init)) {}
|
||||
};
|
||||
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("CREATING TEXTURES");
|
||||
|
||||
// Texturas de tamaño normal con outline
|
||||
@@ -700,7 +702,7 @@ void Resource::createText() {
|
||||
white_texture_file(std::move(w_file)) {}
|
||||
};
|
||||
|
||||
Logger::CR();
|
||||
Logger::cr();
|
||||
Logger::info("CREATING TEXT OBJECTS");
|
||||
|
||||
std::vector<ResourceInfo> resources = {
|
||||
@@ -890,7 +892,7 @@ void Resource::cleanupTempAudioFiles() {
|
||||
try {
|
||||
if (std::filesystem::exists(temp_path)) {
|
||||
std::filesystem::remove(temp_path);
|
||||
//SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Removed temp audio file: %s", temp_path.c_str());
|
||||
// SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Removed temp audio file: %s", temp_path.c_str());
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to remove temp audio file %s: %s", temp_path.c_str(), e.what());
|
||||
|
||||
Reference in New Issue
Block a user