summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-03-25 04:04:13 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-03-25 04:04:13 (GMT)
commitc482f2af73932a05472245df45c76e21f9e33fdc (patch)
tree3c5cf75259227251453b7c5a3f47fd4f5135103b
parentac8bc2a0a0662b19ee6c286f105dac20a375a9f4 (diff)
remove paint
-rw-r--r--src/displayapp/screens/InfiniPaint.cpp73
-rw-r--r--src/displayapp/screens/InfiniPaint.h38
2 files changed, 0 insertions, 111 deletions
diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp
deleted file mode 100644
index d279faf..0000000
--- a/src/displayapp/screens/InfiniPaint.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "displayapp/screens/InfiniPaint.h"
-#include "displayapp/DisplayApp.h"
-#include "displayapp/LittleVgl.h"
-
-#include <algorithm> // std::fill
-
-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} {
- std::fill(b, b + bufferSize, selectColor);
-}
-
-InfiniPaint::~InfiniPaint() {
- lv_obj_clean(lv_scr_act());
-}
-
-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;
- case 2:
- selectColor = LV_COLOR_WHITE;
- break;
- case 3:
- selectColor = LV_COLOR_RED;
- break;
- case 4:
- selectColor = LV_COLOR_CYAN;
- break;
- case 5:
- selectColor = LV_COLOR_YELLOW;
- break;
- case 6:
- selectColor = LV_COLOR_BLUE;
- break;
- case 7:
- selectColor = LV_COLOR_BLACK;
- break;
-
- default:
- color = 0;
- break;
- }
-
- std::fill(b, b + bufferSize, selectColor);
- motor.RunForDuration(35);
- return true;
- default:
- return true;
- }
- return true;
-}
-
-bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) {
- lv_area_t area;
- area.x1 = x - (width / 2);
- area.y1 = y - (height / 2);
- area.x2 = x + (width / 2) - 1;
- area.y2 = y + (height / 2) - 1;
- lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None);
- lvgl.FlushDisplay(&area, b);
- return true;
-}
diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h
deleted file mode 100644
index 8c42740..0000000
--- a/src/displayapp/screens/InfiniPaint.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-
-#include <lvgl/lvgl.h>
-#include <cstdint>
-#include <algorithm> // std::fill
-#include "displayapp/screens/Screen.h"
-#include "components/motor/MotorController.h"
-
-namespace Pinetime {
- namespace Components {
- class LittleVgl;
- }
- namespace Applications {
- namespace Screens {
-
- class InfiniPaint : public Screen {
- public:
- InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl, Controllers::MotorController& motor);
-
- ~InfiniPaint() override;
-
- bool OnTouchEvent(TouchEvents event) override;
-
- bool OnTouchEvent(uint16_t x, uint16_t y) override;
-
- private:
- Pinetime::Components::LittleVgl& lvgl;
- Controllers::MotorController& motor;
- static constexpr uint16_t width = 10;
- static constexpr uint16_t height = 10;
- static constexpr uint16_t bufferSize = width * height;
- lv_color_t b[bufferSize];
- lv_color_t selectColor = LV_COLOR_WHITE;
- uint8_t color = 2;
- };
- }
- }
-}