Files
HeavenlyHeroStar/main/ui/screens/ui_Screen2.c
T
rsgltzyd 73e62c4dfd feat: 添加第二屏幕及其事件处理功能
- 在 CMakeLists.txt 中添加 ui_Screen2.c 源文件以支持新屏幕
- 新增 ui_events.c 和 ui_events.h,定义按钮点击事件处理函数
- 实现 ui_Screen2.c,构建第二屏幕的 UI 组件和事件回调
- 更新 ui.c 以初始化和加载第二屏幕
- 更新相关头文件,确保新屏幕与现有结构兼容
2026-07-01 22:02:31 +08:00

117 lines
3.5 KiB
C

// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.6.1
// LVGL version: 9.2.2
// Project name: HeavenlyHeroStar
#include "../ui.h"
lv_obj_t * ui_Screen2 = NULL;
lv_obj_t * ui_Button1 = NULL;
lv_obj_t * ui_Button2 = NULL;
lv_obj_t * ui_Button3 = NULL;
lv_obj_t * ui_Label2 = NULL;
lv_obj_t * ui_Label4 = NULL;
lv_obj_t * ui_Label5 = NULL;
// event funtions
void ui_event_Button1(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_CLICKED) {
click_button_two(e);
}
}
void ui_event_Button2(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_CLICKED) {
click_button_three(e);
}
}
void ui_event_Button3(lv_event_t * e)
{
lv_event_code_t event_code = lv_event_get_code(e);
if(event_code == LV_EVENT_CLICKED) {
click_button_one(e);
}
}
// build funtions
void ui_Screen2_screen_init(void)
{
ui_Screen2 = lv_obj_create(NULL);
lv_obj_remove_flag(ui_Screen2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_Button1 = lv_button_create(ui_Screen2);
lv_obj_set_width(ui_Button1, 100);
lv_obj_set_height(ui_Button1, 80);
lv_obj_set_align(ui_Button1, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_remove_flag(ui_Button1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_Button2 = lv_button_create(ui_Screen2);
lv_obj_set_width(ui_Button2, 100);
lv_obj_set_height(ui_Button2, 80);
lv_obj_set_x(ui_Button2, 0);
lv_obj_set_y(ui_Button2, 100);
lv_obj_set_align(ui_Button2, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Button2, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_remove_flag(ui_Button2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_Button3 = lv_button_create(ui_Screen2);
lv_obj_set_width(ui_Button3, 100);
lv_obj_set_height(ui_Button3, 80);
lv_obj_set_x(ui_Button3, 0);
lv_obj_set_y(ui_Button3, -100);
lv_obj_set_align(ui_Button3, LV_ALIGN_CENTER);
lv_obj_add_flag(ui_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_remove_flag(ui_Button3, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_Label2 = lv_label_create(ui_Screen2);
lv_obj_set_width(ui_Label2, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Label2, LV_SIZE_CONTENT); /// 1
lv_obj_set_align(ui_Label2, LV_ALIGN_CENTER);
lv_label_set_text(ui_Label2, "Ctrl+C");
ui_Label4 = lv_label_create(ui_Screen2);
lv_obj_set_width(ui_Label4, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Label4, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Label4, 0);
lv_obj_set_y(ui_Label4, 100);
lv_obj_set_align(ui_Label4, LV_ALIGN_CENTER);
lv_label_set_text(ui_Label4, "Ctrl+V");
ui_Label5 = lv_label_create(ui_Screen2);
lv_obj_set_width(ui_Label5, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_Label5, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_Label5, 0);
lv_obj_set_y(ui_Label5, -100);
lv_obj_set_align(ui_Label5, LV_ALIGN_CENTER);
lv_label_set_text(ui_Label5, "Ctrl+X");
lv_obj_add_event_cb(ui_Button1, ui_event_Button1, LV_EVENT_ALL, NULL);
lv_obj_add_event_cb(ui_Button2, ui_event_Button2, LV_EVENT_ALL, NULL);
lv_obj_add_event_cb(ui_Button3, ui_event_Button3, LV_EVENT_ALL, NULL);
}
void ui_Screen2_screen_destroy(void)
{
if(ui_Screen2) lv_obj_del(ui_Screen2);
// NULL screen variables
ui_Screen2 = NULL;
ui_Button1 = NULL;
ui_Button2 = NULL;
ui_Button3 = NULL;
ui_Label2 = NULL;
ui_Label4 = NULL;
ui_Label5 = NULL;
}