aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/game.hpp23
-rw-r--r--include/graphics.hpp8
2 files changed, 21 insertions, 10 deletions
diff --git a/include/game.hpp b/include/game.hpp
index fcdd2c1..40ca113 100644
--- a/include/game.hpp
+++ b/include/game.hpp
@@ -26,21 +26,24 @@ public:
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;
+ void move(Direction direction);
+ Cell get(int y, int x) const;
+ size_t getHeight() const;
+ size_t getWidth() const;
+ Position const &getPlayer() const;
+
+private:
+
+ size_t m_width;
+ size_t m_height;
+ Cell **m_grid;
+ Position m_playerPos;
+ Direction m_playerDirection;
};
#endif
diff --git a/include/graphics.hpp b/include/graphics.hpp
index d51b47a..54f7d35 100644
--- a/include/graphics.hpp
+++ b/include/graphics.hpp
@@ -4,6 +4,7 @@
#include <iostream>
#include <string>
#include <SDL2/SDL.h>
+#include <SDL2/SDL_image.h>
#include "game.hpp"
class Graphics
@@ -23,10 +24,17 @@ private:
int m_height;
SDL_Renderer *m_renderer;
SDL_Window *m_window;
+ SDL_Texture *m_wallTex;
+ SDL_Texture *m_crateTex;
+ SDL_Texture *m_payloadTex;
+ SDL_Texture *m_playerTex;
void drawGame();
void drawCell(Game::Cell cell, int y, int x);
+ void drawPlayer();
void handleEvent();
+ SDL_Texture *loadImage(std::string filename);
+ void putImage(SDL_Texture *tex, SDL_Rect *destRect);
void error() const;
};