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.

31 lines
1.0 KiB

#ifndef BUTTONS_H_
#define BUTTONS_H_
#include "raylib.h"
#include "../game.h"
typedef struct Button Button;
typedef struct Button{
Texture2D **textures; // [0]: Normal [1]: Hovered [2]: Pressed
Vector2 position; // Linke obere Ecke des Buttons
Vector2 centerPosition; // Die Mitte des Buttons
char text[20]; // Text, den der Button zentriert anzeigt, aktuell max. 19 Zeichen
int state; // 0: default 1: hovered 2: pressed 3: released
int id; // Durch die ID wird dem Button eine Funktion zugeordnet
int fontSize; // FontSize kann für jeden Button individuell festgelegt werden
void (*onClick)(Game *game, Button *button);
} Button;
// Textures: [0]: Normal [1]: Hovered [2]: Pressed [3]: Released
Button * ButtonInitButton(Texture2D **textures, Vector2 *position, char *text, int textLEN, int fontSize, int id);
void ButtonExecuteButton(Button *button, Game * game);
int ButtonUpdateButtonState(Button * button, Game *game);
void ButtonDrawButton(Button * button);
#endif