basic ui controls
This commit is contained in:
parent
17fdac54f4
commit
c690a9e083
2 changed files with 10 additions and 0 deletions
4
src/ui.c
4
src/ui.c
|
@ -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)
|
||||||
|
|
6
src/ui.h
6
src/ui.h
|
@ -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 */
|
||||||
|
|
Loading…
Reference in a new issue