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++) { | ||||
|         handleButtonClick(event, &buttons[i]); | ||||
|     } | ||||
| <<<<<<< HEAD | ||||
| } | ||||
| 
 | ||||
| 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
 | ||||
|     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; | ||||
|     bool clicked; | ||||
|     void (*onClick)(); | ||||
| <<<<<<< HEAD | ||||
|     char text[50]; | ||||
| ======= | ||||
| >>>>>>> 206ed0e (basic ui controls) | ||||
| } Button; | ||||
| 
 | ||||
| // Function prototypes
 | ||||
| bool isPointInsideRect(int x, int y, SDL_Rect rect); | ||||
| void handleButtonClick(SDL_Event *event, Button *button); | ||||
| void handleButtonEvents(SDL_Event *event, Button buttons[], int numButtons); | ||||
| <<<<<<< HEAD | ||||
| void drawButtons(SDL_Renderer *renderer, Button buttons[], int numButtons, TTF_Font *font);  | ||||
| ======= | ||||
| >>>>>>> 206ed0e (basic ui controls) | ||||
| 
 | ||||
| #endif /* UI_H */ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue