ScummVM API documentation
event.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
* Copyright 2020 Google
21
*
22
*/
23
#ifndef HADESCH_EVENT_H
24
#define HADESCH_EVENT_H
25
26
namespace
Hadesch
{
27
28
class
EventHandler
{
29
public
:
30
virtual
void
operator()() = 0;
31
virtual
~
EventHandler
() {}
32
};
33
34
class
EventHandlerWrapper
{
35
public
:
36
void
operator()()
const
;
37
bool
operator==(
int
eventId)
const
;
38
39
EventHandlerWrapper
(
int
eventId) {
40
_eventId = eventId;
41
}
42
43
EventHandlerWrapper
() {
44
_eventId = -1;
45
}
46
47
EventHandlerWrapper
(
Common::SharedPtr<EventHandler>
handler) {
48
_handler = handler;
49
_eventId = -1;
50
}
51
52
Common::String
getDebugString()
const
{
53
return
Common::String::format
(
"eventid=%d, handler is %s"
, _eventId,
54
!!_handler ?
"valid"
:
"null"
);
55
}
56
57
private
:
58
Common::SharedPtr<EventHandler>
_handler;
59
int
_eventId;
60
};
61
}
62
63
#endif
Hadesch::EventHandler
Definition:
event.h:28
Common::String
Definition:
str.h:59
Common::String::format
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Hadesch::EventHandlerWrapper
Definition:
event.h:34
Hadesch
Definition:
ambient.h:30
Common::SharedPtr
Definition:
ptr.h:159
engines
hadesch
event.h
Generated on Thu Nov 14 2024 09:09:59 for ScummVM API documentation by
1.8.13