La tarjeta d'ajuda ix pero no s'amaga

This commit is contained in:
2024-10-02 13:56:43 +02:00
parent 3a84ea792c
commit abc8a0b632
3 changed files with 100 additions and 56 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <SDL2/SDL.h>
#include "text.h"
class Screen;
class Asset;
class Input;
@@ -22,12 +23,9 @@ private:
// [SINGLETON] Objeto screen privado para Don Melitón
static OnScreenHelp *onScreenHelp;
Screen *screen; // Objeto encargado de dibujar en pantalla
Asset *asset; // Objeto con los ficheros de recursos
Input *input; // Objeto pata gestionar la entrada
SDL_Texture *texture; // Textura donde dibujar
SDL_Rect dest; // Posición donde dibujar la textura;
SDL_Texture *texture; // Textura donde dibujar
SDL_Rect dest; // Posición donde dibujar la textura;
int hiddenPos, showingPos; // Las dos posiciones donde colocar la textura
OnScreenHelpStatus state; // Estado del objeto
@@ -48,6 +46,12 @@ private:
// Calcula la longitud en pixels del texto más largo
int getLargestStringSize() const;
// Renderizara el boton y el texto
void renderButton(Sprite *sprite, Text *text, const SDL_Rect &buttonClip, const SDL_Rect &buttonPos, int textId);
// Actualiza la posición
void updatePosition();
public:
// [SINGLETON] Crearemos el objeto screen con esta función estática
static void init();