diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-18 20:50:58 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-18 20:50:58 +0100 |
| commit | 79ab0bdeedd6e7f97b4c246b4319af5eac545061 (patch) | |
| tree | 841a4fafcd634285cf9a267e0e80550735a154c3 /src/game.cpp | |
| parent | b228349c5d3e93e8e58e96efeb332fdb58093f0f (diff) | |
| download | 2048-79ab0bdeedd6e7f97b4c246b4319af5eac545061.tar.gz 2048-79ab0bdeedd6e7f97b4c246b4319af5eac545061.tar.bz2 2048-79ab0bdeedd6e7f97b4c246b4319af5eac545061.zip | |
game class, display of the game grid
Diffstat (limited to 'src/game.cpp')
| -rw-r--r-- | src/game.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp new file mode 100644 index 0000000..11a603b --- /dev/null +++ b/src/game.cpp @@ -0,0 +1,27 @@ +#include "game.hpp" + + +Game::Game(int s) +{ + size = s; + grid = new int*[size]; + for (int i = 0; i < size; i++) + grid[i] = new int[size]; +} + +Game::~Game() +{ + for (int i = 0; i < size; i++) + delete []grid[i]; + delete []grid; +} + +int Game::getSize() +{ + return size; +} + +int Game::at(int x, int y) +{ + return grid[y][x]; +} |
