diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-21 16:12:16 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-21 16:12:16 +0100 |
| commit | caeb26e90ef09fdad85af72f460644e09d3b2c7c (patch) | |
| tree | fa24199fac41284ddb5bcf6855a0b094de7582a2 /include/game.hpp | |
| parent | 0cebd4ae751e0554f948389654fe4ad7e92943f0 (diff) | |
| download | mario_sokoban-caeb26e90ef09fdad85af72f460644e09d3b2c7c.tar.gz mario_sokoban-caeb26e90ef09fdad85af72f460644e09d3b2c7c.tar.bz2 mario_sokoban-caeb26e90ef09fdad85af72f460644e09d3b2c7c.zip | |
Player sprite direction, read map file
Diffstat (limited to 'include/game.hpp')
| -rw-r--r-- | include/game.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/game.hpp b/include/game.hpp index 647a12d..946f07c 100644 --- a/include/game.hpp +++ b/include/game.hpp @@ -1,6 +1,8 @@ #ifndef GAME_HPP # define GAME_HPP +#include <iostream> +#include <fstream> #include <string> #include <vector> #include <algorithm> @@ -9,6 +11,7 @@ class Game { public: Game(std::string fmt); + Game(std::ifstream &file); ~Game(); enum Direction @@ -40,6 +43,7 @@ public: size_t getHeight() const; size_t getWidth() const; Position const &getPlayer() const; + Direction getPlayerDirection() const; private: @@ -51,8 +55,11 @@ private: std::vector<Position> m_cratePos; std::vector<Position> m_payloadPos; + void construct(std::string fmt); + void findWidth(std::string fmt); bool tryMoveCrate(Position &pos, Direction direction); bool validPosition(Position pos); + static Position makePos(int y, int x); }; |
