mirror of
https://github.com/badgeteam/mch2022-template-app.git
synced 2024-12-22 07:06:38 +00:00
Update UI fonts.
This commit is contained in:
parent
a5718a1d1b
commit
4960e10283
7 changed files with 20 additions and 17 deletions
|
@ -9,6 +9,8 @@ extern const uint8_t mch2022_logo_png_start[] asm("_binary_mch2022_logo_png_star
|
|||
extern const uint8_t mch2022_logo_png_end[] asm("_binary_mch2022_logo_png_end");
|
||||
|
||||
void display_boot_screen(pax_buf_t* pax_buffer, ILI9341* ili9341, const char* text) {
|
||||
const pax_font_t *font = pax_get_font("saira regular");
|
||||
|
||||
pax_noclip(pax_buffer);
|
||||
pax_background(pax_buffer, 0xFFFFFF);
|
||||
pax_buf_t logo;
|
||||
|
@ -16,7 +18,7 @@ void display_boot_screen(pax_buf_t* pax_buffer, ILI9341* ili9341, const char* te
|
|||
pax_draw_image(pax_buffer, &logo, (320 / 2) - (212 / 2), ((240 - 32 - 10) / 2) - (160 / 2));
|
||||
pax_buf_destroy(&logo);
|
||||
|
||||
pax_vec1_t size = pax_text_size(NULL, 18, text);
|
||||
pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, (320 / 2) - (size.x / 2), 240 - 32, text);
|
||||
pax_vec1_t size = pax_text_size(font, 18, text);
|
||||
pax_draw_text(pax_buffer, 0xFF000000, font, 18, (320 / 2) - (size.x / 2), 240 - 32, text);
|
||||
ili9341_write(ili9341, pax_buffer->buf);
|
||||
}
|
||||
|
|
|
@ -183,6 +183,7 @@ void menu_render(pax_buf_t *aBuffer, menu_t* aMenu, float aPosX, float aPosY, fl
|
|||
pax_col_t titleBgColor = aColor;
|
||||
pax_col_t scrollbarBgColor = 0xFFCCCCCC;
|
||||
pax_col_t scrollbarFgColor = 0xFF555555;
|
||||
const pax_font_t *font = pax_get_font("saira regular");
|
||||
|
||||
float entry_height = 18 + 2;
|
||||
size_t maxItems = aHeight / entry_height;
|
||||
|
@ -196,7 +197,7 @@ void menu_render(pax_buf_t *aBuffer, menu_t* aMenu, float aPosX, float aPosY, fl
|
|||
pax_simple_rect(aBuffer, titleBgColor, aPosX, posY, aWidth, entry_height);
|
||||
pax_simple_line(aBuffer, titleColor, aPosX + 1, aPosY + entry_height, aPosX + aWidth - 2, aPosY + entry_height - 1);
|
||||
pax_clip(aBuffer, aPosX + 1, posY + 1, aWidth - 2, entry_height - 2);
|
||||
pax_draw_text(aBuffer, titleColor, NULL, entry_height - 2, aPosX + 1, posY + 1, aMenu->title);
|
||||
pax_draw_text(aBuffer, titleColor, font, entry_height - 2, aPosX + 1, posY + 1, aMenu->title);
|
||||
pax_noclip(aBuffer);
|
||||
posY += entry_height;
|
||||
}
|
||||
|
@ -219,12 +220,12 @@ void menu_render(pax_buf_t *aBuffer, menu_t* aMenu, float aPosX, float aPosY, fl
|
|||
if (index == aMenu->position) {
|
||||
pax_simple_rect(aBuffer, fgColor, aPosX + 1, posY, aWidth - 2, entry_height);
|
||||
pax_clip(aBuffer, aPosX + 1, posY + 1, aWidth - 4, entry_height - 2);
|
||||
pax_draw_text(aBuffer, bgTextColor, NULL, entry_height - 2, aPosX + 1, posY + 1, item->label);
|
||||
pax_draw_text(aBuffer, bgTextColor, font, entry_height - 2, aPosX + 1, posY + 1, item->label);
|
||||
pax_noclip(aBuffer);
|
||||
} else {
|
||||
pax_simple_rect(aBuffer, bgColor, aPosX + 1, posY, aWidth - 2, entry_height);
|
||||
pax_clip(aBuffer, aPosX + 1, posY + 1, aWidth - 4, entry_height - 2);
|
||||
pax_draw_text(aBuffer, fgColor, NULL, entry_height - 2, aPosX + 1, posY + 1, item->label);
|
||||
pax_draw_text(aBuffer, fgColor, font, entry_height - 2, aPosX + 1, posY + 1, item->label);
|
||||
pax_noclip(aBuffer);
|
||||
}
|
||||
posY += entry_height;
|
||||
|
|
|
@ -30,9 +30,10 @@ typedef enum action {
|
|||
} menu_dev_action_t;
|
||||
|
||||
void render_dev_help(pax_buf_t* pax_buffer) {
|
||||
const pax_font_t *font = pax_get_font("saira regular");
|
||||
pax_background(pax_buffer, 0xFFFFFF);
|
||||
pax_noclip(pax_buffer);
|
||||
pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, 5, 240 - 19, "[A] accept [B] back");
|
||||
pax_draw_text(pax_buffer, 0xFF000000, font, 18, 5, 240 - 19, "[A] accept [B] back");
|
||||
}
|
||||
|
||||
void menu_dev(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
|
||||
|
|
|
@ -27,6 +27,7 @@ typedef struct {
|
|||
|
||||
void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
|
||||
menu_t* menu = menu_alloc("Apps");
|
||||
const pax_font_t *font = pax_get_font("saira regular");
|
||||
|
||||
appfs_handle_t appfs_fd = APPFS_INVALID_FD;
|
||||
while (1) {
|
||||
|
@ -45,7 +46,7 @@ void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili
|
|||
|
||||
pax_background(pax_buffer, 0xFFFFFF);
|
||||
pax_noclip(pax_buffer);
|
||||
pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, 5, 240 - 19, "[A] start app [B] back");
|
||||
pax_draw_text(pax_buffer, 0xFF000000, font, 18, 5, 240 - 19, "[A] start app [B] back");
|
||||
|
||||
bool quit = false;
|
||||
|
||||
|
|
|
@ -31,9 +31,10 @@ typedef enum action {
|
|||
} menu_settings_action_t;
|
||||
|
||||
void render_settings_help(pax_buf_t* pax_buffer) {
|
||||
const pax_font_t *font = pax_get_font("saira regular");
|
||||
pax_background(pax_buffer, 0xFFFFFF);
|
||||
pax_noclip(pax_buffer);
|
||||
pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, 5, 240 - 19, "[A] accept [B] back");
|
||||
pax_draw_text(pax_buffer, 0xFF000000, font, 18, 5, 240 - 19, "[A] accept [B] back");
|
||||
}
|
||||
|
||||
void menu_settings(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
|
||||
|
|
|
@ -24,9 +24,10 @@ typedef enum action {
|
|||
} menu_start_action_t;
|
||||
|
||||
void render_start_help(pax_buf_t* pax_buffer) {
|
||||
const pax_font_t *font = pax_get_font("saira regular");
|
||||
pax_background(pax_buffer, 0xFFFFFF);
|
||||
pax_noclip(pax_buffer);
|
||||
pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, 5, 240 - 19, "[A] accept");
|
||||
pax_draw_text(pax_buffer, 0xFF000000, font, 18, 5, 240 - 19, "[A] accept");
|
||||
}
|
||||
|
||||
void menu_start(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341) {
|
||||
|
|
|
@ -60,9 +60,10 @@ typedef enum action {
|
|||
} menu_wifi_action_t;
|
||||
|
||||
void render_wifi_help(pax_buf_t* pax_buffer) {
|
||||
const pax_font_t *font = pax_get_font("saira regular");
|
||||
pax_background(pax_buffer, 0xFFFFFF);
|
||||
pax_noclip(pax_buffer);
|
||||
pax_draw_text(pax_buffer, 0xFF000000, NULL, 18, 5, 240 - 19, "[A] accept [B] back");
|
||||
pax_draw_text(pax_buffer, 0xFF000000, font, 18, 5, 240 - 19, "[A] accept [B] back");
|
||||
}
|
||||
|
||||
void wifi_show(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9341);
|
||||
|
@ -440,12 +441,7 @@ void wifi_setup(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili934
|
|||
/* ==== scanning phase ==== */
|
||||
if (scan) {
|
||||
// Show a little bit of text.
|
||||
char *text = "Scanning...";
|
||||
pax_vec1_t dims = pax_text_size(NULL, 1, text);
|
||||
float scale = pax_buffer->width / dims.x;
|
||||
pax_background(pax_buffer, 0xffffffff);
|
||||
pax_draw_text(pax_buffer, 0xff000000, NULL, scale, 0, (pax_buffer->height - dims.y*scale)/2, text);
|
||||
ili9341_write(ili9341, pax_buffer->buf);
|
||||
display_boot_screen(pax_buffer, ili9341, "Scanning WiFi networks...");
|
||||
|
||||
// Scan for networks.
|
||||
wifi_ap_record_t *aps;
|
||||
|
|
Loading…
Reference in a new issue