ScummVM API documentation
interface.h
1
2/* ScummVM - Graphic Adventure Engine
3 *
4 * ScummVM is the legal property of its developers, whose names
5 * are too numerous to list here. Please refer to the COPYRIGHT
6 * file distributed with this source distribution.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef M4_RIDDLE_INTERFACE_H
24#define M4_RIDDLE_INTERFACE_H
25
26#include "m4/riddle/gui/inventory.h"
27#include "m4/adv_r/adv_interface.h"
28#include "m4/adv_r/adv_hotspot.h"
29#include "m4/graphics/graphics.h"
30#include "m4/graphics/gr_buff.h"
31
32namespace M4 {
33namespace Riddle {
34namespace GUI {
35
36using M4::GUI::ControlStatus;
37
38struct Interface : public M4::Interface {
39 class BackpackClass : public ButtonClass {
40
41 public:
42 BackpackClass(const RectClass &r, const Common::String &btnName, int16 tag,
43 int16 relaxed, int16 over, int16 picked, int sprite) :
44 ButtonClass(r, btnName, tag, relaxed, over, picked, sprite) {}
45 ~BackpackClass() override {}
46
47 void swap_sprites() {
48 const int16 picked = _picked;
49 const int16 over = _over;
50
51 _picked = over;
52 _relaxed = _over = picked;
53 }
54 };
55
56private:
57 void setup();
58
59 void trackIcons();
60 ControlStatus trackHotspots(int event, int x, int y);
61 void dispatch_command();
62 void handleState(ControlStatus status);
63
64public:
65 GUI::InterfaceBox *_interfaceBox = nullptr;
66 GUI::Inventory *_inventory = nullptr;
67 GUI::TextField *_textField = nullptr;
68 GUI::ButtonClass *_btnTake = nullptr;
69 GUI::ButtonClass *_btnManipulate = nullptr;
70 GUI::ButtonClass *_btnHandle = nullptr;
71 BackpackClass *_btnBackpack = nullptr;
72 GUI::ButtonClass *_btnBinky = nullptr;
73
74 int _sprite = 22; // main_interface_sprite;
75 const HotSpotRec *_hotspot = nullptr;
76 int _savedX = 0, _savedY = 0;
77 char _prepText[40] = { 0 };
78 char _nounText[40] = { 0 };
79 char _verbText[40] = { 0 };
80 bool _iconSelected = false;
81 int _state = 0;
82
83 Interface();
84 ~Interface() override;
85
86 bool init(int arrow, int wait, int look, int grab, int use) override;
87
88 void cancel_sentence() override;
89
90 void freshen_sentence() override;
91
92 bool set_interface_palette(RGB8 *myPalette) override;
93
94 void track_hotspots_refresh() override;
95
96 bool eventHandler(void *bufferPtr, int32 eventType, int32 event, int32 x, int32 y, bool *z) override;
97
98 void show() override;
99
100 void l_cb();
101 void u_cb();
102 void t_cb();
103 void a_cb();
104};
105
106} // namespace Interface
107} // namespace Riddle
108} // namespace M4
109
110#endif
Definition: str.h:59
Definition: gui_cheapo.h:77
Definition: gui_cheapo.h:135
Definition: gui_cheapo.h:46
Definition: gui_cheapo.h:62
Definition: adv_interface.h:32
Definition: inventory.h:50
Definition: database.h:28
Definition: adv_hotspot.h:30
Definition: m4_types.h:78
Definition: interface.h:38