summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Twos.h
diff options
context:
space:
mode:
authorRiku Isokoski <riksu9000@gmail.com>2022-07-06 11:29:23 +0300
committerGitHub <noreply@github.com>2022-07-06 11:29:23 +0300
commit9b9286175322f99ae0265565ae9b0ae49efa2c26 (patch)
tree5916a55945af8a4092444a0dd34de3756ce7e405 /src/displayapp/screens/Twos.h
parentb9f5a0745d74db8a0dc7b439821f9b3a19b43b7a (diff)
Twos code cleanup (#1220)
Diffstat (limited to 'src/displayapp/screens/Twos.h')
-rw-r--r--src/displayapp/screens/Twos.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h
index 5a0c4350..4a6ada0b 100644
--- a/src/displayapp/screens/Twos.h
+++ b/src/displayapp/screens/Twos.h
@@ -26,11 +26,14 @@ namespace Pinetime {
lv_obj_t* scoreText;
lv_obj_t* gridDisplay;
- TwosTile grid[4][4];
+ static constexpr int nCols = 4;
+ static constexpr int nRows = 4;
+ static constexpr int nCells = nCols * nRows;
+ TwosTile grid[nRows][nCols];
unsigned int score = 0;
- void updateGridDisplay(TwosTile grid[][4]);
- bool tryMerge(TwosTile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol);
- bool tryMove(TwosTile grid[][4], int newRow, int newCol, int oldRow, int oldCol);
+ void updateGridDisplay();
+ bool tryMerge(int newRow, int newCol, int oldRow, int oldCol);
+ bool tryMove(int newRow, int newCol, int oldRow, int oldCol);
bool placeNewTile();
};
}