ScummVM API documentation
PauseMenu.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#ifndef CRAB_PAUSEMENU_H
32#define CRAB_PAUSEMENU_H
33
34#include "crab/event/GameEventInfo.h"
35#include "crab/ui/FileMenu.h"
36#include "crab/ui/menu.h"
37#include "crab/ui/OptionMenu.h"
38#include "crab/ui/SaveGameMenu.h"
39#include "crab/ui/slider.h"
40#include "crab/ui/SlideShow.h"
41#include "crab/ui/textarea.h"
42
43namespace Crab {
44
45namespace pyrodactyl {
46namespace ui {
47enum PauseSignal {
48 PS_NONE,
49 PS_RESUME,
50 PS_SAVE,
51 PS_LOAD,
52 PS_HELP,
53 PS_QUIT_MENU,
54 PS_QUIT_GAME
55};
56
57class PauseMenu {
58 enum PauseState {
59 STATE_NORMAL,
60 STATE_SAVE,
61 STATE_OPTION,
62 STATE_LOAD
63 } _state;
64
65 // The pause menu background
66 ImageData _bg;
67
68 // The buttons in the menu
69 ButtonMenu _menu;
70
71 // Save game menu
72 GameSaveMenu _save;
73
74 // The selected main menu button
75 int _choice;
76
77public:
78 PauseMenu() {
79 _state = STATE_NORMAL;
80 _choice = -1;
81 }
82
83 ~PauseMenu() {}
84
85 void updateMode(const bool &ironman) {
86 _menu._element[PS_SAVE - 1]._visible = !ironman;
87 _menu._element[PS_LOAD - 1]._visible = !ironman;
88 }
89
90 void load(rapidxml::xml_node<char> *node);
91
92 PauseSignal handleEvents(const Common::Event &event, Button &back);
93
94 // Returns true if inside options menu, false otherwise
95 bool draw(Button &back);
96
97 void reset() {
98 _state = STATE_NORMAL;
99 }
100
101 void scanDir() {
102 _save.scanDir();
103 }
104
105 Common::String saveFile() {
106 return _save.selectedPath();
107 }
108
109 bool disableHotkeys();
110
111 // Should we allow the pause key(default escape) to quit to main menu?
112 // This is done because esc is both the "go back on menu level" and the pause key
113 bool showLevel() {
114 return _state == STATE_NORMAL;
115 }
116
117 void setUI();
118};
119} // End of namespace ui
120} // End of namespace pyrodactyl
121
122} // End of namespace Crab
123
124#endif // CRAB_PAUSEMENU_H
Definition: str.h:59
Definition: button.h:86
Definition: SaveGameMenu.h:41
Definition: ImageData.h:40
Definition: PauseMenu.h:57
Definition: events.h:218