diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 3b1e6b6..24f639e 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -8,6 +8,7 @@ idf_component_register(SRCS "ui/ui.c" "ui/ui_helpers.c" "ui/screens/ui_Screen1.c" + "ui/screens/ui_Screen2.c" "ui/widgets/ui_comp_hook.c" PRIV_REQUIRES esp_wifi diff --git a/main/app/ui_handlers.c b/main/app/ui_handlers.c index 7fae882..12a25bb 100644 --- a/main/app/ui_handlers.c +++ b/main/app/ui_handlers.c @@ -1,4 +1,22 @@ #include "ui_handlers.h" #include "ui_events.h" -/* Add callback implementations here when SquareLine Studio generates events. */ +void update_year_action(lv_event_t * e) +{ + (void)e; +} + +void click_button_two(lv_event_t * e) +{ + (void)e; +} + +void click_button_three(lv_event_t * e) +{ + (void)e; +} + +void click_button_one(lv_event_t * e) +{ + (void)e; +} diff --git a/main/ui/components/ui_comp_hook.c b/main/ui/components/ui_comp_hook.c new file mode 100644 index 0000000..a745eac --- /dev/null +++ b/main/ui/components/ui_comp_hook.c @@ -0,0 +1,5 @@ +// This file was generated by SquareLine Studio +// SquareLine Studio version: SquareLine Studio 1.6.1 +// LVGL version: 9.2.2 +// Project name: HeavenlyHeroStar + diff --git a/main/ui/screens/ui_Screen2.c b/main/ui/screens/ui_Screen2.c new file mode 100644 index 0000000..b7c6b0a --- /dev/null +++ b/main/ui/screens/ui_Screen2.c @@ -0,0 +1,116 @@ +// 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; + +} diff --git a/main/ui/screens/ui_Screen2.h b/main/ui/screens/ui_Screen2.h new file mode 100644 index 0000000..21d1f1b --- /dev/null +++ b/main/ui/screens/ui_Screen2.h @@ -0,0 +1,33 @@ +// This file was generated by SquareLine Studio +// SquareLine Studio version: SquareLine Studio 1.6.1 +// LVGL version: 9.2.2 +// Project name: HeavenlyHeroStar + +#ifndef UI_SCREEN2_H +#define UI_SCREEN2_H + +#ifdef __cplusplus +extern "C" { +#endif + +// SCREEN: ui_Screen2 +extern void ui_Screen2_screen_init(void); +extern void ui_Screen2_screen_destroy(void); +extern lv_obj_t * ui_Screen2; +extern void ui_event_Button1(lv_event_t * e); +extern lv_obj_t * ui_Button1; +extern void ui_event_Button2(lv_event_t * e); +extern lv_obj_t * ui_Button2; +extern void ui_event_Button3(lv_event_t * e); +extern lv_obj_t * ui_Button3; +extern lv_obj_t * ui_Label2; +extern lv_obj_t * ui_Label4; +extern lv_obj_t * ui_Label5; +// CUSTOM VARIABLES + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif + diff --git a/main/ui/ui.c b/main/ui/ui.c index f026545..4244d4e 100644 --- a/main/ui/ui.c +++ b/main/ui/ui.c @@ -31,11 +31,13 @@ void ui_init(void) false, LV_FONT_DEFAULT); lv_disp_set_theme(dispp, theme); ui_Screen1_screen_init(); + ui_Screen2_screen_init(); ui____initial_actions0 = lv_obj_create(NULL); - lv_disp_load_scr(ui_Screen1); + lv_disp_load_scr(ui_Screen2); } void ui_destroy(void) { ui_Screen1_screen_destroy(); + ui_Screen2_screen_destroy(); } diff --git a/main/ui/ui.h b/main/ui/ui.h index 4d48021..ebd3211 100644 --- a/main/ui/ui.h +++ b/main/ui/ui.h @@ -19,6 +19,7 @@ extern "C" { ///////////////////// SCREENS //////////////////// #include "screens/ui_Screen1.h" +#include "screens/ui_Screen2.h" ///////////////////// VARIABLES //////////////////// diff --git a/main/ui/ui_events.c b/main/ui/ui_events.c new file mode 100644 index 0000000..0338c26 --- /dev/null +++ b/main/ui/ui_events.c @@ -0,0 +1,26 @@ +// 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" + +void update_year_action(lv_event_t * e) +{ + // Your code here +} + +void click_button_two(lv_event_t * e) +{ + // Your code here +} + +void click_button_three(lv_event_t * e) +{ + // Your code here +} + +void click_button_one(lv_event_t * e) +{ + // Your code here +} diff --git a/main/ui/ui_events.h b/main/ui/ui_events.h index 8cf89a8..cead992 100644 --- a/main/ui/ui_events.h +++ b/main/ui/ui_events.h @@ -10,6 +10,13 @@ extern "C" { #endif +#include "lvgl.h" + +void update_year_action(lv_event_t * e); +void click_button_two(lv_event_t * e); +void click_button_three(lv_event_t * e); +void click_button_one(lv_event_t * e); + #ifdef __cplusplus } /*extern "C"*/ #endif