feat: 更新ui_Screen1.c、ui_Screen2.c 和 ui_Screen3.c ,引入 board_config.h 以获取屏幕分辨率
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
// Project name: HeavenlyHeroStar
|
// Project name: HeavenlyHeroStar
|
||||||
|
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
|
#include "board_config.h"
|
||||||
|
|
||||||
lv_obj_t * uic_Calendar1;
|
lv_obj_t * uic_Calendar1;
|
||||||
lv_obj_t * ui_Screen1 = NULL;
|
lv_obj_t * ui_Screen1 = NULL;
|
||||||
@@ -15,12 +16,13 @@ lv_obj_t * ui_Calendar1 = NULL;
|
|||||||
void ui_Screen1_screen_init(void)
|
void ui_Screen1_screen_init(void)
|
||||||
{
|
{
|
||||||
ui_Screen1 = lv_obj_create(NULL);
|
ui_Screen1 = lv_obj_create(NULL);
|
||||||
|
lv_obj_set_size(ui_Screen1, BOARD_LCD_LOGIC_H_RES, BOARD_LCD_LOGIC_V_RES);
|
||||||
lv_obj_remove_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
lv_obj_remove_flag(ui_Screen1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||||
|
|
||||||
ui_Calendar1 = lv_calendar_create(ui_Screen1);
|
ui_Calendar1 = lv_calendar_create(ui_Screen1);
|
||||||
lv_obj_t * ui_Calendar1_header = lv_calendar_header_arrow_create(ui_Calendar1);
|
lv_obj_t * ui_Calendar1_header = lv_calendar_header_arrow_create(ui_Calendar1);
|
||||||
lv_obj_set_width(ui_Calendar1, 170);
|
lv_obj_set_width(ui_Calendar1, BOARD_LCD_LOGIC_H_RES);
|
||||||
lv_obj_set_height(ui_Calendar1, 320);
|
lv_obj_set_height(ui_Calendar1, BOARD_LCD_LOGIC_V_RES);
|
||||||
lv_obj_set_align(ui_Calendar1, LV_ALIGN_CENTER);
|
lv_obj_set_align(ui_Calendar1, LV_ALIGN_CENTER);
|
||||||
|
|
||||||
uic_Calendar1 = ui_Calendar1;
|
uic_Calendar1 = ui_Calendar1;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
// Project name: HeavenlyHeroStar
|
// Project name: HeavenlyHeroStar
|
||||||
|
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
|
#include "board_config.h"
|
||||||
|
|
||||||
lv_obj_t * ui_Screen2 = NULL;
|
lv_obj_t * ui_Screen2 = NULL;
|
||||||
lv_obj_t * ui_Button1 = NULL;
|
lv_obj_t * ui_Button1 = NULL;
|
||||||
@@ -45,11 +46,14 @@ void ui_event_Button3(lv_event_t * e)
|
|||||||
void ui_Screen2_screen_init(void)
|
void ui_Screen2_screen_init(void)
|
||||||
{
|
{
|
||||||
ui_Screen2 = lv_obj_create(NULL);
|
ui_Screen2 = lv_obj_create(NULL);
|
||||||
|
lv_obj_set_size(ui_Screen2, BOARD_LCD_LOGIC_H_RES, BOARD_LCD_LOGIC_V_RES);
|
||||||
lv_obj_remove_flag(ui_Screen2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
lv_obj_remove_flag(ui_Screen2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||||
|
|
||||||
ui_Button1 = lv_button_create(ui_Screen2);
|
ui_Button1 = lv_button_create(ui_Screen2);
|
||||||
lv_obj_set_width(ui_Button1, 100);
|
lv_obj_set_width(ui_Button1, 100);
|
||||||
lv_obj_set_height(ui_Button1, 80);
|
lv_obj_set_height(ui_Button1, 80);
|
||||||
|
lv_obj_set_x(ui_Button1, -100);
|
||||||
|
lv_obj_set_y(ui_Button1, 0);
|
||||||
lv_obj_set_align(ui_Button1, LV_ALIGN_CENTER);
|
lv_obj_set_align(ui_Button1, LV_ALIGN_CENTER);
|
||||||
lv_obj_add_flag(ui_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
lv_obj_add_flag(ui_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||||
lv_obj_remove_flag(ui_Button1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
lv_obj_remove_flag(ui_Button1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||||
@@ -58,7 +62,7 @@ void ui_Screen2_screen_init(void)
|
|||||||
lv_obj_set_width(ui_Button2, 100);
|
lv_obj_set_width(ui_Button2, 100);
|
||||||
lv_obj_set_height(ui_Button2, 80);
|
lv_obj_set_height(ui_Button2, 80);
|
||||||
lv_obj_set_x(ui_Button2, 0);
|
lv_obj_set_x(ui_Button2, 0);
|
||||||
lv_obj_set_y(ui_Button2, 100);
|
lv_obj_set_y(ui_Button2, 0);
|
||||||
lv_obj_set_align(ui_Button2, LV_ALIGN_CENTER);
|
lv_obj_set_align(ui_Button2, LV_ALIGN_CENTER);
|
||||||
lv_obj_add_flag(ui_Button2, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
lv_obj_add_flag(ui_Button2, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||||
lv_obj_remove_flag(ui_Button2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
lv_obj_remove_flag(ui_Button2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||||
@@ -66,8 +70,8 @@ void ui_Screen2_screen_init(void)
|
|||||||
ui_Button3 = lv_button_create(ui_Screen2);
|
ui_Button3 = lv_button_create(ui_Screen2);
|
||||||
lv_obj_set_width(ui_Button3, 100);
|
lv_obj_set_width(ui_Button3, 100);
|
||||||
lv_obj_set_height(ui_Button3, 80);
|
lv_obj_set_height(ui_Button3, 80);
|
||||||
lv_obj_set_x(ui_Button3, 0);
|
lv_obj_set_x(ui_Button3, 100);
|
||||||
lv_obj_set_y(ui_Button3, -100);
|
lv_obj_set_y(ui_Button3, 0);
|
||||||
lv_obj_set_align(ui_Button3, LV_ALIGN_CENTER);
|
lv_obj_set_align(ui_Button3, LV_ALIGN_CENTER);
|
||||||
lv_obj_add_flag(ui_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
lv_obj_add_flag(ui_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||||
lv_obj_remove_flag(ui_Button3, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
lv_obj_remove_flag(ui_Button3, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||||
@@ -75,6 +79,8 @@ void ui_Screen2_screen_init(void)
|
|||||||
ui_Label2 = lv_label_create(ui_Screen2);
|
ui_Label2 = lv_label_create(ui_Screen2);
|
||||||
lv_obj_set_width(ui_Label2, LV_SIZE_CONTENT); /// 1
|
lv_obj_set_width(ui_Label2, LV_SIZE_CONTENT); /// 1
|
||||||
lv_obj_set_height(ui_Label2, LV_SIZE_CONTENT); /// 1
|
lv_obj_set_height(ui_Label2, LV_SIZE_CONTENT); /// 1
|
||||||
|
lv_obj_set_x(ui_Label2, -100);
|
||||||
|
lv_obj_set_y(ui_Label2, 0);
|
||||||
lv_obj_set_align(ui_Label2, LV_ALIGN_CENTER);
|
lv_obj_set_align(ui_Label2, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(ui_Label2, "Ctrl+C");
|
lv_label_set_text(ui_Label2, "Ctrl+C");
|
||||||
|
|
||||||
@@ -82,15 +88,15 @@ void ui_Screen2_screen_init(void)
|
|||||||
lv_obj_set_width(ui_Label4, LV_SIZE_CONTENT); /// 1
|
lv_obj_set_width(ui_Label4, LV_SIZE_CONTENT); /// 1
|
||||||
lv_obj_set_height(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_x(ui_Label4, 0);
|
||||||
lv_obj_set_y(ui_Label4, 100);
|
lv_obj_set_y(ui_Label4, 0);
|
||||||
lv_obj_set_align(ui_Label4, LV_ALIGN_CENTER);
|
lv_obj_set_align(ui_Label4, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(ui_Label4, "Ctrl+V");
|
lv_label_set_text(ui_Label4, "Ctrl+V");
|
||||||
|
|
||||||
ui_Label5 = lv_label_create(ui_Screen2);
|
ui_Label5 = lv_label_create(ui_Screen2);
|
||||||
lv_obj_set_width(ui_Label5, LV_SIZE_CONTENT); /// 1
|
lv_obj_set_width(ui_Label5, LV_SIZE_CONTENT); /// 1
|
||||||
lv_obj_set_height(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_x(ui_Label5, 100);
|
||||||
lv_obj_set_y(ui_Label5, -100);
|
lv_obj_set_y(ui_Label5, 0);
|
||||||
lv_obj_set_align(ui_Label5, LV_ALIGN_CENTER);
|
lv_obj_set_align(ui_Label5, LV_ALIGN_CENTER);
|
||||||
lv_label_set_text(ui_Label5, "Ctrl+X");
|
lv_label_set_text(ui_Label5, "Ctrl+X");
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
// Project name: HeavenlyHeroStar
|
// Project name: HeavenlyHeroStar
|
||||||
|
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
|
#include "board_config.h"
|
||||||
|
|
||||||
lv_obj_t * ui_Screen3 = NULL;
|
lv_obj_t * ui_Screen3 = NULL;
|
||||||
lv_obj_t * ui_BtnVolDown = NULL;
|
lv_obj_t * ui_BtnVolDown = NULL;
|
||||||
@@ -23,8 +24,8 @@ static void ui_screen3_create_button(lv_obj_t **btn, lv_obj_t **label, int32_t x
|
|||||||
const char *text)
|
const char *text)
|
||||||
{
|
{
|
||||||
*btn = lv_button_create(ui_Screen3);
|
*btn = lv_button_create(ui_Screen3);
|
||||||
lv_obj_set_width(*btn, 75);
|
lv_obj_set_width(*btn, 90);
|
||||||
lv_obj_set_height(*btn, 90);
|
lv_obj_set_height(*btn, 45);
|
||||||
lv_obj_set_x(*btn, x);
|
lv_obj_set_x(*btn, x);
|
||||||
lv_obj_set_y(*btn, y);
|
lv_obj_set_y(*btn, y);
|
||||||
lv_obj_set_align(*btn, LV_ALIGN_CENTER);
|
lv_obj_set_align(*btn, LV_ALIGN_CENTER);
|
||||||
@@ -100,14 +101,15 @@ void ui_event_BtnNext(lv_event_t * e)
|
|||||||
void ui_Screen3_screen_init(void)
|
void ui_Screen3_screen_init(void)
|
||||||
{
|
{
|
||||||
ui_Screen3 = lv_obj_create(NULL);
|
ui_Screen3 = lv_obj_create(NULL);
|
||||||
|
lv_obj_set_size(ui_Screen3, BOARD_LCD_LOGIC_H_RES, BOARD_LCD_LOGIC_V_RES);
|
||||||
lv_obj_remove_flag(ui_Screen3, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_remove_flag(ui_Screen3, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
|
|
||||||
ui_screen3_create_button(&ui_BtnVolDown, &ui_LabelVolDown, -42, -107, "Vol-");
|
ui_screen3_create_button(&ui_BtnVolDown, &ui_LabelVolDown, -50, -55, "Vol-");
|
||||||
ui_screen3_create_button(&ui_BtnVolUp, &ui_LabelVolUp, 42, -107, "Vol+");
|
ui_screen3_create_button(&ui_BtnVolUp, &ui_LabelVolUp, 50, -55, "Vol+");
|
||||||
ui_screen3_create_button(&ui_BtnMute, &ui_LabelMute, -42, 0, "Mute");
|
ui_screen3_create_button(&ui_BtnMute, &ui_LabelMute, -50, 0, "Mute");
|
||||||
ui_screen3_create_button(&ui_BtnPlayPause, &ui_LabelPlayPause, 42, 0, "Play");
|
ui_screen3_create_button(&ui_BtnPlayPause, &ui_LabelPlayPause, 50, 0, "Play");
|
||||||
ui_screen3_create_button(&ui_BtnPrev, &ui_LabelPrev, -42, 107, "Prev");
|
ui_screen3_create_button(&ui_BtnPrev, &ui_LabelPrev, -50, 55, "Prev");
|
||||||
ui_screen3_create_button(&ui_BtnNext, &ui_LabelNext, 42, 107, "Next");
|
ui_screen3_create_button(&ui_BtnNext, &ui_LabelNext, 50, 55, "Next");
|
||||||
|
|
||||||
lv_obj_add_event_cb(ui_BtnVolDown, ui_event_BtnVolDown, LV_EVENT_ALL, NULL);
|
lv_obj_add_event_cb(ui_BtnVolDown, ui_event_BtnVolDown, LV_EVENT_ALL, NULL);
|
||||||
lv_obj_add_event_cb(ui_BtnVolUp, ui_event_BtnVolUp, LV_EVENT_ALL, NULL);
|
lv_obj_add_event_cb(ui_BtnVolUp, ui_event_BtnVolUp, LV_EVENT_ALL, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user