diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:40 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:40 +1000 |
| commit | 64bd9053a25297f7a442ca831c7da5b44bd33f84 (patch) | |
| tree | a90c6cad25a12028302ab1a5334510fba0229bae /lib/lvgl/examples/widgets/obj | |
| parent | 611176ed667c4ed7ee9f609e958f9404f4aee91d (diff) | |
| download | tangara-fw-64bd9053a25297f7a442ca831c7da5b44bd33f84.tar.gz | |
Update LVGL to v9.1.0
Diffstat (limited to 'lib/lvgl/examples/widgets/obj')
| -rw-r--r-- | lib/lvgl/examples/widgets/obj/index.rst | 4 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/obj/lv_example_obj_1.c | 4 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/obj/lv_example_obj_1.py | 14 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/obj/lv_example_obj_2.c | 11 | ||||
| -rw-r--r-- | lib/lvgl/examples/widgets/obj/lv_example_obj_2.py | 25 |
5 files changed, 9 insertions, 49 deletions
diff --git a/lib/lvgl/examples/widgets/obj/index.rst b/lib/lvgl/examples/widgets/obj/index.rst index 2bf39db9..be26ac70 100644 --- a/lib/lvgl/examples/widgets/obj/index.rst +++ b/lib/lvgl/examples/widgets/obj/index.rst @@ -1,12 +1,12 @@ Base objects with custom styles -"""""""""""""""""""""""""""""""" +------------------------------- .. lv_example:: widgets/obj/lv_example_obj_1 :language: c Make an object draggable -"""""""""""""""""""""""""""" +------------------------ .. lv_example:: widgets/obj/lv_example_obj_2 :language: c diff --git a/lib/lvgl/examples/widgets/obj/lv_example_obj_1.c b/lib/lvgl/examples/widgets/obj/lv_example_obj_1.c index 9c5ff7a0..322306e4 100644 --- a/lib/lvgl/examples/widgets/obj/lv_example_obj_1.c +++ b/lib/lvgl/examples/widgets/obj/lv_example_obj_1.c @@ -4,7 +4,7 @@ void lv_example_obj_1(void) { lv_obj_t * obj1; - obj1 = lv_obj_create(lv_scr_act()); + obj1 = lv_obj_create(lv_screen_active()); lv_obj_set_size(obj1, 100, 50); lv_obj_align(obj1, LV_ALIGN_CENTER, -60, -30); @@ -15,7 +15,7 @@ void lv_example_obj_1(void) lv_style_set_shadow_color(&style_shadow, lv_palette_main(LV_PALETTE_BLUE)); lv_obj_t * obj2; - obj2 = lv_obj_create(lv_scr_act()); + obj2 = lv_obj_create(lv_screen_active()); lv_obj_add_style(obj2, &style_shadow, 0); lv_obj_align(obj2, LV_ALIGN_CENTER, 60, 30); } diff --git a/lib/lvgl/examples/widgets/obj/lv_example_obj_1.py b/lib/lvgl/examples/widgets/obj/lv_example_obj_1.py deleted file mode 100644 index f627e520..00000000 --- a/lib/lvgl/examples/widgets/obj/lv_example_obj_1.py +++ /dev/null @@ -1,14 +0,0 @@ -obj1 = lv.obj(lv.scr_act()) -obj1.set_size(100, 50) -obj1.align(lv.ALIGN.CENTER, -60, -30) - -style_shadow = lv.style_t() -style_shadow.init() -style_shadow.set_shadow_width(10) -style_shadow.set_shadow_spread(5) -style_shadow.set_shadow_color(lv.palette_main(lv.PALETTE.BLUE)) - -obj2 = lv.obj(lv.scr_act()) -obj2.add_style(style_shadow, 0) -obj2.align(lv.ALIGN.CENTER, 60, 30) - diff --git a/lib/lvgl/examples/widgets/obj/lv_example_obj_2.c b/lib/lvgl/examples/widgets/obj/lv_example_obj_2.c index 627d509f..b9abfe90 100644 --- a/lib/lvgl/examples/widgets/obj/lv_example_obj_2.c +++ b/lib/lvgl/examples/widgets/obj/lv_example_obj_2.c @@ -5,25 +5,24 @@ static void drag_event_handler(lv_event_t * e) { lv_obj_t * obj = lv_event_get_target(e); - lv_indev_t * indev = lv_indev_get_act(); + lv_indev_t * indev = lv_indev_active(); if(indev == NULL) return; lv_point_t vect; lv_indev_get_vect(indev, &vect); - lv_coord_t x = lv_obj_get_x(obj) + vect.x; - lv_coord_t y = lv_obj_get_y(obj) + vect.y; + int32_t x = lv_obj_get_x_aligned(obj) + vect.x; + int32_t y = lv_obj_get_y_aligned(obj) + vect.y; lv_obj_set_pos(obj, x, y); } - /** - * Make an object dragable. + * Make an object draggable. */ void lv_example_obj_2(void) { lv_obj_t * obj; - obj = lv_obj_create(lv_scr_act()); + obj = lv_obj_create(lv_screen_active()); lv_obj_set_size(obj, 150, 100); lv_obj_add_event_cb(obj, drag_event_handler, LV_EVENT_PRESSING, NULL); diff --git a/lib/lvgl/examples/widgets/obj/lv_example_obj_2.py b/lib/lvgl/examples/widgets/obj/lv_example_obj_2.py deleted file mode 100644 index f1f3626d..00000000 --- a/lib/lvgl/examples/widgets/obj/lv_example_obj_2.py +++ /dev/null @@ -1,25 +0,0 @@ -def drag_event_handler(e): - - obj = e.get_target() - - indev = lv.indev_get_act() - - vect = lv.point_t() - indev.get_vect(vect) - x = obj.get_x() + vect.x - y = obj.get_y() + vect.y - obj.set_pos(x, y) - - -# -# Make an object dragable. -# - -obj = lv.obj(lv.scr_act()) -obj.set_size(150, 100) -obj.add_event_cb(drag_event_handler, lv.EVENT.PRESSING, None) - -label = lv.label(obj) -label.set_text("Drag me") -label.center() - |
