Mercurial > fife-parpg
annotate engine/core/eventchannel/eventmanager.h @ 697:ecaa4d98f05f tip
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
* Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring.
* GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass.
* The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class.
* The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged.
* Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author | M. George Hansen <technopolitica@gmail.com> |
---|---|
date | Sat, 18 Jun 2011 00:28:40 -1000 |
parents | b312d170ab0c |
children |
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 namespace FIFE { |
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 class ICommandListener; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 class InputEvent; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 class MouseEvent; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
60 class KeyEvent; |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
61 class IKeyFilter; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
62 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
63 /** 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
|
64 */ |
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
|
65 class EventManager: |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
66 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
|
67 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
|
68 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
|
69 public ISdlEventController, |
624
b312d170ab0c
* Removed the "trigger" system as it was not in use and very incomplete. I couldn't come up with a good reason why it should be part of event channel either. The trigger system is scheduled for a future release anyway.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
428
diff
changeset
|
70 public IEventSource { |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
71 public: |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
72 /** Constructor. |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 */ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
74 EventManager(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
76 /** Destructor |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 */ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 virtual ~EventManager(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 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
|
81 void addCommandListenerFront(ICommandListener* listener); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 void removeCommandListener(ICommandListener* listener); |
624
b312d170ab0c
* Removed the "trigger" system as it was not in use and very incomplete. I couldn't come up with a good reason why it should be part of event channel either. The trigger system is scheduled for a future release anyway.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
428
diff
changeset
|
83 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
84 void dispatchCommand(Command& command); |
624
b312d170ab0c
* Removed the "trigger" system as it was not in use and very incomplete. I couldn't come up with a good reason why it should be part of event channel either. The trigger system is scheduled for a future release anyway.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
428
diff
changeset
|
85 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 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
|
87 void addKeyListenerFront(IKeyListener* listener); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 void removeKeyListener(IKeyListener* listener); |
624
b312d170ab0c
* Removed the "trigger" system as it was not in use and very incomplete. I couldn't come up with a good reason why it should be part of event channel either. The trigger system is scheduled for a future release anyway.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
428
diff
changeset
|
89 |
0
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); |
624
b312d170ab0c
* Removed the "trigger" system as it was not in use and very incomplete. I couldn't come up with a good reason why it should be part of event channel either. The trigger system is scheduled for a future release anyway.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
428
diff
changeset
|
93 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
94 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
|
95 void addSdlEventListenerFront(ISdlEventListener* listener); |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
96 void removeSdlEventListener(ISdlEventListener* listener); |
624
b312d170ab0c
* Removed the "trigger" system as it was not in use and very incomplete. I couldn't come up with a good reason why it should be part of event channel either. The trigger system is scheduled for a future release anyway.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
428
diff
changeset
|
97 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 EventSourceType getEventSourceType(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 /** 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
|
101 * 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
|
102 * 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
|
103 */ |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 void processEvents(); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
105 |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
106 void setKeyFilter(IKeyFilter* keyFilter); |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
107 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 private: |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
109 // Helpers for processEvents |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
110 void processActiveEvent(SDL_Event event); |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
111 void processKeyEvent(SDL_Event event); |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
112 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
|
113 bool combineEvents(SDL_Event& event1, const SDL_Event& event2); |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
114 |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
115 // Events dispatchers - only dispatchSdlevent may reject the event. |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
116 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
|
117 void dispatchKeyEvent(KeyEvent& evt); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 void dispatchMouseEvent(MouseEvent& evt); |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
119 |
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
120 // Translate events |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 void fillModifiers(InputEvent& evt); |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 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
|
123 void fillMouseEvent(const SDL_Event& sdlevt, MouseEvent& mouseevt); |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
124 |
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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 |
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
|
130 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
|
131 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
|
132 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
|
133 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
|
134 |
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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 |
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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
145 std::map<int, bool> m_keystatemap; |
157
bb9902910067
input_rework merged!
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
103
diff
changeset
|
146 IKeyFilter* m_keyfilter; |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
147 int m_mousestate; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
148 MouseEvent::MouseButtonType m_mostrecentbtn; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
149 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
150 }; |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
151 } //FIFE |
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 #endif |