ScummVM API documentation
interaction.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 ULTIMA3_VIEWS_INTERACTIONS_INTERACTION_H
23#define ULTIMA3_VIEWS_INTERACTIONS_INTERACTION_H
24
25#include "graphics/views/view.h"
26#include "ultima/ultima3/logic/logic.h"
27
28namespace Ultima {
29namespace Ultima3 {
30namespace Views {
31namespace Interactions {
32
33using namespace Graphics::Views;
34
41public:
42 virtual ~Interaction() {}
43
47 virtual bool isFinished() const {
48 return false;
49 }
50
55 virtual bool isEndgame() const {
56 return false;
57 }
58
63 virtual bool keypress(const KeypressMessage &msg) = 0;
64
69 virtual bool timeout() {
70 return false;
71 }
72
76 virtual void draw(GfxSurface &) {}
77};
78
83private:
84 int _slot = -1;
85
86public:
87 enum Result {
88 PENDING,
89 CANCELLED,
90 CHOSEN
91 };
92
97 Result handleKey(const KeypressMessage &msg);
98
102 int slot() const {
103 return _slot;
104 }
105};
106
111private:
112 Direction _dir = DIR_NONE;
113
114public:
115 enum Result {
116 PENDING,
117 CANCELLED,
118 CHOSEN
119 };
120
124 Result handleKey(const KeypressMessage &msg);
125
126 Direction direction() const {
127 return _dir;
128 }
129};
130
131} // namespace Interactions
132} // namespace Views
133} // namespace Ultima3
134} // namespace Ultima
135
136#endif
Definition: gfx_surface.h:34
Result handleKey(const KeypressMessage &msg)
virtual bool timeout()
Definition: interaction.h:69
virtual void draw(GfxSurface &)
Definition: interaction.h:76
virtual bool isFinished() const
Definition: interaction.h:47
virtual bool isEndgame() const
Definition: interaction.h:55
virtual bool keypress(const KeypressMessage &msg)=0
int slot() const
Definition: interaction.h:102
Result handleKey(const KeypressMessage &msg)
Definition: messages.h:54