ScummVM API documentation
events.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 original Sfinx source code
24
* Copyright (c) 1994-1997 Janusz B. Wisniewski and L.K. Avalon
25
*/
26
27
#ifndef CGE2_EVENTS_H
28
#define CGE2_EVENTS_H
29
30
#include "common/events.h"
31
#include "cge2/talk.h"
32
#include "cge2/vga13h.h"
33
34
namespace
CGE2
{
35
36
/*----------------- KEYBOARD interface -----------------*/
37
38
#define kEventMax 256
39
40
enum
EventMask {
41
kMouseRoll = 1 << 0,
42
kMouseLeftDown = 1 << 1,
43
kMouseLeftUp = 1 << 2,
44
kMouseRightDown = 1 << 3,
45
kMouseRightUp = 1 << 4,
46
kEventAttn = 1 << 5,
47
kMouseMask = (kMouseRoll | kMouseLeftDown | kMouseLeftUp | kMouseRightDown | kMouseRightUp),
48
kEventEsc = 1 << 7
49
};
50
51
class
Keyboard
{
52
private
:
53
CGE2Engine
*_vm;
54
public
:
55
Sprite
*_client;
56
57
void
handleAction(
Common::Event
&event);
58
Sprite
*setClient(
Sprite
*spr);
59
60
Keyboard
(
CGE2Engine
*vm);
61
~
Keyboard
();
62
};
63
64
/*----------------- MOUSE interface -----------------*/
65
66
struct
CGE2Event
{
67
uint16 _mask;
68
uint16 _x;
69
uint16 _y;
70
Sprite
*_spritePtr;
71
};
72
73
class
Mouse
:
public
Sprite
{
74
public
:
75
V2D
_point;
76
Sprite
*_hold;
77
bool
_active;
78
int
_hx;
79
int
_hy;
80
bool
_exist;
81
int
_buttons;
82
Sprite
*_busy;
83
Mouse
(
CGE2Engine
*vm);
84
~
Mouse
()
override
;
85
void
on();
86
void
off();
87
void
newMouse(
Common::Event
&event);
88
private
:
89
CGE2Engine
*_vm;
90
};
91
92
/*----------------- EventManager interface -----------------*/
93
94
class
EventManager
{
95
private
:
96
CGE2Engine
*_vm;
97
Common::Event
_event;
98
CGE2Event
_eventQueue[kEventMax];
99
uint16 _eventQueueHead;
100
uint16 _eventQueueTail;
101
102
void
handleEvents();
103
public
:
104
EventManager
(
CGE2Engine
*vm);
105
void
poll();
106
void
clearEvent(
Sprite
*spr);
107
108
CGE2Event
&getNextEvent();
109
};
110
111
}
// End of namespace CGE
112
113
#endif // #define CGE2_EVENTS_H
CGE2::CGE2Engine
Definition:
cge2.h:149
CGE2::Mouse
Definition:
events.h:73
CGE2::EventManager
Definition:
events.h:94
CGE2::Sprite
Definition:
vga13h.h:152
CGE2::V2D
Definition:
vga13h.h:94
CGE2
Definition:
bitmap.h:33
Common::Event
Definition:
events.h:199
CGE2::Keyboard
Definition:
events.h:51
CGE2::CGE2Event
Definition:
events.h:66
engines
cge2
events.h
Generated on Sun Dec 22 2024 09:05:33 for ScummVM API documentation by
1.8.13