working on options menu, almost done

This commit is contained in:
2021-08-28 23:17:00 +02:00
parent e9fcacd7c6
commit 0341a0fe9d
7 changed files with 141 additions and 89 deletions

View File

@@ -8,6 +8,8 @@
#ifndef MENU_H
#define MENU_H
#define MENU_MAX_ITEMS 50
// Clase menu
class Menu
{
@@ -27,7 +29,7 @@ private:
bool mIsCenteredOnY; // Variable para saber si el menu debe estar centrado respecto a un punto en el eje Y
int mCenterX; // Centro del menu en el eje X
int mCenterY; // Centro del menu en el eje Y
bool mAreElementsCenteredOnX; // Variable para saber si los elementos van centrados en el eje X
bool mAreElementsCenteredOnX; // Variable para saber si los elementos van centrados en el eje X
Uint16 mWidestItem; // Anchura del elemento más ancho
Uint16 mHeight; // Altura del menu
Uint16 mWidth; // Anchura del menu
@@ -55,8 +57,10 @@ private:
Uint8 h; // Alto del elemento
Uint8 hPaddingUp; // Espaciado sobre el elemento
Uint8 hPaddingDown; // Espaciado bajo el elemento
bool selectable; // Indica si se puede seleccionar
bool greyed; // Indica si ha de aparecer con otro color mas oscuro
};
item mItem[10]; // Estructura para cada elemento del menu
item mItem[MENU_MAX_ITEMS]; // Estructura para cada elemento del menu
struct selector
{
@@ -170,7 +174,7 @@ public:
void centerMenuElementsOnX();
// Añade un item al menu
void addItem(std::string text, const Uint8 hPaddingUp = 0, const Uint8 hPaddingDown = 0);
void addItem(std::string text, const Uint8 hPaddingUp = 0, const Uint8 hPaddingDown = 0, bool selectable = true, bool greyed = false);
// Cambia el texto de un item
void setItemCaption(Uint8 index, std::string text);