diff options
| author | Clemens von Molo <clemensvonmolo@paderborn.com> | 2021-11-01 10:46:27 (GMT) |
|---|---|---|
| committer | Clemens von Molo <clemensvonmolo@paderborn.com> | 2021-11-01 10:46:27 (GMT) |
| commit | 2d985309760172db00b0b9cb7bd523579413d634 (patch) | |
| tree | 258036c61186bd8649b904602f1fd57924ccb582 /src/displayapp/screens/InfiniPaint.cpp | |
| parent | 5e1f4839daff075d6411f41148eb6d5d0543bcee (diff) | |
color rotation using modulo, ran clang-format for InfiniPaint
Diffstat (limited to 'src/displayapp/screens/InfiniPaint.cpp')
| -rw-r--r-- | src/displayapp/screens/InfiniPaint.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index 66391b1..c5ff27b 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -4,7 +4,10 @@ using namespace Pinetime::Applications::Screens; -InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl, Pinetime::Controllers::MotorController& motor) : Screen(app), lvgl {lvgl}, motor{motor} { +InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, + Pinetime::Components::LittleVgl& lvgl, + Pinetime::Controllers::MotorController& motor) + : Screen(app), lvgl {lvgl}, motor {motor} { std::fill(b, b + bufferSize, selectColor); } @@ -15,7 +18,11 @@ InfiniPaint::~InfiniPaint() { bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { switch (event) { case Pinetime::Applications::TouchEvents::LongTap: + color = (color + 1) % 8; switch (color) { + case 0: + selectColor = LV_COLOR_MAGENTA; + break; case 1: selectColor = LV_COLOR_GREEN; break; @@ -40,12 +47,10 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { default: color = 0; - selectColor = LV_COLOR_MAGENTA; break; } std::fill(b, b + bufferSize, selectColor); - color++; motor.RunForDuration(50); return true; default: |
