28 #ifndef CCEGUIEVENTPUSHER_H_INCLUDED
29 #define CCEGUIEVENTPUSHER_H_INCLUDED
31 #include "../../CEGUI.h"
40 gui::ICursorControl* d_cursorctrl;
42 core::position2d<s32> d_pos;
43 core::position2d<s32> d_dpos;
49 d_cursorctrl->setPosition(0.5f, 0.5f);
50 d_pos = d_cursorctrl->getPosition();
58 bool OnEvent(
const SEvent& event)
60 switch (event.EventType)
62 case EET_KEY_INPUT_EVENT :
63 if (event.KeyInput.PressedDown)
64 return OnKeyDown(event.KeyInput.Key, event.KeyInput.Char, event.KeyInput.Control, event.KeyInput.Shift);
66 return OnKeyUp(event.KeyInput.Key, event.KeyInput.Char, event.KeyInput.Control, event.KeyInput.Shift);
69 case EET_MOUSE_INPUT_EVENT :
70 return OnMouse(event.MouseInput.X, event.MouseInput.Y, event.MouseInput.Wheel, event.MouseInput.Event);
80 bool OnKeyDown(EKEY_CODE key,
wchar_t wch,
bool ,
bool )
89 bool OnKeyUp(EKEY_CODE key,
wchar_t ,
bool ,
bool )
97 bool OnMouse(s32 x, s32 y, f32 w, EMOUSE_INPUT_EVENT e)
100 bool handled =
false;
105 case EMIE_LMOUSE_PRESSED_DOWN:
109 case EMIE_RMOUSE_PRESSED_DOWN:
113 case EMIE_MMOUSE_PRESSED_DOWN:
117 case EMIE_LMOUSE_LEFT_UP:
121 case EMIE_RMOUSE_LEFT_UP:
125 case EMIE_MMOUSE_LEFT_UP:
129 case EMIE_MOUSE_MOVED:
131 static_cast<float>(x), static_cast<float>(y));
135 case EMIE_MOUSE_WHEEL:
146 unsigned char irr2ceCODE[irr::KEY_KEY_CODES_COUNT];
151 memset(irr2ceCODE, 0, KEY_KEY_CODES_COUNT);
153 irr2ceCODE[KEY_LBUTTON ] = 0;
154 irr2ceCODE[KEY_RBUTTON ] = 0;
155 irr2ceCODE[KEY_CANCEL ] = 0;
156 irr2ceCODE[KEY_MBUTTON ] = 0;
157 irr2ceCODE[KEY_XBUTTON1 ] = 0;
158 irr2ceCODE[KEY_XBUTTON2 ] = 0;
159 irr2ceCODE[KEY_BACK ] = Key::Backspace;
160 irr2ceCODE[KEY_TAB ] = Key::Tab;
161 irr2ceCODE[KEY_CLEAR ] = 0;
162 irr2ceCODE[KEY_RETURN ] = Key::Return;
163 irr2ceCODE[KEY_SHIFT ] = Key::LeftShift;
164 irr2ceCODE[KEY_CONTROL ] = Key::LeftControl;
165 irr2ceCODE[KEY_MENU ] = Key::LeftAlt;
166 irr2ceCODE[KEY_PAUSE ] = Key::Pause;
167 irr2ceCODE[KEY_CAPITAL ] = Key::Capital;
168 irr2ceCODE[KEY_KANA ] = Key::Kana;
169 irr2ceCODE[KEY_HANGUEL ] = KEY_HANGUEL;
170 irr2ceCODE[KEY_HANGUL ] = KEY_HANGUL;
171 irr2ceCODE[KEY_JUNJA ] = 0;
172 irr2ceCODE[KEY_FINAL ] = 0;
173 irr2ceCODE[KEY_HANJA ] = 0;
174 irr2ceCODE[KEY_KANJI ] = 0;
175 irr2ceCODE[KEY_ESCAPE ] = Key::Escape;
176 irr2ceCODE[KEY_CONVERT ] = Key::Convert;
177 irr2ceCODE[KEY_NONCONVERT] = Key::NoConvert;
178 irr2ceCODE[KEY_ACCEPT ] = 0;
179 irr2ceCODE[KEY_MODECHANGE] = 0;
180 irr2ceCODE[KEY_SPACE ] = Key::Space;
181 irr2ceCODE[KEY_PRIOR ] = Key::PageUp;
182 irr2ceCODE[KEY_NEXT ] = Key::PageDown;
183 irr2ceCODE[KEY_END ] = Key::End;
184 irr2ceCODE[KEY_HOME ] = Key::Home;
185 irr2ceCODE[KEY_LEFT ] = Key::ArrowLeft;
186 irr2ceCODE[KEY_UP ] = Key::ArrowUp;
187 irr2ceCODE[KEY_RIGHT ] = Key::ArrowRight;
188 irr2ceCODE[KEY_DOWN ] = Key::ArrowDown;
189 irr2ceCODE[KEY_SELECT ] = 0;
190 irr2ceCODE[KEY_PRINT ] = Key::SysRq;
191 irr2ceCODE[KEY_EXECUT ] = 0;
192 irr2ceCODE[KEY_SNAPSHOT ] = 0;
193 irr2ceCODE[KEY_INSERT ] = Key::Insert;
194 irr2ceCODE[KEY_DELETE ] = Key::Delete;
195 irr2ceCODE[KEY_HELP ] = 0;
196 irr2ceCODE[KEY_KEY_0 ] = Key::Zero;
197 irr2ceCODE[KEY_KEY_1 ] = Key::One;
198 irr2ceCODE[KEY_KEY_2 ] = Key::Two;
199 irr2ceCODE[KEY_KEY_3 ] = Key::Three;
200 irr2ceCODE[KEY_KEY_4 ] = Key::Four;
201 irr2ceCODE[KEY_KEY_5 ] = Key::Five;
202 irr2ceCODE[KEY_KEY_6 ] = Key::Six;
203 irr2ceCODE[KEY_KEY_7 ] = Key::Seven;
204 irr2ceCODE[KEY_KEY_8 ] = Key::Eight;
205 irr2ceCODE[KEY_KEY_9 ] = Key::Nine;
206 irr2ceCODE[KEY_KEY_A ] = Key::A;
207 irr2ceCODE[KEY_KEY_B ] = Key::B;
208 irr2ceCODE[KEY_KEY_C ] = Key::C;
209 irr2ceCODE[KEY_KEY_D ] = Key::D;
210 irr2ceCODE[KEY_KEY_E ] = Key::E;
211 irr2ceCODE[KEY_KEY_F ] = Key::F;
212 irr2ceCODE[KEY_KEY_G ] = Key::G;
213 irr2ceCODE[KEY_KEY_H ] = Key::H;
214 irr2ceCODE[KEY_KEY_I ] = Key::I;
215 irr2ceCODE[KEY_KEY_J ] = Key::J;
216 irr2ceCODE[KEY_KEY_K ] = Key::K;
217 irr2ceCODE[KEY_KEY_L ] = Key::L;
218 irr2ceCODE[KEY_KEY_M ] = Key::M;
219 irr2ceCODE[KEY_KEY_N ] = Key::N;
220 irr2ceCODE[KEY_KEY_O ] = Key::O;
221 irr2ceCODE[KEY_KEY_P ] = Key::P;
222 irr2ceCODE[KEY_KEY_Q ] = Key::Q;
223 irr2ceCODE[KEY_KEY_R ] = Key::R;
224 irr2ceCODE[KEY_KEY_S ] = Key::S;
225 irr2ceCODE[KEY_KEY_T ] = Key::T;
226 irr2ceCODE[KEY_KEY_U ] = Key::U;
227 irr2ceCODE[KEY_KEY_V ] = Key::V;
228 irr2ceCODE[KEY_KEY_W ] = Key::W;
229 irr2ceCODE[KEY_KEY_X ] = Key::X;
230 irr2ceCODE[KEY_KEY_Y ] = Key::Y;
231 irr2ceCODE[KEY_KEY_Z ] = Key::Z;
232 irr2ceCODE[KEY_LWIN ] = Key::LeftWindows;
233 irr2ceCODE[KEY_RWIN ] = Key::RightWindow;
234 irr2ceCODE[KEY_APPS ] = Key::AppMenu;
235 irr2ceCODE[KEY_SLEEP ] = Key::Sleep;
236 irr2ceCODE[KEY_NUMPAD0 ] = Key::Numpad0;
237 irr2ceCODE[KEY_NUMPAD1 ] = Key::Numpad1;
238 irr2ceCODE[KEY_NUMPAD2 ] = Key::Numpad2;
239 irr2ceCODE[KEY_NUMPAD3 ] = Key::Numpad3;
240 irr2ceCODE[KEY_NUMPAD4 ] = Key::Numpad4;
241 irr2ceCODE[KEY_NUMPAD5 ] = Key::Numpad5;
242 irr2ceCODE[KEY_NUMPAD6 ] = Key::Numpad6;
243 irr2ceCODE[KEY_NUMPAD7 ] = Key::Numpad7;
244 irr2ceCODE[KEY_NUMPAD8 ] = Key::Numpad8;
245 irr2ceCODE[KEY_NUMPAD9 ] = Key::Numpad9;
246 irr2ceCODE[KEY_MULTIPLY ] = Key::Multiply;
247 irr2ceCODE[KEY_ADD ] = Key::Add;
248 irr2ceCODE[KEY_SEPARATOR ] = 0;
249 irr2ceCODE[KEY_SUBTRACT ] = Key::Subtract;
250 irr2ceCODE[KEY_DECIMAL ] = Key::Decimal;
251 irr2ceCODE[KEY_DIVIDE ] = Key::Divide;
252 irr2ceCODE[KEY_F1 ] = Key::F1;
253 irr2ceCODE[KEY_F2 ] = Key::F2;
254 irr2ceCODE[KEY_F3 ] = Key::F3;
255 irr2ceCODE[KEY_F4 ] = Key::F4;
256 irr2ceCODE[KEY_F5 ] = Key::F5;
257 irr2ceCODE[KEY_F6 ] = Key::F6;
258 irr2ceCODE[KEY_F7 ] = Key::F7;
259 irr2ceCODE[KEY_F8 ] = Key::F8;
260 irr2ceCODE[KEY_F9 ] = Key::F9;
261 irr2ceCODE[KEY_F10 ] = Key::F10;
262 irr2ceCODE[KEY_F11 ] = Key::F11;
263 irr2ceCODE[KEY_F12 ] = Key::F12;
264 irr2ceCODE[KEY_F13 ] = Key::F13;
265 irr2ceCODE[KEY_F14 ] = Key::F14;
266 irr2ceCODE[KEY_F15 ] = Key::F15;
267 irr2ceCODE[KEY_F16 ] = 0;
268 irr2ceCODE[KEY_F17 ] = 0;
269 irr2ceCODE[KEY_F18 ] = 0;
270 irr2ceCODE[KEY_F19 ] = 0;
271 irr2ceCODE[KEY_F20 ] = 0;
272 irr2ceCODE[KEY_F21 ] = 0;
273 irr2ceCODE[KEY_F22 ] = 0;
274 irr2ceCODE[KEY_F23 ] = 0;
275 irr2ceCODE[KEY_F24 ] = 0;
276 irr2ceCODE[KEY_NUMLOCK ] = Key::NumLock;
277 irr2ceCODE[KEY_SCROLL ] = Key::ScrollLock;
278 irr2ceCODE[KEY_LSHIFT ] = Key::LeftShift;
279 irr2ceCODE[KEY_RSHIFT ] = Key::RightShift;
280 irr2ceCODE[KEY_LCONTROL ] = Key::LeftControl;
281 irr2ceCODE[KEY_RCONTROL ] = Key::RightControl;
282 irr2ceCODE[KEY_LMENU ] = Key::LeftAlt;
283 irr2ceCODE[KEY_RMENU ] = Key::RightAlt;
284 irr2ceCODE[KEY_COMMA ] = Key::Comma;
285 irr2ceCODE[KEY_PLUS ] = Key::Add;
286 irr2ceCODE[KEY_MINUS ] = Key::Minus;
287 irr2ceCODE[KEY_PERIOD ] = Key::Period;
288 irr2ceCODE[KEY_ATTN ] = 0;
289 irr2ceCODE[KEY_CRSEL ] = 0;
290 irr2ceCODE[KEY_EXSEL ] = 0;
291 irr2ceCODE[KEY_EREOF ] = 0;
292 irr2ceCODE[KEY_PLAY ] = 0;
293 irr2ceCODE[KEY_ZOOM ] = 0;
294 irr2ceCODE[KEY_PA1 ] = 0;
295 irr2ceCODE[KEY_OEM_CLEAR ] = 0;
305 uchar getKeyCode(irr::EKEY_CODE kc)
307 return irr2ceCODE[kc];