Afegida la funció getRenderer() a la classe Screen per tal d'estalviar altre parametre mes a molts constructors de classes-estat de joc
This commit is contained in:
@@ -432,3 +432,9 @@ void Screen::showNotification(std::string text1, std::string text2, int icon)
|
|||||||
{
|
{
|
||||||
notify->showText(text1, text2, icon);
|
notify->showText(text1, text2, icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Obtiene el puntero al renderizador
|
||||||
|
SDL_Renderer *Screen::getRenderer()
|
||||||
|
{
|
||||||
|
return renderer;
|
||||||
|
}
|
||||||
@@ -134,4 +134,7 @@ public:
|
|||||||
|
|
||||||
// Muestra una notificación de texto por pantalla;
|
// Muestra una notificación de texto por pantalla;
|
||||||
void showNotification(std::string text1 = "", std::string text2 = "", int icon = -1);
|
void showNotification(std::string text1 = "", std::string text2 = "", int icon = -1);
|
||||||
|
|
||||||
|
// Obtiene el puntero al renderizador
|
||||||
|
SDL_Renderer *getRenderer();
|
||||||
};
|
};
|
||||||
@@ -852,7 +852,7 @@ void Director::runIntro()
|
|||||||
// Ejecuta la seccion de juego con el titulo y los menus
|
// Ejecuta la seccion de juego con el titulo y los menus
|
||||||
void Director::runTitle()
|
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();
|
title->run();
|
||||||
delete title;
|
delete title;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
#include "title.h"
|
#include "title.h"
|
||||||
|
|
||||||
// Constructor
|
// 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
|
// Copia las direcciones de los punteros y objetos
|
||||||
this->renderer = renderer;
|
|
||||||
this->screen = screen;
|
this->screen = screen;
|
||||||
this->input = input;
|
this->input = input;
|
||||||
this->asset = asset;
|
this->asset = asset;
|
||||||
@@ -13,6 +12,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset,
|
|||||||
this->param = param;
|
this->param = param;
|
||||||
this->section = section;
|
this->section = section;
|
||||||
this->music = music;
|
this->music = music;
|
||||||
|
SDL_Renderer *renderer = screen->getRenderer();
|
||||||
|
|
||||||
// Reserva memoria y crea los objetos
|
// Reserva memoria y crea los objetos
|
||||||
eventHandler = new SDL_Event();
|
eventHandler = new SDL_Event();
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class Title
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
// Objetos y punteros
|
// Objetos y punteros
|
||||||
SDL_Renderer *renderer; // El renderizador de la ventana
|
|
||||||
Screen *screen; // Objeto encargado de dibujar en pantalla
|
Screen *screen; // Objeto encargado de dibujar en pantalla
|
||||||
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
Asset *asset; // Objeto que gestiona todos los ficheros de recursos
|
||||||
Input *input; // Objeto para leer las entradas de teclado o mando
|
Input *input; // Objeto para leer las entradas de teclado o mando
|
||||||
@@ -97,7 +96,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// 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
|
// Destructor
|
||||||
~Title();
|
~Title();
|
||||||
|
|||||||
Reference in New Issue
Block a user