Add drawing buttons
This commit is contained in:
		
							
								
								
									
										16
									
								
								include/button.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								include/button.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| #ifndef BUTTON_H | ||||
| #define BUTTON_H | ||||
|  | ||||
| #include "window.h" | ||||
|  | ||||
| #define BUTTON_WIDTH 100 | ||||
| #define BUTTON_HEIGHT 40 | ||||
|  | ||||
| typedef struct button button_t; | ||||
| struct button { | ||||
|   rect_t rect; | ||||
| }; | ||||
|  | ||||
| void draw_button(const window_t *wnd, const button_t *button); | ||||
|  | ||||
| #endif // !BUTTON_H | ||||
							
								
								
									
										10
									
								
								src/button.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								src/button.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| #include "button.h" | ||||
| #include "window.h" | ||||
|  | ||||
| #define BUTTON_FILL_COLOUR ((colour_t){.abgr = 0xff89a83c}) | ||||
| #define BUTTON_BORDER_COLOUR ((colour_t){.abgr = 0xff768432}) | ||||
|  | ||||
| void draw_button(const window_t *wnd, const button_t *button) { | ||||
|   fill_rect(wnd, &(button->rect), BUTTON_FILL_COLOUR); | ||||
|   draw_rect(wnd, &(button->rect), BUTTON_BORDER_COLOUR); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user