diff options
| author | JF <jf@codingfield.com> | 2021-01-04 18:56:56 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2021-01-04 18:56:56 (GMT) |
| commit | 1d940af924bac5728a4d494f780e298e5b67b707 (patch) | |
| tree | 24540888f3d038ca3c88a0789b63faa8ac07d631 /src/displayapp/screens/Twos.h | |
| parent | 04abc91f157f5925ffa404728291a69893acf8cf (diff) | |
| parent | 50ae0ae5e073ac48652e6c26549f9b19655e8da3 (diff) | |
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/displayapp/screens/Twos.h')
| -rw-r--r-- | src/displayapp/screens/Twos.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h new file mode 100644 index 0000000..ad80ca1 --- /dev/null +++ b/src/displayapp/screens/Twos.h @@ -0,0 +1,34 @@ +#pragma once + +#include <lvgl/src/lv_core/lv_obj.h> +#include "Screen.h" + +namespace Pinetime { + namespace Applications { + struct Tile { + bool merged = false; + unsigned int value = 0; + }; + namespace Screens { + class Twos : public Screen { + public: + Twos(DisplayApp* app); + ~Twos() override; + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + + private: + bool running = true; + lv_obj_t *scoreText; + lv_obj_t *gridDisplay; + Tile grid[4][4]; + unsigned int score = 0; + void updateGridDisplay(Tile grid[][4]); + bool tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int oldCol); + bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol); + bool placeNewTile(); + }; + } + } +}
\ No newline at end of file |
