Passant std::cout a SDL_Log
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
// IWYU pragma: no_include <bits/chrono.h>
|
||||
#include "director.h"
|
||||
#include <SDL3/SDL_audio.h> // Para SDL_AudioFormat
|
||||
#include <SDL3/SDL_blendmode.h> // Para SDL_BLENDMODE_BLEND
|
||||
#include <SDL3/SDL_error.h> // Para SDL_GetError
|
||||
#include <SDL3/SDL_gamepad.h> // Para SDL_GamepadButton
|
||||
#include <SDL3/SDL_hints.h> // Para SDL_SetHint, SDL_HINT_RENDER_DRIVER
|
||||
#include <SDL3/SDL_init.h> // Para SDL_Init, SDL_Quit, SDL_INIT_VIDEO
|
||||
#include <SDL3/SDL_log.h> // Para SDL_Log
|
||||
#include <SDL3/SDL_mouse.h> // Para SDL_HideCursor
|
||||
#include <SDL3/SDL_init.h> // Para SDL_Init, SDL_Quit, SDL_INIT_AUDIO
|
||||
#include <SDL3/SDL_log.h> // Para SDL_Log, SDL_LogCategory, SDL_LogE...
|
||||
#include <SDL3/SDL_scancode.h> // Para SDL_Scancode
|
||||
#include <SDL3/SDL_stdinc.h> // Para SDL_free, SDL_PRIu32, Uint32
|
||||
#include <errno.h> // Para errno, EEXIST, EACCES, ENAMETOOLONG
|
||||
#include <stdio.h> // Para printf, perror
|
||||
#include <sys/stat.h> // Para mkdir, stat, S_IRWXU
|
||||
@@ -17,10 +13,9 @@
|
||||
#include <algorithm> // Para min
|
||||
#include <cstdlib> // Para exit, EXIT_FAILURE, size_t, srand
|
||||
#include <ctime> // Para time
|
||||
#include <iostream> // Para basic_ostream, operator<<, cout, endl
|
||||
#include <memory> // Para make_unique, unique_ptr
|
||||
#include <stdexcept> // Para runtime_error
|
||||
#include <string> // Para operator+, char_traits, allocator
|
||||
#include <string> // Para operator+, allocator, char_traits
|
||||
#include <vector> // Para vector
|
||||
#include "asset.h" // Para Asset, AssetType
|
||||
#include "credits.h" // Para Credits
|
||||
@@ -35,8 +30,8 @@
|
||||
#include "manage_hiscore_table.h" // Para ManageHiScoreTable
|
||||
#include "notifier.h" // Para Notifier
|
||||
#include "on_screen_help.h" // Para OnScreenHelp
|
||||
#include "options.h" // Para Options, options, GamepadOptions
|
||||
#include "param.h" // Para Param, ParamGame, param, loadParam...
|
||||
#include "options.h" // Para GamepadOptions, Options, options
|
||||
#include "param.h" // Para loadParamsFromFile
|
||||
#include "resource.h" // Para Resource
|
||||
#include "screen.h" // Para Screen
|
||||
#include "section.h" // Para Name, Options, name, options
|
||||
@@ -61,13 +56,7 @@ Director::Director(int argc, const char *argv[])
|
||||
section::attract_mode = section::AttractMode::TITLE_TO_DEMO;
|
||||
#endif
|
||||
|
||||
#ifndef VERBOSE
|
||||
// Deshabilita todos los std::cout
|
||||
std::ostream null_stream(nullptr);
|
||||
orig_buf = std::cout.rdbuf(null_stream.rdbuf());
|
||||
#endif
|
||||
|
||||
std::cout << "Game start" << std::endl;
|
||||
SDL_Log("Game start");
|
||||
|
||||
// Inicia la semilla aleatoria usando el tiempo actual en segundos
|
||||
std::srand(static_cast<unsigned int>(std::time(nullptr)));
|
||||
@@ -85,7 +74,7 @@ Director::Director(int argc, const char *argv[])
|
||||
Director::~Director()
|
||||
{
|
||||
close();
|
||||
std::cout << "\nBye!" << std::endl;
|
||||
SDL_Log("\nBye!");
|
||||
}
|
||||
|
||||
// Inicializa todo
|
||||
@@ -694,12 +683,7 @@ int Director::run()
|
||||
break;
|
||||
}
|
||||
|
||||
std::cout << "\nGame end " << return_code << std::endl;
|
||||
|
||||
#ifndef VERBOSE
|
||||
// Habilita de nuevo los std::cout
|
||||
std::cout.rdbuf(orig_buf);
|
||||
#endif
|
||||
SDL_Log("\nGame end %s", return_code.c_str());
|
||||
|
||||
return (section::options == section::Options::QUIT_WITH_CONTROLLER) ? 1 : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user