summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Paddle.cpp
diff options
context:
space:
mode:
authorJF002 <JF002@users.noreply.github.com>2021-08-28 16:39:48 +0200
committerGitHub <noreply@github.com>2021-08-28 16:39:48 +0200
commit2870d3ae6c00f127883e6cedecda328994b0fec7 (patch)
tree75c4b96ace962cbb965c2bdd0dd11137b471c5ac /src/displayapp/screens/Paddle.cpp
parentfab49f8557ef8ff38fe4f607e33b18fb5a1aeb9a (diff)
parentc2fae47391f02b515c8d85a00ae1b7190bcd30a0 (diff)
Merge pull request #497 from Riksu9000/refresh_rework
Rework Refresh
Diffstat (limited to 'src/displayapp/screens/Paddle.cpp')
-rw-r--r--src/displayapp/screens/Paddle.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp
index 79e0c3d3..3b6d60e3 100644
--- a/src/displayapp/screens/Paddle.cpp
+++ b/src/displayapp/screens/Paddle.cpp
@@ -27,13 +27,16 @@ Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::Li
lv_obj_set_style_local_bg_color(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
lv_obj_set_style_local_radius(ball, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
lv_obj_set_size(ball, ballSize, ballSize);
+
+ taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
}
Paddle::~Paddle() {
+ lv_task_del(taskRefresh);
lv_obj_clean(lv_scr_act());
}
-bool Paddle::Refresh() {
+void Paddle::Refresh() {
ballX += dx;
ballY += dy;
@@ -65,7 +68,6 @@ bool Paddle::Refresh() {
}
}
lv_label_set_text_fmt(points, "%04d", score);
- return running;
}
bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {