acid-drop

- Hacking the planet from a LilyGo T-Deck using custom firmware
git clone git://git.acid.vegas/acid-drop.git
Log | Files | Refs | Archive | README | LICENSE

lv_example_bar_2.c (1044B)

      1 #include "../../lv_examples.h"
      2 #if LV_USE_BAR && LV_BUILD_EXAMPLES
      3 
      4 /**
      5  * Example of styling the bar
      6  */
      7 void lv_example_bar_2(void)
      8 {
      9     static lv_style_t style_bg;
     10     static lv_style_t style_indic;
     11 
     12     lv_style_init(&style_bg);
     13     lv_style_set_border_color(&style_bg, lv_palette_main(LV_PALETTE_BLUE));
     14     lv_style_set_border_width(&style_bg, 2);
     15     lv_style_set_pad_all(&style_bg, 6); /*To make the indicator smaller*/
     16     lv_style_set_radius(&style_bg, 6);
     17     lv_style_set_anim_time(&style_bg, 1000);
     18 
     19     lv_style_init(&style_indic);
     20     lv_style_set_bg_opa(&style_indic, LV_OPA_COVER);
     21     lv_style_set_bg_color(&style_indic, lv_palette_main(LV_PALETTE_BLUE));
     22     lv_style_set_radius(&style_indic, 3);
     23 
     24     lv_obj_t * bar = lv_bar_create(lv_scr_act());
     25     lv_obj_remove_style_all(bar);  /*To have a clean start*/
     26     lv_obj_add_style(bar, &style_bg, 0);
     27     lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR);
     28 
     29     lv_obj_set_size(bar, 200, 20);
     30     lv_obj_center(bar);
     31     lv_bar_set_value(bar, 100, LV_ANIM_ON);
     32 }
     33 
     34 #endif