lvgl hello world
This commit is contained in:
42
main/main.c
42
main/main.c
@ -9,18 +9,50 @@
|
||||
#include "lvgl.h"
|
||||
#include "bsp/esp-bsp.h"
|
||||
#include "bsp/display.h"
|
||||
#include "lv_demos.h"
|
||||
|
||||
static const lv_font_t * font_large;
|
||||
static lv_style_t style_bw;
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
|
||||
bsp_display_start();
|
||||
|
||||
bsp_display_lock(0);
|
||||
bsp_display_lock(100);
|
||||
|
||||
//lv_demo_music();
|
||||
// lv_demo_benchmark();
|
||||
lv_demo_widgets();
|
||||
bsp_display_brightness_set(20);
|
||||
|
||||
font_large = &lv_font_montserrat_18;
|
||||
|
||||
lv_style_init(&style_bw);
|
||||
//lv_style_set_text_font(&style_bw, font_large);
|
||||
lv_style_set_bg_color(&style_bw, lv_color_hex(0x000000));
|
||||
lv_style_set_text_color(&style_bw, lv_color_hex(0xffffff));
|
||||
lv_style_set_radius(&style_bw, 0);
|
||||
lv_obj_add_style(lv_screen_active(), &style_bw, LV_PART_MAIN);
|
||||
|
||||
/*
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_add_style(cont, &style_bw, LV_PART_MAIN);
|
||||
lv_obj_set_style_border_width(cont, 0, LV_PART_MAIN);
|
||||
lv_obj_set_size(cont, lv_pct(100), lv_pct(100));
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN);
|
||||
*/
|
||||
|
||||
lv_obj_t * title = lv_label_create(lv_screen_active());
|
||||
lv_obj_add_style(title, &style_bw, LV_PART_MAIN);
|
||||
lv_label_set_text(title, "freeside minimap");
|
||||
lv_obj_set_align(title, LV_ALIGN_TOP_MID);
|
||||
|
||||
lv_obj_t * text = lv_textarea_create(lv_screen_active());
|
||||
lv_obj_add_style(text, &style_bw, LV_PART_MAIN);
|
||||
lv_obj_set_pos(text, 50, 25);
|
||||
lv_textarea_add_text(text, "hello");
|
||||
lv_textarea_add_text(text, "world!");
|
||||
lv_textarea_add_text(text, "\nnewline");
|
||||
|
||||
|
||||
|
||||
bsp_display_unlock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user