42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include "bmfont.h"
|
|
#include "st7735.h"
|
|
|
|
#define uiu_ALIGN_HLEFT 0b00000001
|
|
#define uiu_ALIGN_HCENTER 0b00000010
|
|
#define uiu_ALIGN_HRIGHT 0b00000100
|
|
#define uiu_ALIGN_VTOP 0b00010000
|
|
#define uiu_ALIGN_VCENTER 0b00100000
|
|
#define uiu_ALIGN_VBOTTOM 0b01000000
|
|
|
|
#define UI_X 0
|
|
#define UI_Y 16
|
|
#define UI_W (ST7735_WIDTH)
|
|
#define UI_H (ST7735_HEIGHT - 16)
|
|
|
|
typedef struct
|
|
{
|
|
const uint8_t *text;
|
|
const uint32_t len;
|
|
} StrItem;
|
|
|
|
typedef struct
|
|
{
|
|
uint16_t index;
|
|
uint8_t confirmed;
|
|
} IndexResult;
|
|
|
|
|
|
extern const StrItem NULL_STR_ITEM;
|
|
|
|
/** get string item in the list.
|
|
* @param index item index
|
|
* @return STR_ITEM, if STR_ITEM.len == 0 means item not exist.
|
|
*/
|
|
typedef StrItem (*uiu_GetStrItemFunc)(uint16_t index);
|
|
|
|
void uiu_text_area(bmf_BitmapFont *font, const uint8_t *text, uint32_t len, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t align, uint16_t color, uint16_t bg_color);
|
|
void uiu_title(const uint8_t *text, uint32_t len);
|