ScummVM API documentation
create_character.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 ULTIMA1_VIEWS_CREATE_CHARACTER_H
23#define ULTIMA1_VIEWS_CREATE_CHARACTER_H
24
25#include "ultima/ultima1/gfx/text_cursor.h"
26#include "ultima/ultima1/gfx/text_input.h"
27#include "ultima/ultima1/views/full_screen_dialog.h"
28
29namespace Ultima {
30namespace Ultima1 {
31namespace Views {
32
33using namespace Graphics::Views;
34
35constexpr int ATTRIBUTE_COUNT = 6;
36constexpr int STARTING_POINTS = 30;
37
43private:
44 enum State {
45 ATTRIBUTES, RACE, SEX, CLASS, NAME, SAVE
46 };
47 State _state = ATTRIBUTES;
48 int _pointsRemaining = STARTING_POINTS;
49 int _selectedAttribute = 0;
50
51 Gfx::TextCursor _cursor;
52 Gfx::TextInput _nameInput;
53
54 void drawAttributes(Graphics::Views::GfxSurface &s);
55 void drawHelp(Graphics::Views::GfxSurface &s);
56 void drawConfirmedRace(Graphics::Views::GfxSurface &s);
57 void drawConfirmedSex(Graphics::Views::GfxSurface &s);
58 void drawConfirmedClass(Graphics::Views::GfxSurface &s);
59
60 bool msgAttributesKey(const KeypressMessage &msg);
61 bool msgRaceKey(const KeypressMessage &msg);
62 bool msgSexKey(const KeypressMessage &msg);
63 bool msgClassKey(const KeypressMessage &msg);
64 bool msgSaveKey(const KeypressMessage &msg);
65
66 void selectRace(int race);
67 void selectSex(int sex);
68 void selectClass(int charClass);
69
70 int16 &attribute(int index);
71
75 void reset();
76
81 void confirmAndSave();
82
83public:
85 ~CreateCharacter() override {}
86
87 bool msgFocus(const FocusMessage &msg) override;
88 void draw() override;
89
90 bool msgKeypress(const KeypressMessage &msg) override;
91 bool msgGame(const GameMessage &msg) override;
92};
93
94} // namespace Views
95} // namespace Ultima1
96} // namespace Ultima
97
98#endif
Definition: gfx_surface.h:34
Definition: text_cursor.h:36
Definition: text_input.h:44
Definition: create_character.h:42
Definition: full_screen_dialog.h:34
Definition: messages.h:42
Definition: messages.h:94
Definition: messages.h:54