summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Twos.cpp
diff options
context:
space:
mode:
authorSteveAmor <SteveAmor@users.noreply.github.com>2022-01-02 22:27:43 +0000
committerSteveAmor <SteveAmor@users.noreply.github.com>2022-01-02 22:27:43 +0000
commitcc259b6a4ac93d507fa372a41ea653dedeb791ea (patch)
tree3c8b8b937b2b91149003195679ce5acda1154c4d /src/displayapp/screens/Twos.cpp
parent94561b233136334c7507925b04a345adb0e6c769 (diff)
parente0013e730448f4dc142e3610f970f22c807ac41e (diff)
resolves conflicts
Diffstat (limited to 'src/displayapp/screens/Twos.cpp')
-rw-r--r--src/displayapp/screens/Twos.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp
index 4201d501..b15332f1 100644
--- a/src/displayapp/screens/Twos.cpp
+++ b/src/displayapp/screens/Twos.cpp
@@ -1,10 +1,10 @@
-#include "Twos.h"
-#include <lvgl/lvgl.h>
-#include <string>
-#include <charconv>
+#include "displayapp/screens/Twos.h"
#include <array>
-#include <vector>
+#include <cstdio>
+#include <cstdlib>
+#include <lvgl/lvgl.h>
#include <utility>
+#include <vector>
using namespace Pinetime::Applications::Screens;
@@ -129,7 +129,7 @@ bool Twos::placeNewTile() {
return true;
}
-bool Twos::tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) {
+bool Twos::tryMerge(TwosTile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) {
if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) {
if ((newCol != oldCol) || (newRow != oldRow)) {
if (!grid[newRow][newCol].merged) {
@@ -146,7 +146,7 @@ bool Twos::tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int ol
return false;
}
-bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol) {
+bool Twos::tryMove(TwosTile grid[][4], int newRow, int newCol, int oldRow, int oldCol) {
if (((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) {
grid[newRow][newCol].value = grid[oldRow][oldCol].value;
grid[oldRow][oldCol].value = 0;
@@ -261,11 +261,13 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
return false;
}
-void Twos::updateGridDisplay(Tile grid[][4]) {
+void Twos::updateGridDisplay(TwosTile grid[][4]) {
for (int row = 0; row < 4; row++) {
for (int col = 0; col < 4; col++) {
if (grid[row][col].value) {
- lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str());
+ char buffer[7];
+ sprintf(buffer, "%d", grid[row][col].value);
+ lv_table_set_cell_value(gridDisplay, row, col, buffer);
} else {
lv_table_set_cell_value(gridDisplay, row, col, "");
}