ScummVM API documentation
controls.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 * Additional copyright for this file:
8 * Copyright (C) 1994-1998 Revolution Software Ltd.
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#ifndef SWORD2_CONTROL_H
25#define SWORD2_CONTROL_H
26
27#include "sword2/defs.h"
28#include "sword2/saveload.h"
29
30#define MAX_WIDGETS 25
31
32namespace Sword2 {
33
34class Sword2Engine;
35class FontRendererGui;
36class Widget;
37class Switch;
38class Slider;
39class Button;
40class ScrollButton;
41class Slot;
42
43enum {
44 kSaveDialog,
45 kRestoreDialog
46};
47
52class Dialog {
53private:
54 int _numWidgets;
55 Widget *_widgets[MAX_WIDGETS];
56 bool _finish;
57 int _result;
58
59public:
60 Sword2Engine *_vm;
61
63 virtual ~Dialog();
64
65 void registerWidget(Widget *widget);
66
67 virtual void paint();
68 virtual void setResult(int result);
69
70 virtual int runModal();
71
72 virtual void onAction(Widget *widget, int result = 0) {}
73};
74
75class OptionsDialog : public Dialog {
76private:
77 FontRendererGui *_fr;
78 Widget *_panel;
79 Switch *_objectLabelsSwitch;
80 Switch *_subtitlesSwitch;
81 Switch *_reverseStereoSwitch;
82 Switch *_musicSwitch;
83 Switch *_speechSwitch;
84 Switch *_fxSwitch;
85 Slider *_musicSlider;
86 Slider *_speechSlider;
87 Slider *_fxSlider;
88 Slider *_gfxSlider;
89 Widget *_gfxPreview;
90 Button *_okButton;
91 Button *_cancelButton;
92
93 Audio::Mixer *_mixer;
94
95public:
97 ~OptionsDialog() override;
98
99 void paint() override;
100 void onAction(Widget *widget, int result = 0) override;
101};
102
103class SaveRestoreDialog : public Dialog {
104private:
105 int _mode, _selectedSlot;
106 byte _editBuffer[SAVE_DESCRIPTION_LEN];
107 int _editPos, _firstPos;
108 int _cursorTick;
109
110 FontRendererGui *_fr1;
111 FontRendererGui *_fr2;
112 Widget *_panel;
113 Slot *_slotButton[8];
114 ScrollButton *_zupButton;
115 ScrollButton *_upButton;
116 ScrollButton *_downButton;
117 ScrollButton *_zdownButton;
118 Button *_okButton;
119 Button *_cancelButton;
120
121public:
122 SaveRestoreDialog(Sword2Engine *vm, int mode);
123 ~SaveRestoreDialog() override;
124
125 void updateSlots();
126 void drawEditBuffer(Slot *slot);
127
128 void onAction(Widget *widget, int result = 0) override;
129 void paint() override;
130 void setResult(int result) override;
131 int runModal() override;
132};
133
139class MiniDialog : public Dialog {
140private:
141 uint32 _headerTextId;
142 uint32 _okTextId;
143 uint32 _cancelTextId;
144 FontRendererGui *_fr;
145 Widget *_panel;
146 Button *_okButton;
147 Button *_cancelButton;
148
149public:
150 MiniDialog(Sword2Engine *vm, uint32 headerTextId, uint32 okTextId = TEXT_OK, uint32 cancelTextId = TEXT_CANCEL);
151 ~MiniDialog() override;
152 void paint() override;
153 void onAction(Widget *widget, int result = 0) override;
154};
155
156class StartDialog : public MiniDialog {
157public:
159 int runModal() override;
160};
161
162class RestartDialog : public MiniDialog {
163public:
165 int runModal() override;
166};
167
168class QuitDialog : public MiniDialog {
169public:
171 int runModal() override;
172};
173
175public:
176 SaveDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kSaveDialog) {}
177};
178
180public:
181 RestoreDialog(Sword2Engine *vm) : SaveRestoreDialog(vm, kRestoreDialog) {}
182};
183
184} // End of namespace Sword2
185
186#endif
Definition: mixer.h:70
Definition: input.h:69
Definition: controls.h:52
Definition: controls.h:139
Definition: controls.h:75
Definition: controls.h:168
Definition: controls.h:162
Definition: controls.h:179
Definition: controls.h:174
Definition: controls.h:103
Definition: controls.h:156
Definition: sword2.h:99
Definition: animation.h:37