lvgl 8.2
void ui_init(void)
{
lv_disp_t * dispp = lv_disp_get_default();
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
false, LV_FONT_DEFAULT);
lv_disp_set_theme(dispp, theme);
ui_START_screen_init();
ui_M1_screen_init();
ui_M2_screen_init();
ui_M11_screen_init();
ui_M22_screen_init();
ui____initial_actions0 = lv_obj_create(NULL);
lv_disp_load_scr(ui_START);
}
void ui_START_screen_init(void)
{
ui_START = lv_obj_create(NULL);
lv_obj_clear_flag(ui_START, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_Image7 = lv_img_create(ui_START);
lv_img_set_src(ui_Image7, &ui_img_1311359175);
lv_obj_set_width(ui_Image7, LV_SIZE_CONTENT); /// 244
lv_obj_set_height(ui_Image7, LV_SIZE_CONTENT); /// 244
lv_obj_set_align(ui_Image7, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Image7, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_Image7, LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_add_event_cb(ui_Image7, ui_event_Image7, LV_EVENT_ALL, NULL);
lv_obj_add_event_cb(ui_START, ui_event_START, LV_EVENT_ALL, NULL);
}
void ui_event_START(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
lv_obj_t * target = lv_event_get_target(e);
if(event_code == LV_EVENT_SCREEN_LOADED) {
_ui_screen_change(&ui_M1, LV_SCR_LOAD_ANIM_FADE_ON, 500, 1000, &ui_M1_screen_init);
}
}
void ui_M1_screen_init(void)
{
ui_M1 = lv_obj_create(NULL);
lv_obj_clear_flag(ui_M1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_S1 = lv_img_create(ui_M1);
lv_img_set_src(ui_S1, &ui_impng);
lv_obj_set_width(ui_S1, LV_SIZE_CONTENT); /// 244
lv_obj_set_height(ui_S1, LV_SIZE_CONTENT); /// 244
lv_obj_set_align(ui_S1, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_S1, LV_OBJ_FLAG_ADV_HITTEST); /// Flags
lv_obj_clear_flag(ui_S1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
}
```cpp
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void))
{
if(*target == NULL)
target_init();
lv_scr_load_anim(*target, fademode, spd, delay, false);
}
————————————————
版权声明:本文为CSDN博主「8421plus」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/iyy123IUU/article/details/132907598
|