firmware: Semi-working emoji
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
idf_component_register(
|
||||
SRCS "valconomy.c" "ui.c" "lcd.c" "usb.c" "font/tungsten_40.c" "font/tungsten_180.c" "img/bg.c"
|
||||
SRCS "valconomy.c" "ui.c" "lcd.c" "usb.c" "font/tungsten_40.c" "font/tungsten_180.c" "img/bg.c" "img/moon.c" "img/star.c"
|
||||
INCLUDE_DIRS ".")
|
||||
|
@@ -14,6 +14,23 @@ static lv_obj_t *o_container = NULL;
|
||||
static lv_anim_timeline_t *at_active = NULL;
|
||||
static lv_obj_t *o_active = NULL;
|
||||
|
||||
static const void* imgfont_get_path(
|
||||
const lv_font_t *font, uint32_t unicode, uint32_t unicode_next, int32_t *offset_y, void *user_data) {
|
||||
LV_UNUSED(font);
|
||||
LV_UNUSED(unicode_next);
|
||||
LV_UNUSED(offset_y);
|
||||
LV_UNUSED(user_data);
|
||||
|
||||
switch (unicode) {
|
||||
case 0x1F319:
|
||||
return &ui_img_moon;
|
||||
case 0x2B50:
|
||||
return &ui_img_star;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void b_cfg_cb(lv_event_t *e) {
|
||||
lv_obj_t *box = lv_msgbox_create(NULL);
|
||||
lv_msgbox_add_title(box, "Hello");
|
||||
@@ -56,7 +73,7 @@ void val_ui_none() {
|
||||
lv_obj_t *l_main = lv_label_create(o_active);
|
||||
lv_obj_add_style(l_main, &s_hero, 0);
|
||||
lv_obj_center(l_main);
|
||||
lv_label_set_text_static(l_main, "HELLO MS!");
|
||||
lv_label_set_text_static(l_main, "HELLO \U0001F319\u2B50!");
|
||||
|
||||
lv_obj_t *l_subtitle = lv_label_create(o_active);
|
||||
lv_obj_add_style(l_subtitle, &s_subtitle, 0);
|
||||
@@ -108,7 +125,7 @@ void val_ui_none() {
|
||||
lv_anim_timeline_add(at_active, 0, &a_sub);
|
||||
lv_anim_timeline_add(at_active, 750, &a_hello_out);
|
||||
lv_anim_timeline_add(at_active, 1000, &a_val);
|
||||
lv_anim_timeline_start(at_active);
|
||||
// lv_anim_timeline_start(at_active);
|
||||
}
|
||||
|
||||
void val_lvgl_ui(lv_display_t *disp) {
|
||||
@@ -125,8 +142,12 @@ void val_lvgl_ui(lv_display_t *disp) {
|
||||
font_normal);
|
||||
// lv_sysmon_hide_performance(disp);
|
||||
|
||||
lv_font_t *f_hero_emoji = lv_imgfont_create(180, imgfont_get_path, NULL);
|
||||
assert(f_hero_emoji);
|
||||
f_hero_emoji->fallback = &lv_font_tungsten_180;
|
||||
|
||||
lv_style_init(&s_hero);
|
||||
lv_style_set_text_font(&s_hero, &lv_font_tungsten_180);
|
||||
lv_style_set_text_font(&s_hero, f_hero_emoji);
|
||||
lv_style_set_text_color(&s_hero, color_text_hero);
|
||||
|
||||
lv_style_init(&s_subtitle);
|
||||
|
@@ -6,5 +6,7 @@ LV_FONT_DECLARE(lv_font_tungsten_40)
|
||||
LV_FONT_DECLARE(lv_font_tungsten_180)
|
||||
|
||||
LV_IMAGE_DECLARE(ui_img_bg);
|
||||
LV_IMAGE_DECLARE(ui_img_moon);
|
||||
LV_IMAGE_DECLARE(ui_img_star);
|
||||
|
||||
void val_lvgl_ui(lv_display_t *disp);
|
||||
|
Reference in New Issue
Block a user