Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
#include "stdafx.h"

#include "Headers/InputInterface.h"

#include "Core/Headers/StringHelper.h"
#include "Utility/Headers/Localization.h"
#include "Core/Headers/Console.h"

namespace Divide {
namespace Input {

typedef std::map<stringImpl, OIS::KeyCode> KeyByNameMap;
static KeyByNameMap initKeyByNameMap();
namespace {
    // App. heart beat frequency.
    const U8 g_nHartBeatFreq = 30;  // Hz

    // Effects update frequency (Hz) : Needs to be quite lower than app. 
    // heart beat frequency,
    // if we want to be able to calmly study effect changes ...
    const U8 g_nEffectUpdateFreq = 5;  // Hz

    KeyByNameMap g_keysByNameMap = initKeyByNameMap();
};

InputInterface::InputInterface(DisplayWindow& parent)
    : _parent(parent), 
      _pInputInterface(nullptr),
      _pEventHdlr(nullptr),
      _pJoystickInterface(nullptr),
      _pEffectMgr(nullptr),
      _bMustStop(false),
      _bIsInitialized(false),
      _keys(vectorImpl<KeyEvent>(KeyCode_PLACEHOLDER, KeyEvent(0)))
{
    for (U16 i = 0; i < KeyCode_PLACEHOLDER; ++i) {
        _keys[i]._key = static_cast<KeyCode>(i);
    }
}

InputInterface::~InputInterface()
{
    assert(!_bIsInitialized);
}

ErrorCode InputInterface::init(const vec2<U16>& inputAreaDimensions) {
    if (_bIsInitialized) {
        return ErrorCode::NO_ERR;
    }

    Console::printfn(Locale::get(_ID("INPUT_CREATE_START")));

    OIS::ParamList pl;
    
    std::stringstream ss;
#if defined(_WIN32)
    ss << (size_t)(_parent.handle()._handle);
    // Create OIS input manager
    pl.insert(std::make_pair("WINDOW", ss.str()));
    pl.insert(std::make_pair("w32_mouse", "DISCL_FOREGROUND"));
    pl.insert(std::make_pair("w32_mouse", "DISCL_NONEXCLUSIVE"));
    pl.insert(std::make_pair("w32_keyboard", "DISCL_FOREGROUND"));
    pl.insert(std::make_pair("w32_keyboard", "DISCL_NONEXCLUSIVE"));
#else
    ss << _parent.handle()._window;
    pl.insert(std::make_pair("GLXWINDOW", ss.str()));
    pl.insert(std::make_pair("XAutoRepeatOn", "true"));
    pl.insert(std::make_pair("x11_mouse_grab", "false"));
    pl.insert(std::make_pair("x11_mouse_hide", "false"));
    pl.insert(std::make_pair("x11_keyboard_grab", "false"));
#endif

    _pInputInterface = OIS::InputManager::createInputSystem(pl);
    assert(_pInputInterface != nullptr && "InputInterface error: Could not create OIS Input Interface");

    Console::printfn(Locale::get(_ID("INPUT_CREATE_OK")),
                     _pInputInterface->inputSystemName().c_str());

    // Create the event handler.
    _pEventHdlr = MemoryManager_NEW EventHandler(this, _parent);
    assert(_pEventHdlr != nullptr && "InputInterface error: EventHandler allocation failed!");

    I32 numKB = _pInputInterface->getNumberOfDevices(OIS::OISKeyboard);
    I32 numMouse = _pInputInterface->getNumberOfDevices(OIS::OISMouse);

    if (numKB == 0) {
        Console::printfn(Locale::get(_ID("ERROR_INPUT_CREATE_KB")), "No keyboards detected");
    }
    if (numMouse == 0) {
        Console::printfn(Locale::get(_ID("ERROR_INPUT_CREATE_MOUSE")), "No mice detected");
    }

    for (I32 i = 0; i < std::max(numKB, numMouse); ++i) {
        OIS::Keyboard* kb = nullptr;
        OIS::Mouse* mouse = nullptr;

        if (i < numKB) {
            // Create a simple keyboard
            kb = static_cast<OIS::Keyboard*>(_pInputInterface->createInputObject(OIS::OISKeyboard, true));
            kb->setEventCallback(_pEventHdlr);
            _keyboardIDToEntry[kb->getID()] = i;
        }
        if (i < numMouse) {
            mouse = static_cast<OIS::Mouse*>(_pInputInterface->createInputObject(OIS::OISMouse, true));
            mouse->setEventCallback(_pEventHdlr);

            const OIS::MouseState& ms = mouse->getMouseState();  // width and height are mutable
            ms.width = inputAreaDimensions.width;
            ms.height = inputAreaDimensions.height;
            _mouseIdToEntry[mouse->getID()] = i;
        }

        _kbMouseDevices.emplace_back(kb, mouse);
    }

    // Limit max joysticks to MAX_ALLOWED_JOYSTICKS
    I32 numJoysticks = std::min(_pInputInterface->getNumberOfDevices(OIS::OISJoyStick), to_I32(Joystick::COUNT));

    if (numJoysticks > 0) {
        U32 entryNum = to_base(Joystick::JOYSTICK_1);

        for (I32 i = 0; i < numJoysticks; ++i) {
            OIS::JoyStick* joystick = static_cast<OIS::JoyStick*>(_pInputInterface->createInputObject(OIS::OISJoyStick, true));
            joystick->setEventCallback(_pEventHdlr);
            _joystickIdToEntry[joystick->getID()] = static_cast<Joystick>(entryNum++);
            _joysticks.push_back(joystick);
        }

        // Create the joystick manager.
        _pJoystickInterface = MemoryManager_NEW JoystickInterface(_pInputInterface, _pEventHdlr);

        for (I32 i = 0; i < numJoysticks; ++i) {
            I32 max = _joysticks[i]->MAX_AXIS - 4000;
            _pJoystickInterface->setJoystickData(static_cast<Joystick>(i), JoystickData(max / 10, max));
        }

        if (!_pJoystickInterface->wasFFDetected()) {
            Console::printfn(Locale::get(_ID("WARN_INPUT_NO_FORCE_FEEDBACK")));
        } else {
            // Create force feedback effect manager.
            assert(_pEffectMgr == nullptr);
            _pEffectMgr = MemoryManager_NEW EffectManager(_pJoystickInterface, g_nEffectUpdateFreq);
            // Initialize the event handler.
            _pEventHdlr->initialize(_pJoystickInterface, _pEffectMgr);
        }
    } else {
        Console::printfn(Locale::get(_ID("ERROR_INPUT_CREATE_JOYSTICK")), "No joystick / gamepad devices detected!");
    }

    _bIsInitialized = true;

    return ErrorCode::NO_ERR;
}

void InputInterface::onChangeWindowSize(U16 w, U16 h) {
    for (KBMousePair& it : _kbMouseDevices) {
        if (it.second) {
            const OIS::MouseState& ms = it.second->getMouseState();
            ms.width = w;
            ms.height = h;
        }
    }
}

void InputInterface::terminate() {
    if (_pInputInterface) {
        for (KBMousePair& it : _kbMouseDevices) {
            if (it.first) {
                _pInputInterface->destroyInputObject(it.first);
            }
            if (it.second) {
                _pInputInterface->destroyInputObject(it.second);
            }
        }
        _kbMouseDevices.clear();

        for (OIS::JoyStick* it : _joysticks) {
             _pInputInterface->destroyInputObject(it);
        }
        _joysticks.clear();
        MemoryManager::DELETE(_pJoystickInterface);

        OIS::InputManager::destroyInputSystem(_pInputInterface);
        _pInputInterface = nullptr;
    }

    MemoryManager::DELETE(_pEventHdlr);

    MemoryManager::DELETE(_pEffectMgr);

    _bIsInitialized = false;
}

U8 InputInterface::update(const U64 deltaTimeUS) {
    ACKNOWLEDGE_UNUSED(deltaTimeUS);

    const U8 nMaxEffectUpdateCnt = g_nHartBeatFreq / g_nEffectUpdateFreq;
    U8 nEffectUpdateCnt = 0;

    if (!_bIsInitialized) {
        return 0;
    }
    if (_bMustStop) {
        terminate();
        return 0;
    }

    // This fires off buffered events for keyboards
    for (KBMousePair& it : _kbMouseDevices) {
        if (it.first) {
            it.first->capture();
        }
        if (it.second) {
            it.second->capture();
        }
    }

    if (_joysticks.size() > 0) {
        for (OIS::JoyStick* it : _joysticks) {
            it->capture();
        }

        // This fires off buffered events for each joystick we have
        if (_pEffectMgr != nullptr) {
            _pJoystickInterface->captureEvents();
            // Update currently selected effects if time has come to.
            if (!nEffectUpdateCnt) {
                _pEffectMgr->updateActiveEffects();
                nEffectUpdateCnt = nMaxEffectUpdateCnt;
            } else {
                nEffectUpdateCnt--;
            }
        }
    }

    return 1;
}

InputState InputInterface::getKeyState(U8 deviceIndex, KeyCode keyCode) const {
    I32 kbID = keyboard(deviceIndex);
    if (kbID != -1) {
        return _kbMouseDevices[kbID].first->isKeyDown(keyCode) ? InputState::PRESSED
                                                               : InputState::RELEASED;
    }

    return InputState::COUNT;
}

InputState InputInterface::getMouseButtonState(U8 deviceIndex, MouseButton button) const {
    I32 mouseID = mouse(deviceIndex);
    if (mouseID != -1) {
        return _kbMouseDevices[mouseID].second->getMouseState().buttonDown(button) ? InputState::PRESSED
                                                                                   : InputState::RELEASED;
    }

    return InputState::COUNT;
}

InputState InputInterface::getJoystickeButtonState(Input::Joystick deviceIndex, JoystickButton button) const {
    for (hashMapImpl<I32, Joystick>::value_type it : _joystickIdToEntry) {
        if (it.second == deviceIndex) {
            for (OIS::JoyStick* deviceIt : _joysticks) {
                if (deviceIt->getID() == it.first) {
                    const OIS::JoyStickState& joyState = deviceIt->getJoyStickState();
                    return joyState.mButtons[button] ? InputState::PRESSED
                                                     : InputState::RELEASED;
                }
                DIVIDE_UNEXPECTED_CALL("Invalid joystick entry detected!");
            }
        }
    }
    return InputState::COUNT;
}

Joystick InputInterface::joystick(I32 deviceID) const {
    hashMapImpl<I32, Joystick>::const_iterator it = _joystickIdToEntry.find(deviceID);
    if (it != std::cend(_joystickIdToEntry)) {
        return it->second;
    }

    return Joystick::COUNT;
}

I32 InputInterface::keyboard(I32 deviceID) const {
    hashMapImpl<I32, I32>::const_iterator it = _keyboardIDToEntry.find(deviceID);
    if (it != std::cend(_keyboardIDToEntry)) {
        return it->second;
    }

    return -1;
}

I32 InputInterface::mouse(I32 deviceID) const {
    hashMapImpl<I32, I32>::const_iterator it = _mouseIdToEntry.find(deviceID);
    if (it != std::cend(_mouseIdToEntry)) {
        return it->second;
    }

    return -1;
}

MouseButton  InputInterface::mouseButtonByName(const stringImpl& buttonName) {
    if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Left")) {
        return MouseButton::MB_Left;
    } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Right")) {
        return MouseButton::MB_Right;
    } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Middle")) {
        return MouseButton::MB_Middle;
    } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button3")) {
        return MouseButton::MB_Button3;
    } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button4")) {
        return MouseButton::MB_Button4;
    } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button5")) {
        return MouseButton::MB_Button5;
    } else if (Util::CompareIgnoreCase("MB_" + buttonName, "MB_Button6")) {
        return MouseButton::MB_Button6;
    }//else if (Util::CompareIgnoreCase(buttonName, "MB_Button7")) {
     //}

    return MouseButton::MB_Button7;
}

JoystickElement  InputInterface::joystickElementByName(const stringImpl& elementName) {
    if (Util::CompareIgnoreCase(elementName, "POV")) {
        return JoystickElement(JoystickElementType::POV_MOVE);
    } else if (Util::CompareIgnoreCase(elementName, "AXIS")) {
        return JoystickElement(JoystickElementType::AXIS_MOVE);
    } else if (Util::CompareIgnoreCase(elementName, "SLIDER")) {
        return JoystickElement(JoystickElementType::SLIDER_MOVE);
    } else if (Util::CompareIgnoreCase(elementName, "VECTOR")) {
        return JoystickElement(JoystickElementType::VECTOR_MOVE);
    } 

    vectorImpl<stringImpl> buttonElements = Util::Split(elementName, '_');
    assert(buttonElements.size() == 2 && "Invalid joystick element name!");
    assert(Util::CompareIgnoreCase(buttonElements[0], "BUTTON"));

    I32 buttonId = Util::ConvertData<I32, std::string>(buttonElements[1].c_str());
    return JoystickElement(JoystickElementType::BUTTON_PRESS, to_U8(buttonId));
}

OIS::KeyCode InputInterface::keyCodeByName(const stringImpl& name) {
    
    stringImpl nameCpy("KC_" + name);
    std::map<stringImpl, OIS::KeyCode>::const_iterator it;
    it = g_keysByNameMap.find(nameCpy);
    if (it == std::cend(g_keysByNameMap)) {
        std::transform(std::begin(nameCpy),
                       std::end(nameCpy),
                       std::begin(nameCpy),
                       [](char c) {
                           return static_cast<char>(::toupper(c));
                       });

        it = g_keysByNameMap.find(nameCpy);
    }
    assert(it != std::cend(g_keysByNameMap));

    return it->second;
}

KeyByNameMap initKeyByNameMap() {
    KeyByNameMap keysByNameMap;

    keysByNameMap["KC_UNASSIGNED"] = OIS::KC_UNASSIGNED;
    keysByNameMap["KC_ESCAPE"] = OIS::KC_ESCAPE;
    keysByNameMap["KC_1"] = OIS::KC_1;
    keysByNameMap["KC_2"] = OIS::KC_2;
    keysByNameMap["KC_3"] = OIS::KC_3;
    keysByNameMap["KC_4"] = OIS::KC_4;
    keysByNameMap["KC_5"] = OIS::KC_5;
    keysByNameMap["KC_6"] = OIS::KC_6;
    keysByNameMap["KC_7"] = OIS::KC_7;
    keysByNameMap["KC_8"] = OIS::KC_8;
    keysByNameMap["KC_9"] = OIS::KC_9;
    keysByNameMap["KC_0"] = OIS::KC_0;
    keysByNameMap["KC_MINUS"] = OIS::KC_MINUS;
    keysByNameMap["KC_EQUALS"] = OIS::KC_EQUALS;
    keysByNameMap["KC_BACK"] = OIS::KC_BACK;
    keysByNameMap["KC_TAB"] = OIS::KC_TAB;
    keysByNameMap["KC_Q"] = OIS::KC_Q;
    keysByNameMap["KC_W"] = OIS::KC_W;
    keysByNameMap["KC_E"] = OIS::KC_E;
    keysByNameMap["KC_R"] = OIS::KC_R;
    keysByNameMap["KC_T"] = OIS::KC_T;
    keysByNameMap["KC_Y"] = OIS::KC_Y;
    keysByNameMap["KC_U"] = OIS::KC_U;
    keysByNameMap["KC_I"] = OIS::KC_I;
    keysByNameMap["KC_O"] = OIS::KC_O;
    keysByNameMap["KC_P"] = OIS::KC_P;
    keysByNameMap["KC_LBRACKET"] = OIS::KC_LBRACKET;
    keysByNameMap["KC_RBRACKET"] = OIS::KC_RBRACKET;
    keysByNameMap["KC_RETURN"] = OIS::KC_RETURN;
    keysByNameMap["KC_LCONTROL"] = OIS::KC_LCONTROL;
    keysByNameMap["KC_A"] = OIS::KC_A;
    keysByNameMap["KC_S"] = OIS::KC_S;
    keysByNameMap["KC_D"] = OIS::KC_D;
    keysByNameMap["KC_F"] = OIS::KC_F;
    keysByNameMap["KC_G"] = OIS::KC_G;
    keysByNameMap["KC_H"] = OIS::KC_H;
    keysByNameMap["KC_J"] = OIS::KC_J;
    keysByNameMap["KC_K"] = OIS::KC_K;
    keysByNameMap["KC_L"] = OIS::KC_L;
    keysByNameMap["KC_SEMICOLON"] = OIS::KC_SEMICOLON;
    keysByNameMap["KC_APOSTROPHE"] = OIS::KC_APOSTROPHE;
    keysByNameMap["KC_GRAVE"] = OIS::KC_GRAVE;
    keysByNameMap["KC_~"] = OIS::KC_GRAVE;
    keysByNameMap["KC_LSHIFT"] = OIS::KC_LSHIFT;
    keysByNameMap["KC_BACKSLASH"] = OIS::KC_BACKSLASH;
    keysByNameMap["KC_Z"] = OIS::KC_Z;
    keysByNameMap["KC_X"] = OIS::KC_X;
    keysByNameMap["KC_C"] = OIS::KC_C;
    keysByNameMap["KC_V"] = OIS::KC_V;
    keysByNameMap["KC_B"] = OIS::KC_B;
    keysByNameMap["KC_N"] = OIS::KC_N;
    keysByNameMap["KC_M"] = OIS::KC_M;
    keysByNameMap["KC_COMMA"] = OIS::KC_COMMA;
    keysByNameMap["KC_PERIOD"] = OIS::KC_PERIOD;
    keysByNameMap["KC_SLASH"] = OIS::KC_SLASH;
    keysByNameMap["KC_RSHIFT"] = OIS::KC_RSHIFT;
    keysByNameMap["KC_MULTIPLY"] = OIS::KC_MULTIPLY;
    keysByNameMap["KC_LMENU"] = OIS::KC_LMENU;
    keysByNameMap["KC_SPACE"] = OIS::KC_SPACE;
    keysByNameMap["KC_CAPITAL"] = OIS::KC_CAPITAL;
    keysByNameMap["KC_F1"] = OIS::KC_F1;
    keysByNameMap["KC_F2"] = OIS::KC_F2;
    keysByNameMap["KC_F3"] = OIS::KC_F3;
    keysByNameMap["KC_F4"] = OIS::KC_F4;
    keysByNameMap["KC_F5"] = OIS::KC_F5;
    keysByNameMap["KC_F6"] = OIS::KC_F6;
    keysByNameMap["KC_F7"] = OIS::KC_F7;
    keysByNameMap["KC_F8"] = OIS::KC_F8;
    keysByNameMap["KC_F9"] = OIS::KC_F9;
    keysByNameMap["KC_F10"] = OIS::KC_F10;
    keysByNameMap["KC_NUMLOCK"] = OIS::KC_NUMLOCK;
    keysByNameMap["KC_SCROLL"] = OIS::KC_SCROLL;
    keysByNameMap["KC_NUMPAD7"] = OIS::KC_NUMPAD7;
    keysByNameMap["KC_NUMPAD8"] = OIS::KC_NUMPAD8;
    keysByNameMap["KC_NUMPAD9"] = OIS::KC_NUMPAD9;
    keysByNameMap["KC_SUBTRACT"] = OIS::KC_SUBTRACT;
    keysByNameMap["KC_NUMPAD4"] = OIS::KC_NUMPAD4;
    keysByNameMap["KC_NUMPAD5"] = OIS::KC_NUMPAD5;
    keysByNameMap["KC_NUMPAD6"] = OIS::KC_NUMPAD6;
    keysByNameMap["KC_ADD"] = OIS::KC_ADD;
    keysByNameMap["KC_NUMPAD1"] = OIS::KC_NUMPAD1;
    keysByNameMap["KC_NUMPAD2"] = OIS::KC_NUMPAD2;
    keysByNameMap["KC_NUMPAD3"] = OIS::KC_NUMPAD3;
    keysByNameMap["KC_NUMPAD0"] = OIS::KC_NUMPAD0;
    keysByNameMap["KC_DECIMAL"] = OIS::KC_DECIMAL;
    keysByNameMap["KC_OEM_102"] = OIS::KC_OEM_102;
    keysByNameMap["KC_F11"] = OIS::KC_F11;
    keysByNameMap["KC_F12"] = OIS::KC_F12;
    keysByNameMap["KC_F13"] = OIS::KC_F13;
    keysByNameMap["KC_F14"] = OIS::KC_F14;
    keysByNameMap["KC_F15"] = OIS::KC_F15;
    keysByNameMap["KC_KANA"] = OIS::KC_KANA;
    keysByNameMap["KC_ABNT_C1"] = OIS::KC_ABNT_C1;
    keysByNameMap["KC_CONVERT"] = OIS::KC_CONVERT;
    keysByNameMap["KC_NOCONVERT"] = OIS::KC_NOCONVERT;
    keysByNameMap["KC_YEN"] = OIS::KC_YEN;
    keysByNameMap["KC_ABNT_C2"] = OIS::KC_ABNT_C2;
    keysByNameMap["KC_NUMPADEQUALS"] = OIS::KC_NUMPADEQUALS;
    keysByNameMap["KC_PREVTRACK"] = OIS::KC_PREVTRACK;
    keysByNameMap["KC_AT"] = OIS::KC_AT;
    keysByNameMap["KC_COLON"] = OIS::KC_COLON;
    keysByNameMap["KC_UNDERLINE"] = OIS::KC_UNDERLINE;
    keysByNameMap["KC_KANJI"] = OIS::KC_KANJI;
    keysByNameMap["KC_STOP"] = OIS::KC_STOP;
    keysByNameMap["KC_AX"] = OIS::KC_AX;
    keysByNameMap["KC_UNLABELED"] = OIS::KC_UNLABELED;
    keysByNameMap["KC_NEXTTRACK"] = OIS::KC_NEXTTRACK;
    keysByNameMap["KC_NUMPADENTER"] = OIS::KC_NUMPADENTER;
    keysByNameMap["KC_RCONTROL"] = OIS::KC_RCONTROL;
    keysByNameMap["KC_MUTE"] = OIS::KC_MUTE;
    keysByNameMap["KC_CALCULATOR"] = OIS::KC_CALCULATOR;
    keysByNameMap["KC_PLAYPAUSE"] = OIS::KC_PLAYPAUSE;
    keysByNameMap["KC_MEDIASTOP"] = OIS::KC_MEDIASTOP;
    keysByNameMap["KC_VOLUMEDOWN"] = OIS::KC_VOLUMEDOWN;
    keysByNameMap["KC_VOLUMEUP"] = OIS::KC_VOLUMEUP;
    keysByNameMap["KC_WEBHOME"] = OIS::KC_WEBHOME;
    keysByNameMap["KC_NUMPADCOMMA"] = OIS::KC_NUMPADCOMMA;
    keysByNameMap["KC_DIVIDE"] = OIS::KC_DIVIDE;
    keysByNameMap["KC_SYSRQ"] = OIS::KC_SYSRQ;
    keysByNameMap["KC_RMENU"] = OIS::KC_RMENU;
    keysByNameMap["KC_PAUSE"] = OIS::KC_PAUSE;
    keysByNameMap["KC_HOME"] = OIS::KC_HOME;
    keysByNameMap["KC_UP"] = OIS::KC_UP;
    keysByNameMap["KC_PGUP"] = OIS::KC_PGUP;
    keysByNameMap["KC_LEFT"] = OIS::KC_LEFT;
    keysByNameMap["KC_RIGHT"] = OIS::KC_RIGHT;
    keysByNameMap["KC_END"] = OIS::KC_END;
    keysByNameMap["KC_DOWN"] = OIS::KC_DOWN;
    keysByNameMap["KC_PGDOWN"] = OIS::KC_PGDOWN;
    keysByNameMap["KC_INSERT"] = OIS::KC_INSERT;
    keysByNameMap["KC_DELETE"] = OIS::KC_DELETE;
    keysByNameMap["KC_LWIN"] = OIS::KC_LWIN;
    keysByNameMap["KC_RWIN"] = OIS::KC_RWIN;
    keysByNameMap["KC_APPS"] = OIS::KC_APPS;
    keysByNameMap["KC_POWER"] = OIS::KC_POWER;
    keysByNameMap["KC_SLEEP"] = OIS::KC_SLEEP;
    keysByNameMap["KC_WAKE"] = OIS::KC_WAKE;
    keysByNameMap["KC_WEBSEARCH"] = OIS::KC_WEBSEARCH;
    keysByNameMap["KC_WEBFAVORITES"] = OIS::KC_WEBFAVORITES;
    keysByNameMap["KC_WEBREFRESH"] = OIS::KC_WEBREFRESH;
    keysByNameMap["KC_WEBSTOP"] = OIS::KC_WEBSTOP;
    keysByNameMap["KC_WEBFORWARD"] = OIS::KC_WEBFORWARD;
    keysByNameMap["KC_WEBBACK"] = OIS::KC_WEBBACK;
    keysByNameMap["KC_MYCOMPUTER"] = OIS::KC_MYCOMPUTER;
    keysByNameMap["KC_MAIL"] = OIS::KC_MAIL;
    keysByNameMap["KC_MEDIASELECT"] = OIS::KC_MEDIASELECT;

    return keysByNameMap;
}

};  // namespace Input
};  // namespace Divide

Commits for Divide-Framework/trunk/Source Code/Platform/Input/InputInterface.cpp

Diff revisions: vs.
Revision Author Commited Message
969 Diff Diff IonutCava picture IonutCava Mon 13 Nov, 2017 00:15:57 +0000

[Ionut]
- Further improve DisplayWindow <-> Input relationship
- Add Flip-Y 2D camera (D3D style projection)
- Fix IMGUI rendering
- Add IMGUI sample and IMWINDOW sample rendering at the same time
- Improve IMWINDOW multi-window support
— Bug: nothing rendering in child platform windows
- Add draw command to move render context from one window to another

968 Diff Diff IonutCava picture IonutCava Tue 07 Nov, 2017 17:32:31 +0000

[Ionut]
- Consistent naming between timing variables

962 Diff Diff IonutCava picture IonutCava Fri 03 Nov, 2017 17:17:55 +0000

[Ionut]
- Fix creation/destruction of multiple DisplayWindows
- Add an InputInterface per DisplayWindow
- More work on the ImWindow based Editor

955 Diff Diff IonutCava picture IonutCava Sun 29 Oct, 2017 20:45:04 +0000

[Ionut]
- Modify the CEGUI opengl renderer to interact with the state in GLWrapper better
- Performance optimizations

952 Diff Diff IonutCava picture IonutCava Wed 25 Oct, 2017 00:35:37 +0000

[Ionut]
- Added the CEGUI rendering project to our solution for easier modification, debugging and integration
- Updated to OIS 1.4
- Some updates to the WindowHandle struct

  • Only compiled in Debug*
951 Diff Diff IonutCava picture IonutCava Mon 23 Oct, 2017 23:25:49 +0000

[Ionut]
- Added a new project to the solution: Divide-Editor
— This project will be a Unity-style tool for the framework built using IMGUI and ImWindow
— Examples:

- Modified DisplayWindow class heavily to support new requirements

902 Diff Diff IonutCava picture IonutCava Sun 25 Jun, 2017 16:56:57 +0000

[Ionut]
- Rework input system a bit for easier maintenance and readability
- Toggle AntTweakBar display using CTRL+F11

890 Diff Diff IonutCava picture IonutCava Sun 14 May, 2017 20:54:59 +0000

[Ionut]
- Add pre-compiled header support
- Initial code for per-stage tessellation computation

872 Diff Diff IonutCava picture IonutCava Mon 06 Mar, 2017 23:23:20 +0000

[IonutCava]
- Optimise static casts

867 IonutCava picture IonutCava Mon 20 Feb, 2017 17:01:12 +0000

[IonutCava]
- Rename to_XNN and to_const_XNN functions to reflect the target data type they are converting to.
- Cleanup Angle namespace and remove all “inDegrees” parameters from rotation functions. Use aliases to differentiate between Degree and Radian parameters.
- Profile guided optimizations.