aboutsummaryrefslogtreecommitdiffstats
path: root/examples/shooter/player.h
blob: b8042e712dfe97189ca0de35db2860b937579898 (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
#ifndef EXAMPLE_SHOOTER_PLAYER_H
#define EXAMPLE_SHOOTER_PLAYER_H

#include "yage/yage.h"

enum class Direction {
    LEFT,
    DOWN,
    RIGHT,
    UP,
};

enum class Action {
    IDLE,
    MOVING,
};

class Player : public yage::Drawable
{
public:
    Player(const glm::vec4 &bound, const yage::Texture &texture);

    void setTexture(const yage::Texture &texture);

    void draw(yage::SpriteBatch &sp) const;

    void move(Direction direction);
    void idle();

    // simple getters
    glm::vec4 position() const;
private:
    glm::vec4 bound_;
    yage::Texture texture_;
    Direction direction_;
    Action action_;
    int speed_;
};

#endif