commit de acabar la jornada laboral

This commit is contained in:
2024-10-17 13:57:41 +02:00
parent db884cb422
commit 59de566c5b
24 changed files with 78 additions and 274 deletions

View File

@@ -55,9 +55,11 @@ Director::Director(int argc, const char *argv[])
section::name = section::Name::LOGO;
#endif
#ifndef VERBOSE
// Deshabilita todos los std::cout
//std::ostream null_stream(nullptr);
//std::streambuf *orig_buf = std::cout.rdbuf(null_stream.rdbuf());
std::ostream null_stream(nullptr);
std::streambuf *orig_buf = std::cout.rdbuf(null_stream.rdbuf());
#endif
// Comprueba los parametros del programa
checkProgramArguments(argc, argv);
@@ -252,9 +254,7 @@ bool Director::initSDL()
// Inicializa SDL
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
{
#ifdef VERBOSE
std::cout << "SDL could not initialize!\nSDL Error: " << SDL_GetError() << std::endl;
#endif
success = false;
}
else
@@ -262,7 +262,6 @@ bool Director::initSDL()
// Inicia el generador de numeros aleatorios
std::srand(static_cast<unsigned int>(SDL_GetTicks()));
#ifdef VERBOSE
// Muestra información de la pantalla
/*std::cout << "\nDisplay modes list:" << std::endl;
for (int i = 0; i < SDL_GetNumDisplayModes(0); ++i)
@@ -276,30 +275,23 @@ bool Director::initSDL()
SDL_GetCurrentDisplayMode(0, &DM);
std::cout << "\nCurrent display mode: " + std::to_string(DM.w) + "x" + std::to_string(DM.h) + " @ " + std::to_string(DM.refresh_rate) + "Hz" << std::endl;
std::cout << "Window resolution : " + std::to_string(param.game.width) + "x" + std::to_string(param.game.height) + " x" + std::to_string(options.video.window.size) << std::endl;
#endif
// Establece el filtro de la textura
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, std::to_string(static_cast<int>(options.video.filter)).c_str()))
{
#ifdef VERBOSE
std::cout << "Warning: texture filtering not enabled!\n";
#endif
}
#ifndef NO_SHADERS
if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl"))
{
#ifdef VERBOSE
std::cout << "Warning: opengl not enabled!\n";
#endif // VERBOSE
}
#endif // NO_SHADERS
// Crea la ventana
window_ = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, param.game.width * options.video.window.size, param.game.height * options.video.window.size, SDL_WINDOW_HIDDEN);
if (!window_)
{
#ifdef VERBOSE
std::cout << "Window could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
#endif
success = false;
}
else
@@ -318,9 +310,7 @@ bool Director::initSDL()
if (!renderer_)
{
#ifdef VERBOSE
std::cout << "Renderer could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
#endif
success = false;
}
else
@@ -338,9 +328,7 @@ bool Director::initSDL()
}
}
#ifdef VERBOSE
std::cout << std::endl;
#endif
return success;
}