afegit el namespace Logger
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "ui/notifier.hpp" // Para Notifier
|
||||
#include "ui/service_menu.hpp" // Para ServiceMenu
|
||||
#include "utils.hpp" // Para Overrides, overrides, getPath
|
||||
#include "ui/logger.hpp"
|
||||
|
||||
// Constructor
|
||||
Director::Director(int argc, std::span<char*> argv) {
|
||||
@@ -54,7 +55,7 @@ Director::Director(int argc, std::span<char*> argv) {
|
||||
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||
SDL_SetLogPriority(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Game start");
|
||||
Logger::put("Game start\n");
|
||||
|
||||
// Inicia la semilla aleatoria usando el tiempo actual en segundos
|
||||
std::srand(static_cast<unsigned int>(std::time(nullptr)));
|
||||
@@ -71,7 +72,7 @@ Director::Director(int argc, std::span<char*> argv) {
|
||||
|
||||
Director::~Director() {
|
||||
close();
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\nBye!");
|
||||
Logger::put("\nBye!");
|
||||
}
|
||||
|
||||
// Inicializa todo
|
||||
@@ -85,17 +86,28 @@ void Director::init() {
|
||||
ResourceHelper::initializeResourceSystem(executable_path_ + "resources.pack");
|
||||
#endif
|
||||
loadAssets(); // Crea el índice de archivos
|
||||
|
||||
Logger::section("INIT INPUT");
|
||||
Input::init(Asset::get()->get("gamecontrollerdb.txt"), Asset::get()->get("controllers.json")); // Carga configuración de controles
|
||||
|
||||
Logger::section("INIT CONFIG");
|
||||
Options::setConfigFile(Asset::get()->get("config_v2.txt")); // Establece el fichero de configuración
|
||||
Options::setControllersFile(Asset::get()->get("controllers.json")); // Establece el fichero de configuración de mandos
|
||||
Options::loadFromFile(); // Carga el archivo de configuración
|
||||
loadParams(); // Carga los parámetros del programa
|
||||
loadScoreFile(); // Carga el archivo de puntuaciones
|
||||
|
||||
|
||||
// Inicialización de subsistemas principales
|
||||
Lang::setLanguage(Options::settings.language); // Carga el archivo de idioma
|
||||
|
||||
|
||||
Logger::section("INIT VIDEO");
|
||||
Screen::init(); // Inicializa la pantalla y el sistema de renderizado
|
||||
|
||||
Logger::section("INIT AUDIO");
|
||||
Audio::init(); // Activa el sistema de audio
|
||||
|
||||
Logger::section("INIT RESOURCES");
|
||||
#ifdef _DEBUG
|
||||
Resource::init(Resource::LoadingMode::PRELOAD); // Inicializa el sistema de gestión de recursos
|
||||
#else
|
||||
@@ -104,6 +116,8 @@ void Director::init() {
|
||||
ServiceMenu::init(); // Inicializa el menú de servicio
|
||||
Notifier::init(std::string(), Resource::get()->getText("8bithud")); // Inicialización del sistema de notificaciones
|
||||
Screen::get()->getSingletons(); // Obtiene los punteros al resto de singletones
|
||||
|
||||
Logger::section("GAME LOG");
|
||||
}
|
||||
|
||||
// Cierra todo y libera recursos del sistema y de los singletons
|
||||
@@ -164,7 +178,7 @@ void Director::loadAssets() {
|
||||
std::string config_path = executable_path_ + PREFIX + "/config/assets.txt";
|
||||
Asset::get()->loadFromFile(config_path, PREFIX, system_folder_);
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Assets configuration loaded successfully");
|
||||
Logger::put("Assets configuration loaded successfully");
|
||||
|
||||
// Si falta algun fichero, sale del programa
|
||||
if (!Asset::get()->check()) {
|
||||
|
||||
Reference in New Issue
Block a user