aboutsummaryrefslogtreecommitdiff
path: root/src/Hero.h
blob: 2813d14aca9f13aa41f3e3c8e85eff28f9e945dd (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
50
51
52
53
54
#ifndef Hero_h
#define Hero_h

#include "Character.h"

class b2World;
class b2Body;
class b2Fixture;

class Hero: public Character
{
    Q_OBJECT

public:
    Hero(QGraphicsScene* scene, QPointF pos, QGraphicsItem* parent = 0);
    virtual ~Hero();

    void bindToWorld(b2World* world);

    void loadAnimations(const QString& animationsDirectory);

    void advance(int phase);

    /**
      * Update the position of the ball. x and y are in pixels.
      */
    void updatePosition(qreal x, qreal y);

    /**
      * Returns the Box2D fixture for the ball.
      */
    b2Fixture *getFixture();

    void toggleRedColor();
    void toggleGreenColor();
    void toggleBlueColor();

signals:
    void gameOver();
    void levelComplete();
    void updateUI();

private:
    QPixmap* m_red;
    QPixmap* m_green;
    QPixmap* m_blue;
    QPixmap* m_neutral;
    QString m_mode;

    b2Body* m_body;
    b2Fixture *m_fixture;
};

#endif // Hero_h