ScummVM API documentation
hud.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * This code is based on the CRAB engine
24  *
25  * Copyright (c) Arvind Raja Yadav
26  *
27  * Licensed under MIT
28  *
29  */
30 
31 //=============================================================================
32 // Author: Arvind
33 // Purpose: The tray where you have inventory, map and journal icons
34 //=============================================================================
35 #ifndef CRAB_HUD_H
36 #define CRAB_HUD_H
37 
38 #include "crab/event/GameEventInfo.h"
39 #include "crab/level/level_objects.h"
40 #include "crab/level/talknotify.h"
41 #include "crab/ui/FileMenu.h"
42 #include "crab/ui/GameOverMenu.h"
43 #include "crab/ui/PauseMenu.h"
44 
45 namespace Crab {
46 
47 namespace pyrodactyl {
48 namespace ui {
49 enum HUDSignal {
50  HS_NONE = -1,
51  HS_MAP,
52  HS_PAUSE,
53  HS_CHAR,
54  HS_JOURNAL,
55  HS_INV
56 };
57 
58 // The world map, inventory and objective buttons are in the button menu
59 class HUD {
60  // The background image
61  ImageData _bg;
62 
63  // The launcher menu for stuff like inventory, character, pause etc
64  Menu<StateButton> _menu;
65 
66  // The health gem thingy
67  // HealthIndicator health;
68 
69  // Sprite sheet for animated notify icon
70  ImageKey _notifyAnim;
71 
72  // Animated notification icon needs a clip sign
73  Rect _clip;
74 
75  // The amount of time to wait before incrementing clip
76  Timer _timer;
77 
78  // The original tooltips as provided in the xml
80 
81 public:
82  GameOverMenu _gom;
83  PauseMenu _pause;
84  pyrodactyl::input::HotKey _pausekey;
85  Button _back;
86 
87  HUD() {
88  _pausekey.set(pyrodactyl::input::IG_PAUSE);
89  _notifyAnim = 0;
90  }
91  ~HUD() {}
92 
93  void internalEvents(bool showMap);
94  void playerImg(const StateButtonImage &img) {
95  _menu._element[HS_CHAR].img(img);
96  }
97 
98  void State(const int &val);
99 
101 
102  HUDSignal handleEvents(pyrodactyl::event::Info &info, const Common::Event &event);
103 
104  void draw(pyrodactyl::event::Info &info, const Common::String &id);
105 
106  // Set the tooltips for the buttons in the menu
107  // The tooltips are of the style <Name> (<Hotkey>), with Name being provided by the xml
108  void setTooltip();
109 
110  void setUI();
111 };
112 } // End of namespace ui
113 } // End of namespace pyrodactyl
114 
115 } // End of namespace Crab
116 
117 #endif // CRAB_HUD_H
Definition: StateButton.h:40
Definition: str.h:59
Definition: Rectangle.h:42
Definition: ImageData.h:40
Definition: level_objects.h:56
Definition: menu.h:47
Definition: path.h:52
Definition: GameEventInfo.h:44
Definition: GameOverMenu.h:42
Definition: talknotify.h:40
Definition: hud.h:59
Definition: PauseMenu.h:57
Definition: hotkey.h:43
Definition: events.h:199
Definition: moveeffect.h:37
Definition: button.h:86
Definition: timer.h:43