diff --git a/source/common/screen.cpp b/source/common/screen.cpp index a0113ce..3a79ff8 100644 --- a/source/common/screen.cpp +++ b/source/common/screen.cpp @@ -431,4 +431,10 @@ void Screen::attenuate(bool value) void Screen::showNotification(std::string text1, std::string text2, int icon) { notify->showText(text1, text2, icon); +} + +// Obtiene el puntero al renderizador +SDL_Renderer *Screen::getRenderer() +{ + return renderer; } \ No newline at end of file diff --git a/source/common/screen.h b/source/common/screen.h index 2d7de69..ac7fb83 100644 --- a/source/common/screen.h +++ b/source/common/screen.h @@ -134,4 +134,7 @@ public: // Muestra una notificación de texto por pantalla; void showNotification(std::string text1 = "", std::string text2 = "", int icon = -1); + + // Obtiene el puntero al renderizador + SDL_Renderer *getRenderer(); }; \ No newline at end of file diff --git a/source/director.cpp b/source/director.cpp index 3902b07..810835f 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -852,7 +852,7 @@ void Director::runIntro() // Ejecuta la seccion de juego con el titulo y los menus void Director::runTitle() { - title = new Title(renderer, screen, input, asset, options, lang, param, section, getMusic(musics, "title.ogg")); + title = new Title(screen, input, asset, options, lang, param, section, getMusic(musics, "title.ogg")); title->run(); delete title; } diff --git a/source/title.cpp b/source/title.cpp index 4c7e810..7518d55 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -1,10 +1,9 @@ #include "title.h" // Constructor -Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music) +Title::Title(Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music) { // Copia las direcciones de los punteros y objetos - this->renderer = renderer; this->screen = screen; this->input = input; this->asset = asset; @@ -13,6 +12,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, this->param = param; this->section = section; this->music = music; + SDL_Renderer *renderer = screen->getRenderer(); // Reserva memoria y crea los objetos eventHandler = new SDL_Event(); diff --git a/source/title.h b/source/title.h index b01d0eb..0feedd1 100644 --- a/source/title.h +++ b/source/title.h @@ -47,7 +47,6 @@ class Title { private: // Objetos y punteros - SDL_Renderer *renderer; // El renderizador de la ventana Screen *screen; // Objeto encargado de dibujar en pantalla Asset *asset; // Objeto que gestiona todos los ficheros de recursos Input *input; // Objeto para leer las entradas de teclado o mando @@ -97,7 +96,7 @@ private: public: // Constructor - Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music); + Title(Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, param_t *param, section_t *section, JA_Music_t *music); // Destructor ~Title();