ScummVM API documentation
user_interface.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 #ifndef TSAGE_USER_INTERFACE_H
23 #define TSAGE_USER_INTERFACE_H
24 
25 #include "common/scummsys.h"
26 #include "tsage/core.h"
27 #include "tsage/graphics.h"
28 #include "tsage/sound.h"
29 
30 namespace TsAGE {
31 
32 class StripProxy: public EventHandler {
33 public:
34  void process(Event &event) override;
35 };
36 
38 public:
39  bool _enabled;
40  int _frameNum;
41 
42  Common::String getClassName() override { return "UIElement"; }
43  void synchronize(Serializer &s) override;
44 
45  void setup(int visage, int stripNum, int frameNum, int posX, int posY, int priority);
46  void setEnabled(bool flag);
47 };
48 
49 // This class implements the Question mark button
50 class UIQuestion: public UIElement {
51 private:
52  void showDescription(CursorType item);
53  void showItem(int resNum, int rlbNum, int frameNum);
54 public:
55  void process(Event &event) override;
56  void setEnabled(bool flag);
57 };
58 
59 // This class implements the score counter
60 class UIScore: public UIElement {
61 private:
62  void showDescription(int lineNum);
63 public:
64  UIElement _digit3, _digit2, _digit1, _digit0;
65 
66  void postInit(SceneObjectList *OwnerList = NULL) override;
67  void draw() override;
68 
69  void updateScore();
70 };
71 
72 class UIInventorySlot: public UIElement {
73 public:
74  int _objIndex;
75  InvObject *_object;
76 
78  Common::String getClassName() override { return "UIInventorySlot"; }
79  void synchronize(Serializer &s) override;
80  void process(Event &event) override;
81 };
82 
84 private:
85  void toggle(bool pressed);
86 public:
87  bool _isLeft;
88 
90  Common::String getClassName() override { return "UIInventoryScroll"; }
91  void synchronize(Serializer &s) override;
92  void process(Event &event) override;
93 };
94 
95 class UICollection: public EventHandler {
96 private:
97  void r2rDrawFrame();
98 protected:
99  void erase();
100 public:
101  Common::Point _position;
102  Rect _bounds;
103  bool _visible;
104  bool _clearScreen;
105  bool _cursorChanged;
107 
108  UICollection();
109  void setup(const Common::Point &pt);
110  void hide();
111  void show();
112  void resetClear();
113  void draw();
114 };
115 
116 class UIElements: public UICollection {
117 private:
118  void add(UIElement *obj);
119  void updateInvList();
120 public:
121  UIElement _background;
122  UIQuestion _question;
123  UIScore _score;
124  UIInventorySlot _slot1, _slot2, _slot3, _slot4;
125  UIInventoryScroll _scrollLeft, _scrollRight;
126  ASound _sound;
127  int _slotStart, _scoreValue;
128  bool _active;
129  Common::Array<int> _itemList;
130  Visage _cursorVisage;
131  UIElement _character;
132 
133  UIElements();
134  Common::String getClassName() override { return "UIElements"; }
135  void synchronize(Serializer &s) override;
136  void postInit(SceneObjectList *OwnerList = NULL) override { error("Wrong init() called"); }
137  void process(Event &event) override;
138 
139  void setup(const Common::Point &pt);
140  void updateInventory(int objectNumber = 0);
141  void addScore(int amount);
142  void scrollInventory(bool isLeft);
143 
144  static void loadNotifierProc(bool postFlag);
145 };
146 
147 } // End of namespace TsAGE
148 
149 #endif
Definition: user_interface.h:37
Definition: str.h:59
Definition: core.h:115
Definition: core.h:736
Definition: array.h:52
Definition: user_interface.h:32
Definition: sound.h:366
Definition: user_interface.h:83
Definition: user_interface.h:60
Definition: core.h:472
Definition: core.h:614
Definition: core.h:47
Definition: user_interface.h:116
Definition: rect.h:45
Definition: events.h:47
Definition: blueforce_dialogs.h:30
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: saveload.h:63
Definition: user_interface.h:72
Definition: graphics.h:40
Definition: user_interface.h:95
Definition: user_interface.h:50