83 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /**
 | |
|  * Copyright (c) 2024 Dominic Masters
 | |
|  * 
 | |
|  * This software is released under the MIT License.
 | |
|  * https://opensource.org/licenses/MIT
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| #include "display/frame.h"
 | |
| #include "ui/menu.h"
 | |
| 
 | |
| #define DRAW_UI_TEXTBOX_WIDTH FRAME_WIDTH
 | |
| #define DRAW_UI_TEXTBOX_HEIGHT 8
 | |
| #define DRAW_UI_TEXTBOX_CURSOR_POS ((FRAME_HEIGHT * FRAME_WIDTH) - 4)
 | |
| #define DRAW_UI_TEXTBOX_BLINKS_PER_SECOND 2
 | |
| 
 | |
| /**
 | |
|  * Draws a UI box to the frame buffer.
 | |
|  * 
 | |
|  * @param x The x position to draw the border.
 | |
|  * @param y The y position to draw the border.
 | |
|  * @param width The width of the border.
 | |
|  * @param height The height of the border.
 | |
|  * @param color The color to draw the border.
 | |
|  * @param fill Whether or not to fill the inside of the border.
 | |
|  */
 | |
| void drawUIBox(
 | |
|   const uint16_t x,
 | |
|   const uint16_t y,
 | |
|   const uint16_t width,
 | |
|   const uint16_t height,
 | |
|   const uint8_t color,
 | |
|   const bool_t fill
 | |
| );
 | |
| 
 | |
| /**
 | |
|  * Draws a UI menu to the frame buffer.
 | |
|  * 
 | |
|  * @param menu The menu to draw.
 | |
|  * @param x The x position to draw the menu.
 | |
|  * @param y The y position to draw the menu.
 | |
|  * @param width The width of the menu.
 | |
|  * @param height The height of the menu.
 | |
|  * @param cursorColor The color of the cursor.
 | |
|  * @param textColor The color of the text.
 | |
|  */
 | |
| void drawUIMenu(
 | |
|   menu_t *menu,
 | |
|   const uint16_t x,
 | |
|   const uint16_t y,
 | |
|   const uint16_t width,
 | |
|   const uint16_t height,
 | |
|   const uint8_t cursorColor,
 | |
|   const uint8_t textColor
 | |
| );
 | |
| 
 | |
| /**
 | |
|  * Draws a UI menu box to the frame buffer.
 | |
|  * 
 | |
|  * @param menu The menu to draw.
 | |
|  * @param x The x position to draw the menu.
 | |
|  * @param y The y position to draw the menu.
 | |
|  * @param width The width of the menu.
 | |
|  * @param height The height of the menu.
 | |
|  * @param cursorColor The color of the cursor.
 | |
|  * @param textColor The color of the text.
 | |
|  * @param boxColor The color of the box.
 | |
|  */
 | |
| void drawUIMenuBox(
 | |
|   menu_t *menu,
 | |
|   const uint16_t x,
 | |
|   const uint16_t y,
 | |
|   const uint16_t width,
 | |
|   const uint16_t height,
 | |
|   const uint8_t cursorColor,
 | |
|   const uint8_t textColor,
 | |
|   const uint8_t boxColor
 | |
| );
 | |
| 
 | |
| /**
 | |
|  * Draws the UI textbox to the frame buffer.
 | |
|  */
 | |
| void drawUITextbox(); |