aboutsummaryrefslogtreecommitdiff
path: root/src/ActionScene.h
diff options
context:
space:
mode:
authorSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-25 20:00:41 +0300
committerSamu Laaksonen <laaksonen.sj@gmail.com>2012-09-25 20:00:41 +0300
commit685fe05def77b039221edf06c74af74915d536c5 (patch)
tree9c1a14b8f68bc0f801bdec3edc447d04fdbf7a4c /src/ActionScene.h
parent29eabac0670574efd384182c065f53d08c42a483 (diff)
downloadprism-685fe05def77b039221edf06c74af74915d536c5.tar.gz
prism-685fe05def77b039221edf06c74af74915d536c5.zip
Initial code commit
Added some stuff for project base - tiled sources - few Qt based classes for gfx
Diffstat (limited to 'src/ActionScene.h')
-rw-r--r--src/ActionScene.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/ActionScene.h b/src/ActionScene.h
new file mode 100644
index 0000000..49fdb20
--- /dev/null
+++ b/src/ActionScene.h
@@ -0,0 +1,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