Boton de atras implementado

parent 897c0b74
No preview for this file type
...@@ -8,7 +8,7 @@ PantallaFecha::PantallaFecha() : ...@@ -8,7 +8,7 @@ PantallaFecha::PantallaFecha() :
fuente1("assets/OpenSans-Italic.ttf", 100), fuente1("assets/OpenSans-Italic.ttf", 100),
Fondo1("assets/pantallaPantalla.png"), Fondo1("assets/pantallaPantalla.png"),
atras(Sprite("assets/volver.png"),Sprite("assets/volver.png"),Sprite("assets/volver.png"),Hitbox(1800,1600,300,200),1600,200,100,100,normal,nullptr),
carne(Sprite("assets/carneNombre.png"),Sprite("assets/carneNombre.png"),Sprite("assets/carneNombre.png"),Hitbox(0,0,0,0),0,0,0,0,normal,nullptr), carne(Sprite("assets/carneNombre.png"),Sprite("assets/carneNombre.png"),Sprite("assets/carneNombre.png"),Hitbox(0,0,0,0),0,0,0,0,normal,nullptr),
botonesArriba{ botonesArriba{
...@@ -48,6 +48,9 @@ void PantallaFecha::manejarEntrada(Handle &handle) { ...@@ -48,6 +48,9 @@ void PantallaFecha::manejarEntrada(Handle &handle) {
xRaton*=(1920.0/handle.getTamX()); xRaton*=(1920.0/handle.getTamX());
zRaton*=(1080.0/handle.getTamY()); zRaton*=(1080.0/handle.getTamY());
int contadorCorrectos=0; int contadorCorrectos=0;
if(atras.colisionaObjeto(xRaton,zRaton)){
handle.removeme();
}
for(int i=0;i<4;i++){ for(int i=0;i<4;i++){
if(botonesArriba[i].colisionaObjeto(xRaton, zRaton)){ if(botonesArriba[i].colisionaObjeto(xRaton, zRaton)){
combinacionActual[i]=(combinacionActual[i]+1)%10; combinacionActual[i]=(combinacionActual[i]+1)%10;
...@@ -77,7 +80,7 @@ void PantallaFecha::manejarEntrada(Handle &handle) { ...@@ -77,7 +80,7 @@ void PantallaFecha::manejarEntrada(Handle &handle) {
void PantallaFecha::renderizar(SDL_Renderer *renderer, int tamx, int tamy) { void PantallaFecha::renderizar(SDL_Renderer *renderer, int tamx, int tamy) {
Fondo1.renderizar(renderer, 0, 0,1920,1080, tamx, tamy); Fondo1.renderizar(renderer, 0, 0,1920,1080, tamx, tamy);
atras.renderizar(renderer,tamx,tamy);
for(int i=0;i<4;i++){ for(int i=0;i<4;i++){
botonesAbajo[i].renderizar(renderer, tamx, tamy); botonesAbajo[i].renderizar(renderer, tamx, tamy);
......
...@@ -14,6 +14,7 @@ class PantallaFecha : public Pantalla { ...@@ -14,6 +14,7 @@ class PantallaFecha : public Pantalla {
Objeto botonesAbajo[4]; Objeto botonesAbajo[4];
vector<Hitbox> colisionesBotones; vector<Hitbox> colisionesBotones;
Objeto carne; Objeto carne;
Objeto atras;
Fuente fuente1; Fuente fuente1;
Sprite Fondo1; Sprite Fondo1;
int combinacionActual[4]; int combinacionActual[4];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment