Reestructurados los ficheros en carpetas
This commit is contained in:
93
source/menu.h
Normal file
93
source/menu.h
Normal file
@@ -0,0 +1,93 @@
|
||||
#pragma once
|
||||
|
||||
#include "sprite.h"
|
||||
#include "const.h"
|
||||
#include "globals.h"
|
||||
#include "text.h"
|
||||
|
||||
#ifndef MENU_H
|
||||
#define MENU_H
|
||||
|
||||
//Clase menu
|
||||
class Menu
|
||||
{
|
||||
public:
|
||||
//Constructor
|
||||
Menu();
|
||||
|
||||
//Inicializador
|
||||
void init(int x, int y, int offset_sprite_selector, int backgroundType);
|
||||
|
||||
//Obtiene el valor de la variable
|
||||
Uint8 getItemSelected();
|
||||
|
||||
//Mueve el grafico del selector al elemento seleccionado
|
||||
void moveSelectorSprite(int pos);
|
||||
|
||||
//Deja el menu apuntando al primer elemento
|
||||
void resetMenu();
|
||||
|
||||
//Deja el menu apuntando al siguiente elemento
|
||||
void increaseSelectorIndex();
|
||||
|
||||
//Deja el menu apuntando al elemento anterior
|
||||
void decreaseSelectorIndex();
|
||||
|
||||
//Comprueba la entrada (teclado, gamepad) y actua en consecuencia
|
||||
void checkInput(Uint8 input);
|
||||
|
||||
//Pinta el menu en pantalla
|
||||
void render(Text &text);
|
||||
|
||||
//Establece el rectangulo de fondo del menu
|
||||
void setRectSize();
|
||||
|
||||
//Establece el valor de la variable
|
||||
void setTotalItems(int num);
|
||||
|
||||
//Establece el color del rectangulo de fondo
|
||||
void setBackgroundColor(int r, int g, int b, int alpha);
|
||||
|
||||
//Centra el menu en pantalla
|
||||
void centerMenuOnScreen();
|
||||
|
||||
//Añade un item al menu
|
||||
void addItem(std::string text);
|
||||
|
||||
private:
|
||||
//Posicion X/Y del texto del primer elemento del menu
|
||||
int mPosX;
|
||||
int mPosY;
|
||||
|
||||
//Elemento del menu que tiene el foco
|
||||
Uint8 mSelectorIndex;
|
||||
|
||||
//Numero de items del menu
|
||||
Uint8 mTotalItems;
|
||||
|
||||
//Item del menu que ha sido seleccionado
|
||||
Uint8 mItemSelected;
|
||||
|
||||
//Tipo de fondo para el menu
|
||||
Uint8 mBackgroundType;
|
||||
|
||||
//Sprite con los graficos del selector
|
||||
Sprite mSelectorSprite;
|
||||
|
||||
//Rectangulo y colores para el fondo del menu
|
||||
SDL_Rect mRect;
|
||||
Uint8 mRectR; //Rojo
|
||||
Uint8 mRectG; //Verde
|
||||
Uint8 mRectB; //Azul
|
||||
Uint8 mRectA; //Alfa o transparencia
|
||||
|
||||
//Estructura para cada elemento del menu
|
||||
struct MenuItem
|
||||
{
|
||||
std::string label;
|
||||
int x;
|
||||
int y;
|
||||
} mMenuItem[10];
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user