diff options
| author | JF <jf@codingfield.com> | 2020-11-10 19:32:36 (GMT) |
|---|---|---|
| committer | JF <jf@codingfield.com> | 2020-11-10 19:32:36 (GMT) |
| commit | 04abc91f157f5925ffa404728291a69893acf8cf (patch) | |
| tree | 5c887c6d22ba8d901022ebae395a7b6c165d9dc0 /src/displayapp/screens/InfiniPaint.cpp | |
| parent | 65ecb65b57bd55582c1aa1a5babd4d76df89e621 (diff) | |
| parent | f0e1f98823e41bfc2d9743fa8de70c882f26f93b (diff) | |
Merge branch 'develop' into master
Diffstat (limited to 'src/displayapp/screens/InfiniPaint.cpp')
| -rw-r--r-- | src/displayapp/screens/InfiniPaint.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp new file mode 100644 index 0000000..3ea75e9 --- /dev/null +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -0,0 +1,44 @@ +#include <libs/lvgl/lvgl.h> +#include <libraries/log/nrf_log.h> +#include "InfiniPaint.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} { + app->SetTouchMode(DisplayApp::TouchModes::Polling); + std::fill(b, b + bufferSize, LV_COLOR_WHITE); +} + +InfiniPaint::~InfiniPaint() { + // Reset the touchmode + app->SetTouchMode(DisplayApp::TouchModes::Gestures); + lv_obj_clean(lv_scr_act()); +} + +bool InfiniPaint::Refresh() { + return running; +} + +bool InfiniPaint::OnButtonPushed() { + running = false; + return true; +} + +bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + 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; +} + |
