aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/game.hpp37
-rw-r--r--include/graphics.hpp5
2 files changed, 39 insertions, 3 deletions
diff --git a/include/game.hpp b/include/game.hpp
index 017d21b..fcdd2c1 100644
--- a/include/game.hpp
+++ b/include/game.hpp
@@ -1,11 +1,46 @@
#ifndef GAME_HPP
# define GAME_HPP
+#include <string>
+#include <algorithm>
+
class Game
{
public:
- Game();
+ Game(std::string fmt);
+ ~Game();
+
+ enum Direction
+ {
+ DirectionUp,
+ DirectionDown,
+ DirectionLeft,
+ DirectionRight,
+ };
+
+ enum Cell
+ {
+ CellEmpty = 0,
+ CellWall,
+ CellCrate,
+ CellPayload,
+ };
+
+ Cell get(int y, int x);
+ size_t getHeight();
+ size_t getWidth();
+
+private:
+
+ struct Position
+ {
+ int y, x;
+ };
+ size_t m_width;
+ size_t m_height;
+ Cell **m_grid;
+ Position m_playerPos;
};
#endif
diff --git a/include/graphics.hpp b/include/graphics.hpp
index ef0c813..d51b47a 100644
--- a/include/graphics.hpp
+++ b/include/graphics.hpp
@@ -8,14 +8,14 @@
class Graphics
{
- public:
+public:
Graphics(Game &game, std::string title, int width, int height);
~Graphics();
void update();
bool isRunning() const;
- private:
+private:
bool m_running;
Game &m_game;
std::string m_title;
@@ -25,6 +25,7 @@ class Graphics
SDL_Window *m_window;
void drawGame();
+ void drawCell(Game::Cell cell, int y, int x);
void handleEvent();
void error() const;
};