forked from capocattiveria/Super_mario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHud.h
35 lines (23 loc) · 896 Bytes
/
Hud.h
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
#pragma once
#include <QGraphicsView>
#include "HudPanel.h"
class Hud : public QGraphicsView
{
Q_OBJECT
private:
static Hud* uniqueInstance; // Singleton design pattern
Hud(QWidget* parent = nullptr); // Singleton design pattern
QGraphicsScene* scene; // the scene used to render the hud
QGraphicsPixmapItem* main_screen; // the image displayed when game is resetted
HudPanel* hud_panel; // the panel containing others subpanels (i.e. score, time_remaining, etc..)
public:
// singleton unique instance getter
static Hud* instance(QWidget* parent = nullptr);
// getters
QGraphicsScene* getScene() { return scene; }
HudSubPanel* getPanel(const std::string& panel_id);
public slots:
void start();
void reset();
void updatePanel(const std::string& panel_id, const std::string& update_info = "");
};