ScummVM API documentation
saveloadmenu.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 STARK_UI_MENU_SAVELOAD_MENU_H
23
#define STARK_UI_MENU_SAVELOAD_MENU_H
24
25
#include "engines/stark/ui/menu/locationscreen.h"
26
#include "engines/stark/visual/text.h"
27
28
#include "common/error.h"
29
30
namespace
Stark
{
31
32
namespace
Gfx {
33
class
Bitmap;
34
class
SurfaceRenderer;
35
}
36
37
class
SaveDataWidget;
38
42
class
SaveLoadMenuScreen
:
public
StaticLocationScreen
{
43
public
:
44
static
const
int
_slotPerRow = 3;
45
static
const
int
_slotPerColumn = 3;
46
static
const
int
_slotPerPage = 9;
47
48
SaveLoadMenuScreen
(
Gfx::Driver
*gfx,
Cursor
*cursor, Screen::Name screenName);
49
virtual
~
SaveLoadMenuScreen
();
50
51
// StaticLocationScreen API
52
void
open()
override
;
53
void
close()
override
;
54
56
virtual
void
onWidgetSelected(
SaveDataWidget
*widget) = 0;
57
59
virtual
bool
isSaveMenu() = 0;
60
61
protected
:
62
static
void
checkError(
Common::Error
error
);
63
64
enum
WidgetIndex {
65
kWidgetSaveText = 3,
66
kWidgetLoadText = 4,
67
kWidgetBack = 5,
68
kWidgetNext = 6
69
};
70
71
private
:
72
// Start from zero
73
int
_page;
74
int
_maxPage;
75
76
void
backHandler();
77
78
void
prevPageHandler() { changePage(_page - 1); }
79
void
nextPageHandler() { changePage(_page + 1); }
80
81
void
removeSaveDataWidgets();
82
void
loadSaveData(
int
page);
83
void
changePage(
int
page);
84
int
computeMaxPage();
85
};
86
90
class
SaveMenuScreen
:
public
SaveLoadMenuScreen
{
91
public
:
92
SaveMenuScreen
(
Gfx::Driver
*gfx,
Cursor
*cursor) :
93
SaveLoadMenuScreen
(gfx, cursor, Screen::kScreenSaveMenu),
94
_slotToSaveAfterConfirm(
nullptr
) {}
95
virtual
~
SaveMenuScreen
() {}
96
97
// SaveLoadMenuScreen API
98
void
open()
override
;
99
100
void
onWidgetSelected(
SaveDataWidget
*widget)
override
;
101
102
bool
isSaveMenu
()
override
{
return
true
; }
103
104
private
:
105
void
saveGameToSlot(
SaveDataWidget
*widget);
106
void
saveConfirmSlot();
107
108
SaveDataWidget
*_slotToSaveAfterConfirm;
109
};
110
114
class
LoadMenuScreen
:
public
SaveLoadMenuScreen
{
115
public
:
116
LoadMenuScreen
(
Gfx::Driver
*gfx,
Cursor
*cursor) :
117
SaveLoadMenuScreen
(gfx, cursor, Screen::kScreenLoadMenu),
118
_slotToLoadAfterConfirm(-1) {}
119
~
LoadMenuScreen
()
override
{}
120
121
// SaveLoadMenuScreen API
122
void
open()
override
;
123
124
void
onWidgetSelected(
SaveDataWidget
*widget)
override
;
125
126
bool
isSaveMenu
()
override
{
return
false
; }
127
128
private
:
129
void
loadConfirmSlot();
130
131
int
_slotToLoadAfterConfirm;
132
};
133
137
class
SaveDataWidget
:
public
StaticLocationWidget
{
138
public
:
139
SaveDataWidget
(
int
slot,
Gfx::Driver
*gfx,
SaveLoadMenuScreen
*screen);
140
~
SaveDataWidget
();
141
142
// StaticLocationWidget API
143
void
render()
override
;
144
bool
isMouseInside(
const
Common::Point
&mousePos)
const override
;
145
void
onClick()
override
;
146
void
onMouseMove(
const
Common::Point
&mousePos)
override
;
147
void
onScreenChanged()
override
;
148
149
int
getSlot() {
return
_slot; }
150
Common::String
getName() {
return
_name; }
151
153
void
loadSaveDataElements();
154
156
bool
hasSave
() {
return
_hasSave; }
157
158
private
:
159
const
Gfx::Color
_outlineColor =
Gfx::Color
(0x1E, 0x1E, 0x96);
160
const
Gfx::Color
_textColor =
Gfx::Color
(0x5C, 0x48, 0x3D);
161
162
int
_slot;
163
SaveLoadMenuScreen
*_screen;
164
165
Common::Point
_thumbPos, _textDescPos, _textTimePos;
166
int
_thumbWidth, _thumbHeight;
167
168
Gfx::Bitmap
*_bitmap;
169
Gfx::Bitmap
*_outline;
170
Gfx::SurfaceRenderer
*_surfaceRenderer;
171
172
VisualText
_textDesc, _textTime;
173
174
bool
_isMouseHovered;
175
bool
_hasSave;
176
177
Common::String
_name;
178
};
179
180
}
// End of namespace Stark
181
182
#endif // STARK_UI_MENU_SETTING_MENU_H
Common::String
Definition:
str.h:59
Stark::StaticLocationWidget
Definition:
locationscreen.h:92
Common::Error
Definition:
error.h:84
Stark::SaveMenuScreen
Definition:
saveloadmenu.h:90
Stark::SaveMenuScreen::isSaveMenu
bool isSaveMenu() override
Definition:
saveloadmenu.h:102
Stark::Gfx::SurfaceRenderer
Definition:
surfacerenderer.h:36
Stark::Gfx::Driver
Definition:
driver.h:44
Stark::Cursor
Definition:
cursor.h:45
Stark::StaticLocationScreen
Definition:
locationscreen.h:46
Stark::VisualText
Definition:
text.h:44
Stark
Definition:
console.h:27
Stark::Gfx::Bitmap
Definition:
bitmap.h:38
Common::Point
Definition:
rect.h:45
error
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Stark::SaveDataWidget::hasSave
bool hasSave()
Definition:
saveloadmenu.h:156
Stark::Gfx::Color
Definition:
color.h:30
Stark::SaveDataWidget
Definition:
saveloadmenu.h:137
Stark::LoadMenuScreen
Definition:
saveloadmenu.h:114
Stark::SaveLoadMenuScreen
Definition:
saveloadmenu.h:42
Stark::LoadMenuScreen::isSaveMenu
bool isSaveMenu() override
Definition:
saveloadmenu.h:126
engines
stark
ui
menu
saveloadmenu.h
Generated on Sat Aug 31 2024 09:16:50 for ScummVM API documentation by
1.8.13