aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-03-18 20:50:58 +0100
committerCharles <sircharlesaze@gmail.com>2020-03-18 20:50:58 +0100
commit79ab0bdeedd6e7f97b4c246b4319af5eac545061 (patch)
tree841a4fafcd634285cf9a267e0e80550735a154c3 /include
parentb228349c5d3e93e8e58e96efeb332fdb58093f0f (diff)
download2048-79ab0bdeedd6e7f97b4c246b4319af5eac545061.tar.gz
2048-79ab0bdeedd6e7f97b4c246b4319af5eac545061.tar.bz2
2048-79ab0bdeedd6e7f97b4c246b4319af5eac545061.zip
game class, display of the game grid
Diffstat (limited to 'include')
-rw-r--r--include/game.hpp17
-rw-r--r--include/graphics.hpp10
2 files changed, 26 insertions, 1 deletions
diff --git a/include/game.hpp b/include/game.hpp
new file mode 100644
index 0000000..a644799
--- /dev/null
+++ b/include/game.hpp
@@ -0,0 +1,17 @@
+#ifndef GAME_HPP
+# define GAME_HPP
+
+class Game
+{
+ public:
+ Game(int s);
+ ~Game();
+ int getSize();
+ int at(int x, int y);
+
+ private:
+ int size;
+ int **grid;
+};
+
+#endif
diff --git a/include/graphics.hpp b/include/graphics.hpp
index 69ac808..0990247 100644
--- a/include/graphics.hpp
+++ b/include/graphics.hpp
@@ -2,15 +2,20 @@
# define GRAPHICS_HPP
#include <string>
+#include <iostream>
#include <SDL2/SDL.h>
+#include <SDL2/SDL_ttf.h>
+#include "game.hpp"
class Graphics
{
public:
- Graphics(std::string t, int w, int h);
+ Graphics(Game *g, std::string t, int w, int h);
~Graphics();
void update();
+ void drawGame();
+ void drawCell(int x, int y);
bool isRunning();
private:
@@ -18,10 +23,13 @@ class Graphics
std::string title;
int width;
int height;
+ Game *game;
SDL_Renderer *renderer;
SDL_Window *window;
+ TTF_Font *font;
void handleEvent();
+ void error();
};
#endif