|
|
|
@ -41,8 +41,6 @@ namespace ICS
|
|
|
|
|
|
|
|
|
|
this->mActive = active;
|
|
|
|
|
|
|
|
|
|
this->fillSDLKeysMap();
|
|
|
|
|
|
|
|
|
|
ICS_LOG("Channel count = " + ToString<size_t>(channelCount) );
|
|
|
|
|
for(size_t i=0;i<channelCount;i++)
|
|
|
|
|
{
|
|
|
|
@ -310,9 +308,6 @@ namespace ICS
|
|
|
|
|
mControlsMouseButtonBinderMap.clear();
|
|
|
|
|
mControlsJoystickButtonBinderMap.clear();
|
|
|
|
|
|
|
|
|
|
mKeys.clear();
|
|
|
|
|
mKeyCodes.clear();
|
|
|
|
|
|
|
|
|
|
ICS_LOG(" - InputControlSystem deleted - ");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -433,7 +428,7 @@ namespace ICS
|
|
|
|
|
{
|
|
|
|
|
TiXmlElement keyBinder( "KeyBinder" );
|
|
|
|
|
|
|
|
|
|
keyBinder.SetAttribute( "key", keyCodeToString(
|
|
|
|
|
keyBinder.SetAttribute( "key", ToString<int>(
|
|
|
|
|
getKeyBinding(*o, Control/*::ControlChangingDirection*/::INCREASE)).c_str() );
|
|
|
|
|
keyBinder.SetAttribute( "direction", "INCREASE" );
|
|
|
|
|
control.InsertEndChild(keyBinder);
|
|
|
|
@ -443,7 +438,7 @@ namespace ICS
|
|
|
|
|
{
|
|
|
|
|
TiXmlElement keyBinder( "KeyBinder" );
|
|
|
|
|
|
|
|
|
|
keyBinder.SetAttribute( "key", keyCodeToString(
|
|
|
|
|
keyBinder.SetAttribute( "key", ToString<int>(
|
|
|
|
|
getKeyBinding(*o, Control/*::ControlChangingDirection*/::DECREASE)).c_str() );
|
|
|
|
|
keyBinder.SetAttribute( "direction", "DECREASE" );
|
|
|
|
|
control.InsertEndChild(keyBinder);
|
|
|
|
@ -806,128 +801,14 @@ namespace ICS
|
|
|
|
|
mDetectingBindingControl = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InputControlSystem::fillSDLKeysMap()
|
|
|
|
|
{
|
|
|
|
|
mKeys["UNASSIGNED"]= SDLK_UNKNOWN;
|
|
|
|
|
mKeys["ESCAPE"]= SDLK_ESCAPE;
|
|
|
|
|
mKeys["1"]= SDLK_1;
|
|
|
|
|
mKeys["2"]= SDLK_2;
|
|
|
|
|
mKeys["3"]= SDLK_3;
|
|
|
|
|
mKeys["4"]= SDLK_4;
|
|
|
|
|
mKeys["5"]= SDLK_5;
|
|
|
|
|
mKeys["6"]= SDLK_6;
|
|
|
|
|
mKeys["7"]= SDLK_7;
|
|
|
|
|
mKeys["8"]= SDLK_8;
|
|
|
|
|
mKeys["9"]= SDLK_9;
|
|
|
|
|
mKeys["0"]= SDLK_0;
|
|
|
|
|
mKeys["MINUS"]= SDLK_MINUS;
|
|
|
|
|
mKeys["EQUALS"]= SDLK_EQUALS;
|
|
|
|
|
mKeys["BACK"]= SDLK_BACKSPACE;
|
|
|
|
|
mKeys["TAB"]= SDLK_TAB;
|
|
|
|
|
mKeys["Q"]= SDLK_q;
|
|
|
|
|
mKeys["W"]= SDLK_w;
|
|
|
|
|
mKeys["E"]= SDLK_e;
|
|
|
|
|
mKeys["R"]= SDLK_r;
|
|
|
|
|
mKeys["T"]= SDLK_t;
|
|
|
|
|
mKeys["Y"]= SDLK_y;
|
|
|
|
|
mKeys["U"]= SDLK_u;
|
|
|
|
|
mKeys["I"]= SDLK_i;
|
|
|
|
|
mKeys["O"]= SDLK_o;
|
|
|
|
|
mKeys["P"]= SDLK_p;
|
|
|
|
|
mKeys["LBRACKET"]= SDLK_LEFTBRACKET;
|
|
|
|
|
mKeys["RBRACKET"]= SDLK_RIGHTBRACKET;
|
|
|
|
|
mKeys["RETURN"]= SDLK_RETURN;
|
|
|
|
|
mKeys["LCONTROL"]= SDLK_LCTRL;
|
|
|
|
|
mKeys["A"]= SDLK_a;
|
|
|
|
|
mKeys["S"]= SDLK_s;
|
|
|
|
|
mKeys["D"]= SDLK_d;
|
|
|
|
|
mKeys["F"]= SDLK_f;
|
|
|
|
|
mKeys["G"]= SDLK_g;
|
|
|
|
|
mKeys["H"]= SDLK_h;
|
|
|
|
|
mKeys["J"]= SDLK_j;
|
|
|
|
|
mKeys["K"]= SDLK_k;
|
|
|
|
|
mKeys["L"]= SDLK_l;
|
|
|
|
|
mKeys["SEMICOLON"]= SDLK_SEMICOLON;
|
|
|
|
|
mKeys["APOSTROPHE"]= SDLK_QUOTE;
|
|
|
|
|
mKeys["GRAVE"]= SDLK_BACKQUOTE;
|
|
|
|
|
mKeys["LSHIFT"]= SDLK_LSHIFT;
|
|
|
|
|
mKeys["BACKSLASH"]= SDLK_BACKSLASH;
|
|
|
|
|
mKeys["Z"]= SDLK_z;
|
|
|
|
|
mKeys["X"]= SDLK_x;
|
|
|
|
|
mKeys["C"]= SDLK_c;
|
|
|
|
|
mKeys["V"]= SDLK_v;
|
|
|
|
|
mKeys["B"]= SDLK_b;
|
|
|
|
|
mKeys["N"]= SDLK_n;
|
|
|
|
|
mKeys["M"]= SDLK_m;
|
|
|
|
|
mKeys["COMMA"]= SDLK_COMMA;
|
|
|
|
|
mKeys["PERIOD"]= SDLK_PERIOD;
|
|
|
|
|
mKeys["SLASH"]= SDLK_SLASH;
|
|
|
|
|
mKeys["RSHIFT"]= SDLK_RSHIFT;
|
|
|
|
|
mKeys["MULTIPLY"]= SDLK_ASTERISK;
|
|
|
|
|
mKeys["LMENU"]= SDLK_LALT;
|
|
|
|
|
mKeys["SPACE"]= SDLK_SPACE;
|
|
|
|
|
mKeys["CAPITAL"]= SDLK_CAPSLOCK;
|
|
|
|
|
mKeys["F1"]= SDLK_F1;
|
|
|
|
|
mKeys["F2"]= SDLK_F2;
|
|
|
|
|
mKeys["F3"]= SDLK_F3;
|
|
|
|
|
mKeys["F4"]= SDLK_F4;
|
|
|
|
|
mKeys["F5"]= SDLK_F5;
|
|
|
|
|
mKeys["F6"]= SDLK_F6;
|
|
|
|
|
mKeys["F7"]= SDLK_F7;
|
|
|
|
|
mKeys["F8"]= SDLK_F8;
|
|
|
|
|
mKeys["F9"]= SDLK_F9;
|
|
|
|
|
mKeys["F10"]= SDLK_F10;
|
|
|
|
|
mKeys["F11"]= SDLK_F11;
|
|
|
|
|
mKeys["F12"]= SDLK_F12;
|
|
|
|
|
mKeys["NUMLOCK"]= SDLK_NUMLOCKCLEAR;
|
|
|
|
|
mKeys["SCROLL"]= SDLK_SCROLLLOCK;
|
|
|
|
|
mKeys["NUMPAD7"]= SDLK_KP_7;
|
|
|
|
|
mKeys["NUMPAD8"]= SDLK_KP_8;
|
|
|
|
|
mKeys["NUMPAD9"]= SDLK_KP_9;
|
|
|
|
|
mKeys["SUBTRACT"]= SDLK_KP_MINUS;
|
|
|
|
|
mKeys["NUMPAD4"]= SDLK_KP_4;
|
|
|
|
|
mKeys["NUMPAD5"]= SDLK_KP_5;
|
|
|
|
|
mKeys["NUMPAD6"]= SDLK_KP_6;
|
|
|
|
|
mKeys["ADD"]= SDLK_KP_PLUS;
|
|
|
|
|
mKeys["NUMPAD1"]= SDLK_KP_1;
|
|
|
|
|
mKeys["NUMPAD2"]= SDLK_KP_2;
|
|
|
|
|
mKeys["NUMPAD3"]= SDLK_KP_3;
|
|
|
|
|
mKeys["NUMPAD0"]= SDLK_KP_0;
|
|
|
|
|
mKeys["DECIMAL"]= SDLK_KP_DECIMAL;
|
|
|
|
|
mKeys["RCONTROL"]= SDLK_RCTRL;
|
|
|
|
|
mKeys["DIVIDE"]= SDLK_SLASH;
|
|
|
|
|
mKeys["SYSRQ"]= SDLK_SYSREQ;
|
|
|
|
|
mKeys["PRNTSCRN"] = SDLK_PRINTSCREEN;
|
|
|
|
|
mKeys["RMENU"]= SDLK_RALT;
|
|
|
|
|
mKeys["PAUSE"]= SDLK_PAUSE;
|
|
|
|
|
mKeys["HOME"]= SDLK_HOME;
|
|
|
|
|
mKeys["UP"]= SDLK_UP;
|
|
|
|
|
mKeys["PGUP"]= SDLK_PAGEUP;
|
|
|
|
|
mKeys["LEFT"]= SDLK_LEFT;
|
|
|
|
|
mKeys["RIGHT"]= SDLK_RIGHT;
|
|
|
|
|
mKeys["END"]= SDLK_END;
|
|
|
|
|
mKeys["DOWN"]= SDLK_DOWN;
|
|
|
|
|
mKeys["PGDOWN"]= SDLK_PAGEDOWN;
|
|
|
|
|
mKeys["INSERT"]= SDLK_INSERT;
|
|
|
|
|
mKeys["DELETE"]= SDLK_DELETE;
|
|
|
|
|
|
|
|
|
|
mKeys["NUMPADENTER"]= SDLK_KP_ENTER;
|
|
|
|
|
|
|
|
|
|
for(std::map<std::string, SDL_Keycode>::iterator it = mKeys.begin()
|
|
|
|
|
; it != mKeys.end() ; it++)
|
|
|
|
|
{
|
|
|
|
|
mKeyCodes[ it->second ] = it->first;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string InputControlSystem::keyCodeToString(SDL_Keycode key)
|
|
|
|
|
{
|
|
|
|
|
return mKeyCodes[key];
|
|
|
|
|
return std::string(SDL_GetKeyName(key));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SDL_Keycode InputControlSystem::stringToKeyCode(std::string key)
|
|
|
|
|
{
|
|
|
|
|
return mKeys[key];
|
|
|
|
|
return SDL_GetKeyFromName(key.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void InputControlSystem::adjustMouseRegion(Uint16 width, Uint16 height)
|
|
|
|
|