You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
2.1 KiB
43 lines
2.1 KiB
#ifndef SELECTABLE_H_
|
|
#define SELECTABLE_H_
|
|
|
|
#include "raylib.h"
|
|
#include "../game.h"
|
|
|
|
typedef struct Selectable Selectable;
|
|
typedef struct Selectable{
|
|
Vector2 position; // Linke obere Ecke
|
|
Vector2 centerPosition; // Die Mitte des Selectables
|
|
Texture2D *texture;// Single Texture
|
|
Texture2D **backgroundTexture; // [0]: Normal | [1]: Hovered | [2]: Selected
|
|
int hasBackground; // 0: hat keine Background Textur | 1: hat Background Textur
|
|
char description[20]; //Text der unter dem selectable angezeigt werden kann
|
|
int showDescription; //0: zeigt Description nicht | 1: zeigt Description
|
|
int id; // Durch die ID wird dem Selectable eine Funktion zugeordnet
|
|
int state; // 0: not selected | 1: hovered | 2: selected
|
|
int fontSize; // FontSize kann für jede Selectable Description individuell festgelegt werden
|
|
|
|
int unselectAfterExecute; // 0: will unselect | 1 won't unselect
|
|
|
|
// Notiz: Die Selectables können auch in einem 2-Dimensionalen Array im UiContainer gespeichert werden, worüber die Groups auch definiert werden könnten
|
|
int groupID; // Selectables können gruppiert werden, man kann also mehrere Dinge gleichzeitig selected haben
|
|
float scale;
|
|
void (*onSelected)(Game *game, Selectable *selectable);
|
|
}Selectable;
|
|
|
|
// Textures+backgroundTextures: [0]: Normal | [1]: Hovered | [2]: Selected
|
|
// hasBackground: 0: hat keine Background Textur | 1: hat Background Textur
|
|
// showDescription 0: zeigt Description nicht | 1: zeigt Description
|
|
// unselectAfterExecute 0: wird abgewählt | 1: bleibt ausgewählt
|
|
// Max Description LEN 20
|
|
Selectable * SelectableInit(Texture2D *texture, Texture2D **backgroundTextures, int hasBackground, Vector2 *position, char *description, int showDescripton, int descriptionLEN, int fontSize, int id, int groupID, int unselectAfterExecute, float scale);
|
|
|
|
void SelectableExecuteSelectable(Selectable *selectable, Game * game);
|
|
|
|
int SelectableUpdateSelectableState(Selectable * selectable, Game *game);
|
|
|
|
int SelectableUnselectSelectable(Selectable * selectable);
|
|
|
|
void SelectableDrawSelectable(Selectable * selectable);
|
|
|
|
#endif |