ScummVM API documentation
menu.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 HOLLYWOOD_RUNAWAY_MENU_H
23#define HOLLYWOOD_RUNAWAY_MENU_H
24
25#include "common/keyboard.h"
26#include "engines/savestate.h"
27#include "hollywood/runaway/detection.h"
28#include "hollywood/runaway/font.h"
29#include "hollywood/runaway/graphics.h"
30#include "hollywood/runaway/presentation.h"
31#include "hollywood/runaway/strings.h"
32
33namespace Hollywood {
34
36public:
37 struct Settings {
38 bool music = true, subtitles = true, antialias = true;
39 bool fastScrolling = true, pointerSound = true;
40 int volume = 192;
41 bool operator==(const Settings &other) const;
42 bool operator!=(const Settings &other) const { return !(*this == other); }
43 };
44 enum Command { kNone, kResume, kSettingsChanged, kSaveSettings, kRestoreDefaults, kQuit,
45 kBrowseLoad, kBrowseSave, kBrowseDelete, kLoadGame, kSaveGame, kDeleteGame, kStartChapter };
46
47 RunawayMenu(Audio::Mixer *mixer, const RunawayStrings &strings) : _strings(strings), _audio(mixer) {}
48 ~RunawayMenu();
49 bool load(RunawayGameType game);
50 void open(const Graphics::ManagedSurface &screen, const Settings &settings, bool canSave = false, bool canLoad = true, byte chapters = 0);
51 void close();
52 Command update(Common::Point mouse);
53 void tick(uint32 now);
54 Command click(bool right);
55 void release();
56 Command cancel();
57 Command key(uint32 ascii);
58 Command key(const Common::KeyState &key);
59 Command adjustVolume(int delta);
60 Command adjust(int delta);
61 void browse(Command mode, const SaveStateList &saves, int newSlot = -1);
62 void showMessage(const Common::U32String &message) { _notice = message; }
63 void operationDone(bool success);
64 int selectedSlot() const { return _selectedSlot; }
65 int selectedChapter() const { return _selectedChapter; }
66 void setChapterCount(byte chapters);
67 Common::String saveDescription() const;
68 bool enteringName() const { return _page == kName; }
69 void draw(Graphics::ManagedSurface &screen);
70 const Settings &settings() const { return _settings; }
71
72private:
73 enum Page { kOptions, kSaves, kName, kCredits, kChapters };
74 enum Confirmation { kNoConfirmation, kConfirmExit, kConfirmDelete, kConfirmOverwrite, kConfirmSettings, kConfirmDefaults };
75 enum Control { kNoControl, kPlay, kExit, kLoad, kSave, kDelete,
76 kMusicOn, kMusicOff, kAntialiasOn, kAntialiasOff, kScrollFast, kScrollSlow,
77 kPointerOn, kPointerOff, kSubtitlesOn, kSubtitlesOff, kVolume,
78 kShowCredits, kStoreSettings, kDefaults, kPrevious, kNext, kAcceptName, kYes, kNo };
79 Control controlAt(Common::Point mouse) const;
80 Common::Rect labelRect(RunawayStrings::TextId id, int center, int y) const;
81 Common::U32String confirmation() const;
82 Common::Rect answerRect(bool yes) const;
83 Common::Rect saveRect(uint index) const;
84 Common::Rect chapterRect(uint chapter) const;
85 int chapterAt(Common::Point mouse) const;
86 int saveAt(Common::Point mouse) const;
87 Command selectSave(int index);
88 Command accept();
89 void drawSaves(Graphics::ManagedSurface &screen);
90 void drawChapters(Graphics::ManagedSurface &screen);
91 void captureThumbnail(const Graphics::ManagedSurface &screen);
92 void drawLabel(Graphics::ManagedSurface &screen, RunawayStrings::TextId id, int center, int y,
93 bool enabled, Control control = kNoControl);
94 void drawToggle(Graphics::ManagedSurface &screen, RunawayStrings::TextId id, int y,
95 bool selected, Control on, Control off);
96
97 const RunawayStrings &_strings;
98 RunawayAudio _audio;
99 bool _museum = false;
100 RunawayFont _font, _captionFont;
101 Graphics::ManagedSurface _background, _returnButton, _logo, _cursor, _thumbnail;
102 Graphics::ManagedSurface _chapters[7][2], _optionsButton;
103 RunawayAnimation _volumeDial;
104 RunawayCredits _credits;
105 SaveStateList _saves;
106 Common::U32String _name, _notice;
107 Settings _settings;
108 Common::Point _mouse;
109 Page _page = kOptions;
110 Confirmation _confirmation = kNoConfirmation;
111 Command _browseMode = kBrowseLoad;
112 Control _dragging = kNoControl;
113 int _dragX = 0, _dragValue = 0, _selectedSlot = -1, _firstSave = 0, _newSlot = -1;
114 int _focusedSave = -1;
115 int _selectedChapter = -1;
116 byte _chapterCount = 0, _optionsFrame = 0;
117 uint32 _now = 0;
118 bool _canSave = false, _canLoad = true, _cursorPushed = false;
119};
120
121} // End of namespace Hollywood
122
123#endif
Definition: mixer.h:70
Definition: str.h:59
Definition: ustr.h:57
Definition: managed_surface.h:51
Definition: menu.h:35
Definition: strings.h:37
Definition: keyboard.h:294
Definition: rect.h:144
Definition: rect.h:536