FIx: El jugador no se moria al caer de alto si se mantenia la tecla de slto pulsada

This commit is contained in:
2022-11-19 09:02:35 +01:00
parent d003b51de4
commit e90c61a416
6 changed files with 29 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
#include "notify.h"
#include <string>
#include <stdio.h>
#include <iostream>
// Constructor
Notify::Notify(SDL_Renderer *renderer, std::string bitmapFile, std::string textFile)
@@ -36,6 +37,8 @@ void Notify::render()
{
notifications.at(i).sprite->render();
}
text->write(8,8,"TEXTO DE PRUEBA");
}
// Actualiza el estado de las notificaiones
@@ -114,7 +117,6 @@ void Notify::showText(std::string text)
const int despH = this->text->getCharacterSize() / 2;
const int despV = despH;
const int travelDist = height + despV;
// const int offset = (int)notifications.size() * (travelDist) + despV;
const int offset = (int)notifications.size() > 0 ? notifications.back().y + travelDist : despV;
// Crea la notificacion
@@ -142,6 +144,12 @@ void Notify::showText(std::string text)
// Añade la notificación a la lista
notifications.push_back(n);
//std::cout << "Notification " << notifications.size() << std::endl;
//std::cout << "width " << width << std::endl;
//std::cout << "height " << height << std::endl;
//std::cout << "offset " << offset << std::endl;
//std::cout << "desp " << despH << std::endl;
}
// Indica si hay notificaciones activas