aboutsummaryrefslogtreecommitdiff
path: root/src/ActionScene.h
blob: 49fdb20720c767b38c6a5f5b908c9107d6cd3f54 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef ActionScene_H
#define ActionScene_H

#include <QObject>
#include <QRectF>
#include <QGraphicsRectItem>

#include "GameScene.h"
#include "Sprite.h"

#include "map.h"
#include "mapreader.h"
#include "orthogonalrenderer.h"

class QGraphicsPixmapItem;
class Hero;

class ActionScene : public GameScene
{
    Q_OBJECT

public:
    explicit ActionScene(const QString &name, const QRectF &rect, GameView *parent = 0);
    virtual ~ActionScene();

    void updateLogic();
    void keyPressEvent(QKeyEvent *event);

    /**
      * Loads level from target location.
      */
    void loadMap(QString target);

private:

    Tiled::Map *m_map;
    Tiled::MapReader *m_mapReader;
    Tiled::OrthogonalRenderer *m_mapRenderer;

    //! Level name used for records.
    QString m_levelName;

    //! Levelscore used for records.
    int m_levelScore;

    //! Map layer is drawn to this pixmap
    QPixmap m_mapPixmap;

    //! Item for map layer
    QGraphicsPixmapItem *m_mapPixmapItem;

    //! What portion of the map to draw
    QSize m_mapWindow;

    //! Background pixmap
    QPixmap m_bgPixmap;
    QGraphicsPixmapItem *m_bgPixmapItem;

    //! What portion of the bg pixmap to draw
    QRectF m_bgWindow;

    //! Pointer for forwarding commands to main character
    Hero* m_hero;

    //! Stops graphics rendering while scene is cleared.
    bool m_clearAlert;

    //! HP text item
    QGraphicsTextItem* m_hpText;
    //! Score text item
    QGraphicsTextItem* m_scoreText;

signals:
    void gameOver();

public slots:
    /**
   * Removes a sprite from the scene
   */
    void removeSprite();
};

#endif // ActionScene_H