aboutsummaryrefslogtreecommitdiff
path: root/include/game.hpp
blob: 40ca113f27b498c584f6bb2a3541197ac49bf985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef GAME_HPP
# define GAME_HPP

#include <string>
#include <algorithm>

class Game
{
public:
    Game(std::string fmt);
    ~Game();

    enum Direction
    {
        DirectionUp,
        DirectionDown,
        DirectionLeft,
        DirectionRight,
    };

    enum Cell
    {
        CellEmpty = 0,
        CellWall,
        CellCrate,
        CellPayload,
    };

    struct Position
    {
        int y, x;
    };

    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