forked from jaildesigner-jailgames/jaildoctors_dilemma
Acabat amb els singletones, de moment
Arreglat els checkEvents
This commit is contained in:
@@ -25,8 +25,6 @@ Title::Title()
|
||||
input_(Input::get())
|
||||
{
|
||||
// Reserva memoria para los punteros
|
||||
event_handler_ = new SDL_Event();
|
||||
cheevos_ = std::make_unique<Cheevos>(Asset::get()->get("cheevos.bin"));
|
||||
if (options.palette == p_zxspectrum)
|
||||
{
|
||||
texture_ = resource_->getTexture("title_logo.png");
|
||||
@@ -75,7 +73,6 @@ Title::Title()
|
||||
// Destructor
|
||||
Title::~Title()
|
||||
{
|
||||
delete event_handler_;
|
||||
delete sprite_;
|
||||
delete cheevos_sprite_;
|
||||
delete cheevos_texture_;
|
||||
@@ -104,22 +101,22 @@ void Title::initMarquee()
|
||||
// Comprueba el manejador de eventos
|
||||
void Title::checkEvents()
|
||||
{
|
||||
// Comprueba los eventos que hay en la cola
|
||||
while (SDL_PollEvent(event_handler_) != 0)
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
if (event_handler_->type == SDL_QUIT)
|
||||
if (event.type == SDL_QUIT)
|
||||
{
|
||||
options.section.name = SECTION_QUIT;
|
||||
break;
|
||||
}
|
||||
|
||||
// Solo se comprueban estas teclas si no está activo el menu de logros
|
||||
if (event_handler_->type == SDL_KEYDOWN)
|
||||
if (event.type == SDL_KEYDOWN)
|
||||
{
|
||||
if (!show_cheevos_)
|
||||
{
|
||||
switch (event_handler_->key.keysym.scancode)
|
||||
switch (event.key.keysym.scancode)
|
||||
{
|
||||
case SDL_SCANCODE_1:
|
||||
options.section.name = SECTION_GAME;
|
||||
@@ -446,7 +443,7 @@ void Title::fillTexture()
|
||||
void Title::createCheevosTexture()
|
||||
{
|
||||
// Crea la textura con el listado de logros
|
||||
const auto cheevosList = cheevos_->list();
|
||||
const auto cheevosList = Cheevos::get()->list();
|
||||
const int cheevosTextureWidth = 200;
|
||||
const int cheevosTextureViewHeight = 110;
|
||||
const int cheevosTexturePosY = 73;
|
||||
@@ -465,7 +462,7 @@ void Title::createCheevosTexture()
|
||||
|
||||
// Escribe la lista de logros en la textura
|
||||
const std::string cheevosOwner = "LOCAL ACHIEVEMENTS";
|
||||
const std::string cheevosListCaption = cheevosOwner + " (" + std::to_string(cheevos_->unlocked()) + " / " + std::to_string(cheevos_->count()) + ")";
|
||||
const std::string cheevosListCaption = cheevosOwner + " (" + std::to_string(Cheevos::get()->unlocked()) + " / " + std::to_string(Cheevos::get()->count()) + ")";
|
||||
int pos = 2;
|
||||
info_text_->writeDX(TXT_CENTER | TXT_COLOR, cheevos_texture_->getWidth() / 2, pos, cheevosListCaption, 1, stringToColor(options.palette, "bright_green"));
|
||||
pos += info_text_->getCharacterSize();
|
||||
|
||||
Reference in New Issue
Block a user