basic ui controls

This commit is contained in:
Rysertio 2024-02-21 09:46:44 +06:00
parent 17fdac54f4
commit c690a9e083
2 changed files with 10 additions and 0 deletions

View file

@ -29,6 +29,7 @@ void handleButtonEvents(SDL_Event *event, Button buttons[], int numButtons) {
for (int i = 0; i < numButtons; i++) { for (int i = 0; i < numButtons; i++) {
handleButtonClick(event, &buttons[i]); handleButtonClick(event, &buttons[i]);
} }
<<<<<<< HEAD
} }
void drawButtons(SDL_Renderer *renderer, Button buttons[], int numButtons, TTF_Font *font) { void drawButtons(SDL_Renderer *renderer, Button buttons[], int numButtons, TTF_Font *font) {
@ -65,3 +66,6 @@ void drawButtons(SDL_Renderer *renderer, Button buttons[], int numButtons, TTF_F
// Present renderer // Present renderer
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);
} }
=======
}
>>>>>>> 206ed0e (basic ui controls)

View file

@ -9,13 +9,19 @@ typedef struct {
int x, y, w, h; int x, y, w, h;
bool clicked; bool clicked;
void (*onClick)(); void (*onClick)();
<<<<<<< HEAD
char text[50]; char text[50];
=======
>>>>>>> 206ed0e (basic ui controls)
} Button; } Button;
// Function prototypes // Function prototypes
bool isPointInsideRect(int x, int y, SDL_Rect rect); bool isPointInsideRect(int x, int y, SDL_Rect rect);
void handleButtonClick(SDL_Event *event, Button *button); void handleButtonClick(SDL_Event *event, Button *button);
void handleButtonEvents(SDL_Event *event, Button buttons[], int numButtons); void handleButtonEvents(SDL_Event *event, Button buttons[], int numButtons);
<<<<<<< HEAD
void drawButtons(SDL_Renderer *renderer, Button buttons[], int numButtons, TTF_Font *font); void drawButtons(SDL_Renderer *renderer, Button buttons[], int numButtons, TTF_Font *font);
=======
>>>>>>> 206ed0e (basic ui controls)
#endif /* UI_H */ #endif /* UI_H */