screenWelcomme.hpp (1111B)
1 #ifndef SCREEN_WELCOME_H 2 #define SCREEN_WELCOME_H 3 #include "screen.hpp" 4 #include <cstdint> 5 #include <functional> 6 #include <src/core/lv_obj_event.h> 7 #include <src/core/lv_obj_pos.h> 8 #include <src/core/lv_obj_style.h> 9 #include <src/misc/lv_area.h> 10 #include <src/misc/lv_event.h> 11 #include <src/misc/lv_types.h> 12 #include <src/widgets/button/lv_button.h> 13 #include <src/widgets/label/lv_label.h> 14 15 #include "global.hpp" 16 17 18 class ScreenWelcome : public Screen { 19 private: 20 lv_obj_t *startButton; 21 22 static void startButtonEvent(lv_event_t *e){ 23 event(EVENT_BUTTON_START); 24 } 25 26 public: 27 ScreenWelcome(){ 28 //Set set the "instruction" 29 lv_label_set_text(instructionLabel, "Press Start to begin..."); 30 31 32 //Add button "Start" 33 startButton = lv_button_create(buttonsContainer); 34 lv_obj_add_style(startButton, &buttonDefaultStyle, 0); 35 lv_obj_t *label = lv_label_create(startButton); 36 lv_label_set_text(label, "Start"); 37 lv_obj_add_style(label, &buttonLabelDefaultStyle, 0); 38 lv_obj_add_event_cb(startButton, startButtonEvent, LV_EVENT_CLICKED, NULL); 39 } 40 }; 41 #endif