diff --git a/source/director.cpp b/source/director.cpp index 1bd0380..f5e8d8e 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -316,12 +316,10 @@ bool Director::initSDL() std::cout << "Warning: texture filtering not enabled!\n"; } -#ifndef NO_SHADERS if (!SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl")) { std::cout << "Warning: opengl not enabled!\n"; } -#endif // 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); @@ -339,10 +337,8 @@ bool Director::initSDL() flags = SDL_RENDERER_PRESENTVSYNC; } -#ifndef NO_SHADERS // La aceleración se activa según el define flags = flags | SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE; -#endif renderer_ = SDL_CreateRenderer(window_, -1, flags); diff --git a/source/jail_shader.cpp b/source/jail_shader.cpp index 44d75d3..e6e8f52 100644 --- a/source/jail_shader.cpp +++ b/source/jail_shader.cpp @@ -1,5 +1,3 @@ -#ifndef NO_SHADERS - #include "jail_shader.h" #include // para SDL_Point #include // para NULL, free, malloc, exit @@ -247,5 +245,4 @@ namespace shader SDL_RenderPresent(renderer); } } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/source/jail_shader.h b/source/jail_shader.h index 5c113ad..ba99f0c 100644 --- a/source/jail_shader.h +++ b/source/jail_shader.h @@ -1,5 +1,3 @@ -#ifndef NO_SHADERS - #pragma once #include // para SDL_Texture @@ -44,5 +42,4 @@ namespace shader const char *vertexShader, const char *fragmentShader = nullptr); void render(); -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/source/logo.cpp b/source/logo.cpp index aa85d9e..a266d88 100644 --- a/source/logo.cpp +++ b/source/logo.cpp @@ -53,9 +53,6 @@ Logo::Logo() color_.push_back(Color(0x00, 0xd8, 0xd8)); // Cyan color_.push_back(Color(0xd8, 0xd8, 0x00)); // Yellow color_.push_back(Color(0xFF, 0xFF, 0xFF)); // Bright white - - mi_textura = copyTextureToTarget(Screen::get()->getRenderer(), Resource::get()->getTexture("logo_retroweekend.png")->getSDLTexture()); - pixels_ = extractPixels(mi_textura); } // Destructor diff --git a/source/notifier.cpp b/source/notifier.cpp index a503440..aacc1f2 100644 --- a/source/notifier.cpp +++ b/source/notifier.cpp @@ -12,22 +12,22 @@ #include "texture.h" // Para Texture #include "resource.h" -// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado +// [SINGLETON] Notifier *Notifier::notifier_ = nullptr; -// [SINGLETON] Crearemos el objeto screen con esta función estática +// [SINGLETON] Crearemos el objeto con esta función estática void Notifier::init(const std::string &icon_file, std::shared_ptr text) { Notifier::notifier_ = new Notifier(icon_file, text); } -// [SINGLETON] Destruiremos el objeto screen con esta función estática +// [SINGLETON] Destruiremos el objeto con esta función estática void Notifier::destroy() { delete Notifier::notifier_; } -// [SINGLETON] Con este método obtenemos el objeto screen y podemos trabajar con él +// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él Notifier *Notifier::get() { return Notifier::notifier_; diff --git a/source/notifier.h b/source/notifier.h index c4652f4..bcf56a4 100644 --- a/source/notifier.h +++ b/source/notifier.h @@ -13,7 +13,7 @@ class Texture; // lines 11-11 class Notifier { private: - // [SINGLETON] Objeto notifier privado para Don Melitón + // [SINGLETON] Objeto notifier static Notifier *notifier_; enum class NotificationStatus @@ -77,13 +77,13 @@ private: ~Notifier() = default; public: - // [SINGLETON] Crearemos el objeto notifier con esta función estática + // [SINGLETON] Crearemos el objeto con esta función estática static void init(const std::string &icon_file, std::shared_ptr text); - // [SINGLETON] Destruiremos el objeto notifier con esta función estática + // [SINGLETON] Destruiremos el objeto con esta función estática static void destroy(); - // [SINGLETON] Con este método obtenemos el objeto notifier y podemos trabajar con él + // [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él static Notifier *get(); // Dibuja las notificaciones por pantalla diff --git a/source/screen.cpp b/source/screen.cpp index 9b6dde0..07e770d 100644 --- a/source/screen.cpp +++ b/source/screen.cpp @@ -15,10 +15,7 @@ #include "on_screen_help.h" // Para OnScreenHelp #include "options.h" // Para Options, OptionsVideo, options, Options... #include "mouse.h" - -#ifndef NO_SHADERS #include "jail_shader.h" // para init, render -#endif // [SINGLETON] Screen *Screen::screen_ = nullptr; @@ -105,11 +102,6 @@ void Screen::renderScreen() SDL_SetRenderTarget(renderer_, nullptr); clean(); -#ifdef NO_SHADERS - // Actualiza la pantalla con el contenido del buffer de renderizado - SDL_RenderCopy(renderer_, game_canvas_, nullptr, nullptr); - SDL_RenderPresent(renderer_); -#else if (options.video.shaders) { // Aplica shaders y renderiza el contenido @@ -121,7 +113,6 @@ void Screen::renderScreen() SDL_RenderCopy(renderer_, game_canvas_, nullptr, nullptr); SDL_RenderPresent(renderer_); } -#endif } // Establece el modo de video @@ -174,13 +165,11 @@ void Screen::setVideoMode(ScreenVideoMode videoMode) // Reinicia los shaders if (options.video.shaders) { -#ifndef NO_SHADERS const std::string glsl_file = param.game.game_area.rect.h == 256 ? "crtpi_256.glsl" : "crtpi_240.glsl"; std::ifstream f(Asset::get()->get(glsl_file).c_str()); std::string source((std::istreambuf_iterator(f)), std::istreambuf_iterator()); shader::init(window_, game_canvas_, source.c_str()); -#endif } } diff --git a/source/screen.h b/source/screen.h index 03ef08a..260419a 100644 --- a/source/screen.h +++ b/source/screen.h @@ -110,9 +110,6 @@ private: // Calcula la nueva posición de la ventana a partir de la antigua al cambiarla de tamaño SDL_Point getNewPosition(); - // Actualiza la pantalla con el contenido del game_canvas_ - void presentGameCanvas(); - // Selecciona y ejecuta el método de renderizado adecuado basado en la configuración de shaders void renderScreen();