Mercurial > fife-parpg
annotate engine/core/eventchannel/eventmanager.h @ 487:7f1c42b66aa4
Moved the shooter demo Timer() class to helpers.py.
Changed the formula that calculates the length of the audio clip to be correct.
The shooter demo now demonstrates the use of the audio clip callbacks correctly.
Fixed the fife_timer extension to actually work.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 03 May 2010 19:58:16 +0000 |
parents | a1884665aa95 |
children | b312d170ab0c |
rev | line source |
---|---|
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 /*************************************************************************** |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 * Copyright (C) 2005-2008 by the FIFE team * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 * http://www.fifengine.de * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 * This file is part of FIFE. * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 * * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
6 * FIFE is free software; you can redistribute it and/or * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
8 * License as published by the Free Software Foundation; either * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 * * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
14 * Lesser General Public License for more details. * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 * * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public * |
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
17 * License along with this library; if not, write to the * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 * Free Software Foundation, Inc., * |
46
90005975cdbb
* Final LGPL switch step by adjusting the file headers
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 ***************************************************************************/ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 #ifndef FIFE_EVENTCHANNEL_EVENTMANAGER_H |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 #define FIFE_EVENTCHANNEL_EVENTMANAGER_H |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 // Standard C++ library includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 // |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
27 #include <deque> |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 #include <map> |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 #include <list> |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 // 3rd party library includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 // |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 // FIFE includes |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 // These includes are split up in two parts, separated by one empty line |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 // First block: files included from the FIFE root src directory |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 // Second block: files included from the same folder |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
38 // |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
39 #include "eventchannel/command/ec_command.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
40 #include "eventchannel/command/ec_icommandcontroller.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
41 #include "eventchannel/command/ec_icommandlistener.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
43 #include "eventchannel/key/ec_ikeycontroller.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
44 #include "eventchannel/key/ec_ikeylistener.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 #include "eventchannel/key/ec_keyevent.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
46 #include "eventchannel/key/ec_key.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
47 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
48 #include "eventchannel/mouse/ec_imousecontroller.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
49 #include "eventchannel/mouse/ec_imouselistener.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
50 #include "eventchannel/mouse/ec_mouseevent.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
51 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
52 #include "eventchannel/sdl/ec_isdleventcontroller.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
53 #include "eventchannel/sdl/ec_isdleventlistener.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
54 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 #include "eventchannel/trigger/ec_itriggercontroller.h" |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
56 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
57 namespace FIFE { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 class ICommandListener; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
60 class InputEvent; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
61 class MouseEvent; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
62 class KeyEvent; |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
63 class IKeyFilter; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
64 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
65 /** Event Manager manages all events related to FIFE |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
66 */ |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
67 class EventManager: |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 public ICommandController, |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
69 public IKeyController, |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
70 public IMouseController, |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
71 public ISdlEventController, |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
72 public IEventSource, |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 public ITriggerController { |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
74 public: |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 /** Constructor. |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
76 */ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 EventManager(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 /** Destructor |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 */ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 virtual ~EventManager(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
83 void addCommandListener(ICommandListener* listener); |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
84 void addCommandListenerFront(ICommandListener* listener); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
85 void removeCommandListener(ICommandListener* listener); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 void dispatchCommand(Command& command); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
87 void addKeyListener(IKeyListener* listener); |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
88 void addKeyListenerFront(IKeyListener* listener); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 void removeKeyListener(IKeyListener* listener); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
90 void addMouseListener(IMouseListener* listener); |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
91 void addMouseListenerFront(IMouseListener* listener); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 void removeMouseListener(IMouseListener* listener); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 void addSdlEventListener(ISdlEventListener* listener); |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
94 void addSdlEventListenerFront(ISdlEventListener* listener); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
95 void removeSdlEventListener(ISdlEventListener* listener); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
96 EventSourceType getEventSourceType(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
97 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 void registerTrigger(Trigger& trigger); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 void unregisterTrigger(Trigger& trigger); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 /** Process the SDL event queue. |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
102 * This is to be called only by the engine itself once per frame. |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
103 * It passes appropriate events to their listeners |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 */ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
105 void processEvents(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
106 |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
107 void setKeyFilter(IKeyFilter* keyFilter); |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
108 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 private: |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
110 // Helpers for processEvents |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
111 void processActiveEvent(SDL_Event event); |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
112 void processKeyEvent(SDL_Event event); |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
113 void processMouseEvent(SDL_Event event); |
103
c512dff398c2
combine events (currently only mouse motion events), that helps reducing lag in clients
spq@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
46
diff
changeset
|
114 bool combineEvents(SDL_Event& event1, const SDL_Event& event2); |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
115 |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
116 // Events dispatchers - only dispatchSdlevent may reject the event. |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
117 bool dispatchSdlEvent(SDL_Event& evt); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 void dispatchKeyEvent(KeyEvent& evt); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 void dispatchMouseEvent(MouseEvent& evt); |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
120 |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
121 // Translate events |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 void fillModifiers(InputEvent& evt); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 void fillKeyEvent(const SDL_Event& sdlevt, KeyEvent& keyevt); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
124 void fillMouseEvent(const SDL_Event& sdlevt, MouseEvent& mouseevt); |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
125 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 void pollTriggers(); |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
127 |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
128 std::deque<ICommandListener*> m_commandlisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
129 std::deque<ICommandListener*> m_pending_commandlisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
130 std::deque<ICommandListener*> m_pending_commandlisteners_front; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
131 std::deque<ICommandListener*> m_pending_cldeletions; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
133 std::deque<IKeyListener*> m_keylisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
134 std::deque<IKeyListener*> m_pending_keylisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
135 std::deque<IKeyListener*> m_pending_keylisteners_front; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
136 std::deque<IKeyListener*> m_pending_kldeletions; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
137 |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
138 std::deque<IMouseListener*> m_mouselisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
139 std::deque<IMouseListener*> m_pending_mouselisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
140 std::deque<IMouseListener*> m_pending_mouselisteners_front; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
141 std::deque<IMouseListener*> m_pending_mldeletions; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
142 |
428
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
143 std::deque<ISdlEventListener*> m_sdleventlisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
144 std::deque<ISdlEventListener*> m_pending_sdleventlisteners; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
145 std::deque<ISdlEventListener*> m_pending_sdleventlisteners_front; |
a1884665aa95
Added the ability to add an event listener to the front of the event listener deque in the event manager. fixes[t:454]
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
157
diff
changeset
|
146 std::deque<ISdlEventListener*> m_pending_sdldeletions; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
147 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
148 std::map<int, bool> m_keystatemap; |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
149 IKeyFilter* m_keyfilter; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
150 int m_mousestate; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
151 MouseEvent::MouseButtonType m_mostrecentbtn; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
152 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
153 std::list<Trigger*> m_triggers; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
154 }; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
155 } //FIFE |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
156 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
157 #endif |