-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproc.cpp
More file actions
128 lines (105 loc) · 2.91 KB
/
proc.cpp
File metadata and controls
128 lines (105 loc) · 2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "gamos/gamos.h"
namespace Gamos {
void SystemProc::processMessage(const Common::Event &ev) {
uint8 winKey;
switch (ev.type) {
case Common::EVENT_KEYDOWN:
if ((_inputFlags & 1) == 0)
return;
_ascii = ev.kbd.ascii;
winKey = _codesConverter->getWinCode(ev.kbd.keycode);
if (winKey == KeyCodes::WIN_BACK ||
winKey == KeyCodes::WIN_RETURN ||
winKey == KeyCodes::WIN_ESCAPE)
_rawKeyCode = winKey;
else if (_ascii != 0)
_rawKeyCode = _codesConverter->getCPCode(_ascii);
if (_rawKeyCode == 0)
_rawKeyCode = ACT_NONE;
if (winKey != KeyCodes::WIN_INVALID) {
if (winKey == _keyCodes[0])
_act1 = 0;
else if (winKey == _keyCodes[1])
_act1 = 1;
else if (winKey == _keyCodes[2])
_act1 = 2;
else if (winKey == _keyCodes[3])
_act1 = 3;
else if (winKey == _keyCodes[4])
_act1 = 4;
else if (winKey == _keyCodes[5])
_act1 = 5;
else if (winKey == _keyCodes[6])
_act1 = 6;
else if (winKey == _keyCodes[7])
_act1 = 7;
else {
if (winKey == _keyCodes[8])
_act2 = ACT2_MOUSEUP_L;
else if (winKey == _keyCodes[9])
_act2 = ACT2_MOUSEUP_R;
else if (winKey == _keyCodes[10])
_act2 = ACT2_TAB;
else if (winKey == _keyCodes[11])
_act2 = ACT2_HELP;
else
return;
_rawKeyCode = winKey;
return;
}
}
if ((_act1 < 8) && (ev.kbd.flags & Common::KBD_SHIFT))
_act1 |= 8;
_mouseActPos = _mouseReportedPos;
break;
case Common::EVENT_MOUSEMOVE:
if ((_inputFlags & 2) == 0)
return;
_mouseReportedPos = ev.mouse;
break;
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN:
if ((_inputFlags & 2) == 0)
return;
_mouseActPos = ev.mouse;
_act2 = ACT2_MOUSEDOWN;
break;
case Common::EVENT_LBUTTONUP:
if ((_inputFlags & 2) == 0)
return;
_mouseActPos = ev.mouse;
_act2 = ACT2_MOUSEUP_L;
_rawKeyCode = _keyCodes[8];
break;
case Common::EVENT_RBUTTONUP:
if ((_inputFlags & 2) == 0)
return;
_mouseActPos = ev.mouse;
_act2 = ACT2_MOUSEUP_R;
_rawKeyCode = _keyCodes[9];
break;
default:
break;
}
}
}