diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-01 15:41:47 +1000 |
| commit | dd27c3530432ea0b09f01e604bf577f31d8ef841 (patch) | |
| tree | bbf86cf81a78f0ff0b07f31f1c390db473f26fd3 /lib/lvgl/examples/widgets/line | |
| parent | 6fd588e970470b15936187980829916d0dbe77bb (diff) | |
| download | tangara-fw-dd27c3530432ea0b09f01e604bf577f31d8ef841.tar.gz | |
convert lvgl from submodule to a plain old directory
Diffstat (limited to 'lib/lvgl/examples/widgets/line')
| m--------- | lib/lvgl | 0 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/line/index.rst | 7 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/line/lv_example_line_1.c | 24 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/line/lv_example_line_1.py | 20 |
4 files changed, 51 insertions, 0 deletions
diff --git a/lib/lvgl b/lib/lvgl deleted file mode 160000 -Subproject 0732400e7b564dd0e7dc4a924619d8e19c5b23a diff --git a/lib/lvgl/examples/widgets/line/index.rst b/lib/lvgl/examples/widgets/line/index.rst new file mode 100644 index 00000000..156359a7 --- /dev/null +++ b/lib/lvgl/examples/widgets/line/index.rst @@ -0,0 +1,7 @@ + +Simple Line +"""""""""""""""" + +.. lv_example:: widgets/line/lv_example_line_1 + :language: c + diff --git a/lib/lvgl/examples/widgets/line/lv_example_line_1.c b/lib/lvgl/examples/widgets/line/lv_example_line_1.c new file mode 100644 index 00000000..9c120a29 --- /dev/null +++ b/lib/lvgl/examples/widgets/line/lv_example_line_1.c @@ -0,0 +1,24 @@ +#include "../../lv_examples.h" +#if LV_USE_LINE && LV_BUILD_EXAMPLES + +void lv_example_line_1(void) +{ + /*Create an array for the points of the line*/ + static lv_point_t line_points[] = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10} }; + + /*Create style*/ + static lv_style_t style_line; + lv_style_init(&style_line); + lv_style_set_line_width(&style_line, 8); + lv_style_set_line_color(&style_line, lv_palette_main(LV_PALETTE_BLUE)); + lv_style_set_line_rounded(&style_line, true); + + /*Create a line and apply the new style*/ + lv_obj_t * line1; + line1 = lv_line_create(lv_scr_act()); + lv_line_set_points(line1, line_points, 5); /*Set the points*/ + lv_obj_add_style(line1, &style_line, 0); + lv_obj_center(line1); +} + +#endif diff --git a/lib/lvgl/examples/widgets/line/lv_example_line_1.py b/lib/lvgl/examples/widgets/line/lv_example_line_1.py new file mode 100644 index 00000000..3a5822ff --- /dev/null +++ b/lib/lvgl/examples/widgets/line/lv_example_line_1.py @@ -0,0 +1,20 @@ +# Create an array for the points of the line +line_points = [ {"x":5, "y":5}, + {"x":70, "y":70}, + {"x":120, "y":10}, + {"x":180, "y":60}, + {"x":240, "y":10}] + +# Create style +style_line = lv.style_t() +style_line.init() +style_line.set_line_width(8) +style_line.set_line_color(lv.palette_main(lv.PALETTE.BLUE)) +style_line.set_line_rounded(True) + +# Create a line and apply the new style +line1 = lv.line(lv.scr_act()) +line1.set_points(line_points, 5) # Set the points +line1.add_style(style_line, 0) +line1.center() + |
