Update of /cvsroot/simspark/simspark/spark/kerosin/inputserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30903/kerosin/inputserver Modified Files: inputcontrol.cpp inputitem.h inputserver.cpp inputserver.h inputsystem.cpp inputsystem.h scancodemap.cpp scancodemap.h Log Message: - input struct changes - minor cleanups Index: inputcontrol.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputcontrol.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inputcontrol.cpp 5 Dec 2005 21:38:22 -0000 1.1 --- inputcontrol.cpp 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 159,167 **** // Process incoming input mDeltaTime = 0.0f; ! static InputServer::Input input; while (mInputServer->GetInput(input)) { ! switch (input.id) { case CmdQuit: --- 159,167 ---- // Process incoming input mDeltaTime = 0.0f; ! static Input input; while (mInputServer->GetInput(input)) { ! switch (input.mId) { case CmdQuit: *************** *** 170,178 **** case CmdMouseLook: ! mMouseLook = (input.data.l == 1); break; case CmdTimer: ! mDeltaTime = (float) input.data.l/1000.0f; break; --- 170,178 ---- case CmdMouseLook: ! mMouseLook = (input.mData.l == 1); break; case CmdTimer: ! mDeltaTime = (float) input.mData.l/1000.0f; break; *************** *** 183,187 **** ) { ! mFPSController->AdjustHAngle(mHorSens*(float)input.data.l); } break; --- 183,187 ---- ) { ! mFPSController->AdjustHAngle(mHorSens*(float)input.mData.l); } break; *************** *** 193,197 **** ) { ! mFPSController->AdjustVAngle(mVertSens*(float)input.data.l); } break; --- 193,197 ---- ) { ! mFPSController->AdjustVAngle(mVertSens*(float)input.mData.l); } break; *************** *** 200,204 **** if (mFPSController.get() != 0) { ! mFPSController->Up(input.data.l!=0); } break; --- 200,204 ---- if (mFPSController.get() != 0) { ! mFPSController->Up(input.mData.l!=0); } break; *************** *** 207,211 **** if (mFPSController.get() != 0) { ! mFPSController->Down(input.data.l!=0); } break; --- 207,211 ---- if (mFPSController.get() != 0) { ! mFPSController->Down(input.mData.l!=0); } break; *************** *** 214,218 **** if (mFPSController.get() != 0) { ! mFPSController->StrafeLeft(input.data.l!=0); } break; --- 214,218 ---- if (mFPSController.get() != 0) { ! mFPSController->StrafeLeft(input.mData.l!=0); } break; *************** *** 221,225 **** if (mFPSController.get() != 0) { ! mFPSController->StrafeRight(input.data.l!=0); } break; --- 221,225 ---- if (mFPSController.get() != 0) { ! mFPSController->StrafeRight(input.mData.l!=0); } break; *************** *** 228,232 **** if (mFPSController.get() != 0) { ! mFPSController->Forward(input.data.l!=0); } break; --- 228,232 ---- if (mFPSController.get() != 0) { ! mFPSController->Forward(input.mData.l!=0); } break; *************** *** 235,239 **** if (mFPSController.get() != 0) { ! mFPSController->Backward(input.data.l!=0); } break; --- 235,239 ---- if (mFPSController.get() != 0) { ! mFPSController->Backward(input.mData.l!=0); } break; *************** *** 286,292 **** if (inputItem.get() != 0) ! { ! return true; ! } // create the input item --- 286,292 ---- if (inputItem.get() != 0) ! { ! return true; ! } // create the input item *************** *** 294,302 **** if (inputItem.get() == 0) ! { ! GetLog()->Error() << "ERROR: (InputControl) Cannot create input item '" ! << inputItemName << "'" << std::endl; ! return false; ! } // link the input item in the hierarchy --- 294,302 ---- if (inputItem.get() == 0) ! { ! GetLog()->Error() << "ERROR: (InputControl) Cannot create input item '" ! << inputItemName << "'" << std::endl; ! return false; ! } // link the input item in the hierarchy Index: inputitem.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputitem.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inputitem.h 5 Dec 2005 21:38:22 -0000 1.1 --- inputitem.h 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 41,45 **** parent InputControl node is received */ ! virtual void ProcessInput(const InputServer::Input& input) = 0; }; --- 41,45 ---- parent InputControl node is received */ ! virtual void ProcessInput(const Input& input) = 0; }; Index: inputsystem.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputsystem.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inputsystem.h 5 Dec 2005 21:38:22 -0000 1.1 --- inputsystem.h 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 67,84 **** AddInputInternal(). */ ! virtual void AddInput(InputServer::Input& input); /** this is the actual addition of input to the queue. It should only be used by InputDevices! */ ! void AddInputInternal(InputServer::Input& input); //! retrieve an input from the queue ! virtual bool GetInput(InputServer::Input& input); InputServer* GetInputServer() { return mInputServer; } protected: ! virtual bool UpdateTimerInput(InputServer::Input &input); // --- 67,84 ---- AddInputInternal(). */ ! virtual void AddInput(Input& input); /** this is the actual addition of input to the queue. It should only be used by InputDevices! */ ! void AddInputInternal(Input& input); //! retrieve an input from the queue ! virtual bool GetInput(Input& input); InputServer* GetInputServer() { return mInputServer; } protected: ! virtual bool UpdateTimerInput(Input &input); // *************** *** 89,93 **** private: ! std::deque<InputServer::Input> mInputQueue; }; --- 89,93 ---- private: ! std::deque<Input> mInputQueue; }; Index: inputsystem.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputsystem.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inputsystem.cpp 5 Dec 2005 21:38:22 -0000 1.1 --- inputsystem.cpp 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 42,46 **** void ! InputSystem::AddInput(InputServer::Input& input) { AddInputInternal(input); --- 42,46 ---- void ! InputSystem::AddInput(Input& input) { AddInputInternal(input); *************** *** 48,52 **** bool ! InputSystem::GetInput(InputServer::Input& input) { static bool hasDoneTimer = false; --- 48,52 ---- bool ! InputSystem::GetInput(Input& input) { static bool hasDoneTimer = false; *************** *** 71,75 **** void ! InputSystem::AddInputInternal(InputServer::Input& input) { mInputQueue.push_back(input); --- 71,75 ---- void ! InputSystem::AddInputInternal(Input& input) { mInputQueue.push_back(input); *************** *** 77,81 **** bool ! InputSystem::UpdateTimerInput(InputServer::Input &/*input*/) { return false; --- 77,81 ---- bool ! InputSystem::UpdateTimerInput(Input &/*input*/) { return false; Index: inputserver.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputserver.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inputserver.cpp 5 Dec 2005 21:38:22 -0000 1.1 --- inputserver.cpp 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 33,172 **** using namespace zeitgeist; - const InputServer::TInputCode InputServer::IC_1 = 0x02; - const InputServer::TInputCode InputServer::IC_2 = 0x03; - const InputServer::TInputCode InputServer::IC_3 = 0x04; - const InputServer::TInputCode InputServer::IC_4 = 0x05; - const InputServer::TInputCode InputServer::IC_5 = 0x06; - const InputServer::TInputCode InputServer::IC_6 = 0x07; - const InputServer::TInputCode InputServer::IC_7 = 0x08; - const InputServer::TInputCode InputServer::IC_8 = 0x09; - const InputServer::TInputCode InputServer::IC_9 = 0x0a; - const InputServer::TInputCode InputServer::IC_0 = 0x0b; - - // function keys - const InputServer::TInputCode InputServer::IC_F1 = 0x3b; - const InputServer::TInputCode InputServer::IC_F2 = 0x3c; - const InputServer::TInputCode InputServer::IC_F3 = 0x3d; - const InputServer::TInputCode InputServer::IC_F4 = 0x3e; - const InputServer::TInputCode InputServer::IC_F5 = 0x3f; - const InputServer::TInputCode InputServer::IC_F6 = 0x40; - const InputServer::TInputCode InputServer::IC_F7 = 0x41; - const InputServer::TInputCode InputServer::IC_F8 = 0x42; - const InputServer::TInputCode InputServer::IC_F9 = 0x43; - const InputServer::TInputCode InputServer::IC_F10 = 0x44; - const InputServer::TInputCode InputServer::IC_F11 = 0x57; - const InputServer::TInputCode InputServer::IC_F12 = 0x58; - - // alphabet - const InputServer::TInputCode InputServer::IC_A = 0x1e; - const InputServer::TInputCode InputServer::IC_B = 0x30; - const InputServer::TInputCode InputServer::IC_C = 0x2e; - const InputServer::TInputCode InputServer::IC_D = 0x20; - const InputServer::TInputCode InputServer::IC_E = 0x12; - const InputServer::TInputCode InputServer::IC_F = 0x21; - const InputServer::TInputCode InputServer::IC_G = 0x22; - const InputServer::TInputCode InputServer::IC_H = 0x23; - const InputServer::TInputCode InputServer::IC_I = 0x17; - const InputServer::TInputCode InputServer::IC_J = 0x24; - const InputServer::TInputCode InputServer::IC_K = 0x25; - const InputServer::TInputCode InputServer::IC_L = 0x26; - const InputServer::TInputCode InputServer::IC_M = 0x32; - const InputServer::TInputCode InputServer::IC_N = 0x31; - const InputServer::TInputCode InputServer::IC_O = 0x18; - const InputServer::TInputCode InputServer::IC_P = 0x19; - const InputServer::TInputCode InputServer::IC_Q = 0x10; - const InputServer::TInputCode InputServer::IC_R = 0x13; - const InputServer::TInputCode InputServer::IC_S = 0x1f; - const InputServer::TInputCode InputServer::IC_T = 0x14; - const InputServer::TInputCode InputServer::IC_U = 0x16; - const InputServer::TInputCode InputServer::IC_V = 0x2f; - const InputServer::TInputCode InputServer::IC_W = 0x11; - const InputServer::TInputCode InputServer::IC_X = 0x2d; - const InputServer::TInputCode InputServer::IC_Y = 0x15; - const InputServer::TInputCode InputServer::IC_Z = 0x2c; - - // keypad - const InputServer::TInputCode InputServer::IC_KP0 = 0x52; - const InputServer::TInputCode InputServer::IC_KP1 = 0x4f; - const InputServer::TInputCode InputServer::IC_KP2 = 0x50; - const InputServer::TInputCode InputServer::IC_KP3 = 0x51; - const InputServer::TInputCode InputServer::IC_KP4 = 0x4b; - const InputServer::TInputCode InputServer::IC_KP5 = 0x4c; - const InputServer::TInputCode InputServer::IC_KP6 = 0x4d; - const InputServer::TInputCode InputServer::IC_KP7 = 0x47; - const InputServer::TInputCode InputServer::IC_KP8 = 0x48; - const InputServer::TInputCode InputServer::IC_KP9 = 0x49; - const InputServer::TInputCode InputServer::IC_KP_DECIMAL = 0x53; - const InputServer::TInputCode InputServer::IC_KP_DIVIDE = 0xb5; - const InputServer::TInputCode InputServer::IC_KP_MULTIPLY = 0x37; - const InputServer::TInputCode InputServer::IC_KP_MINUS = 0x4a; - const InputServer::TInputCode InputServer::IC_KP_PLUS = 0x4e; - const InputServer::TInputCode InputServer::IC_KP_ENTER = 0x8d; - - // arrows + home/end pad - const InputServer::TInputCode InputServer::IC_UP = 0xc8; - const InputServer::TInputCode InputServer::IC_DOWN = 0xd0; - const InputServer::TInputCode InputServer::IC_LEFT = 0xcb; - const InputServer::TInputCode InputServer::IC_RIGHT = 0xcd; - const InputServer::TInputCode InputServer::IC_INSERT = 0xd2; - const InputServer::TInputCode InputServer::IC_DELETE = 0xd3; - const InputServer::TInputCode InputServer::IC_HOME = 0xc7; - const InputServer::TInputCode InputServer::IC_END = 0xcf; - const InputServer::TInputCode InputServer::IC_PAGEUP = 0xc9; - const InputServer::TInputCode InputServer::IC_PAGEDOWN = 0xd1; - - // key state modifier keys - const InputServer::TInputCode InputServer::IC_NUMLOCK = 0x45; - const InputServer::TInputCode InputServer::IC_CAPSLOCK = 0x3a; - const InputServer::TInputCode InputServer::IC_SCROLLOCK = 0x46; - const InputServer::TInputCode InputServer::IC_LSHIFT = 0x2a; - const InputServer::TInputCode InputServer::IC_RSHIFT = 0x36; - const InputServer::TInputCode InputServer::IC_LCTRL = 0x1d; - const InputServer::TInputCode InputServer::IC_RCTRL = 0x9d; - const InputServer::TInputCode InputServer::IC_LALT = 0x38; - const InputServer::TInputCode InputServer::IC_RALT = 0xb8; - const InputServer::TInputCode InputServer::IC_LSUPER = 0xdb; // Left "Windows" key - const InputServer::TInputCode InputServer::IC_RSUPER = 0xdc; // Right "Windows" key - - // other keys (cursor control, punctuation) - const InputServer::TInputCode InputServer::IC_ESCAPE = 0x01; - const InputServer::TInputCode InputServer::IC_PRINT = 0xb7; - const InputServer::TInputCode InputServer::IC_PAUSE = 0xc5; - const InputServer::TInputCode InputServer::IC_GRAVE = 0x29; - const InputServer::TInputCode InputServer::IC_MINUS = 0x0c; - const InputServer::TInputCode InputServer::IC_EQUALS = 0x0d; - const InputServer::TInputCode InputServer::IC_BACKSLASH = 0x2b; - const InputServer::TInputCode InputServer::IC_BACKSPACE = 0x0e; - - const InputServer::TInputCode InputServer::IC_TAB = 0x0f; - const InputServer::TInputCode InputServer::IC_LBRACKET = 0x1a; - const InputServer::TInputCode InputServer::IC_RBRACKET = 0x1b; - const InputServer::TInputCode InputServer::IC_RETURN = 0x1c; - - const InputServer::TInputCode InputServer::IC_SEMICOLON = 0x27; - const InputServer::TInputCode InputServer::IC_APOSTROPHE= 0x28; - - const InputServer::TInputCode InputServer::IC_OEM_102 = 0x56; // German <>| - const InputServer::TInputCode InputServer::IC_COMMA = 0x33; - const InputServer::TInputCode InputServer::IC_PERIOD = 0x34; - const InputServer::TInputCode InputServer::IC_SLASH = 0x35; - - const InputServer::TInputCode InputServer::IC_SPACE = 0x39; - - // mouse buttons - const InputServer::TInputCode InputServer::IC_MOUSE_LEFT = 0x1000; // left - const InputServer::TInputCode InputServer::IC_MOUSE_RIGHT = 0x1001; // right - const InputServer::TInputCode InputServer::IC_MOUSE_MIDDLE = 0x1002; // middle - - //mouse axis - const InputServer::TInputCode InputServer::IC_AXISX = 0x2000; - const InputServer::TInputCode InputServer::IC_AXISY = 0x2001; - const InputServer::TInputCode InputServer::IC_AXISZ = 0x2002; - - // timer - const InputServer::TInputCode InputServer::IC_AXIST = 0x3000; - InputServer::InputServer() : ! Node(), mModifierState(eNone), mScanCodeMap(new ScanCodeMap()) { // default to a german keyboard layout --- 33,38 ---- using namespace zeitgeist; InputServer::InputServer() : ! Node(), mModifierState(Input::Input::eNone), mScanCodeMap(new ScanCodeMap()) { // default to a german keyboard layout *************** *** 185,321 **** // push our variables into the scriptserver ! GetScript()->CreateVariable("Input.IC_1", IC_1); ! GetScript()->CreateVariable("Input.IC_2", IC_2); ! GetScript()->CreateVariable("Input.IC_3", IC_3); ! GetScript()->CreateVariable("Input.IC_4", IC_4); ! GetScript()->CreateVariable("Input.IC_5", IC_5); ! GetScript()->CreateVariable("Input.IC_6", IC_6); ! GetScript()->CreateVariable("Input.IC_7", IC_7); ! GetScript()->CreateVariable("Input.IC_8", IC_8); ! GetScript()->CreateVariable("Input.IC_9", IC_9); ! GetScript()->CreateVariable("Input.IC_0", IC_0); // function keys ! GetScript()->CreateVariable("Input.IC_F1", IC_F1); ! GetScript()->CreateVariable("Input.IC_F2", IC_F2); ! GetScript()->CreateVariable("Input.IC_F3", IC_F3); ! GetScript()->CreateVariable("Input.IC_F4", IC_F4); ! GetScript()->CreateVariable("Input.IC_F5", IC_F5); ! GetScript()->CreateVariable("Input.IC_F6", IC_F6); ! GetScript()->CreateVariable("Input.IC_F7", IC_F7); ! GetScript()->CreateVariable("Input.IC_F8", IC_F8); ! GetScript()->CreateVariable("Input.IC_F9", IC_F9); ! GetScript()->CreateVariable("Input.IC_F10", IC_F10); ! GetScript()->CreateVariable("Input.IC_F11", IC_F11); ! GetScript()->CreateVariable("Input.IC_F12", IC_F12); // alphabet ! GetScript()->CreateVariable("Input.IC_A", IC_A); ! GetScript()->CreateVariable("Input.IC_B", IC_B); ! GetScript()->CreateVariable("Input.IC_C", IC_C); ! GetScript()->CreateVariable("Input.IC_D", IC_D); ! GetScript()->CreateVariable("Input.IC_E", IC_E); ! GetScript()->CreateVariable("Input.IC_F", IC_F); ! GetScript()->CreateVariable("Input.IC_G", IC_G); ! GetScript()->CreateVariable("Input.IC_H", IC_H); ! GetScript()->CreateVariable("Input.IC_I", IC_I); ! GetScript()->CreateVariable("Input.IC_J", IC_J); ! GetScript()->CreateVariable("Input.IC_K", IC_K); ! GetScript()->CreateVariable("Input.IC_L", IC_L); ! GetScript()->CreateVariable("Input.IC_M", IC_M); ! GetScript()->CreateVariable("Input.IC_N", IC_N); ! GetScript()->CreateVariable("Input.IC_O", IC_O); ! GetScript()->CreateVariable("Input.IC_P", IC_P); ! GetScript()->CreateVariable("Input.IC_Q", IC_Q); ! GetScript()->CreateVariable("Input.IC_R", IC_R); ! GetScript()->CreateVariable("Input.IC_S", IC_S); ! GetScript()->CreateVariable("Input.IC_T", IC_T); ! GetScript()->CreateVariable("Input.IC_U", IC_U); ! GetScript()->CreateVariable("Input.IC_V", IC_V); ! GetScript()->CreateVariable("Input.IC_W", IC_W); ! GetScript()->CreateVariable("Input.IC_X", IC_X); ! GetScript()->CreateVariable("Input.IC_Y", IC_Y); ! GetScript()->CreateVariable("Input.IC_Z", IC_Z); // keypad ! GetScript()->CreateVariable("Input.IC_KP0", IC_KP0); ! GetScript()->CreateVariable("Input.IC_KP1", IC_KP1); ! GetScript()->CreateVariable("Input.IC_KP2", IC_KP2); ! GetScript()->CreateVariable("Input.IC_KP3", IC_KP3); ! GetScript()->CreateVariable("Input.IC_KP4", IC_KP4); ! GetScript()->CreateVariable("Input.IC_KP5", IC_KP5); ! GetScript()->CreateVariable("Input.IC_KP6", IC_KP6); ! GetScript()->CreateVariable("Input.IC_KP7", IC_KP7); ! GetScript()->CreateVariable("Input.IC_KP8", IC_KP8); ! GetScript()->CreateVariable("Input.IC_KP9", IC_KP9); ! GetScript()->CreateVariable("Input.IC_KP_DECIMAL", IC_KP_DECIMAL); ! GetScript()->CreateVariable("Input.IC_KP_DIVIDE", IC_KP_DIVIDE); ! GetScript()->CreateVariable("Input.IC_KP_MULTIPLY", IC_KP_MULTIPLY); ! GetScript()->CreateVariable("Input.IC_KP_MINUS", IC_KP_MINUS); ! GetScript()->CreateVariable("Input.IC_KP_PLUS", IC_KP_PLUS); ! GetScript()->CreateVariable("Input.IC_KP_ENTER", IC_KP_ENTER); // arrows + home/end pad ! GetScript()->CreateVariable("Input.IC_UP", IC_UP); ! GetScript()->CreateVariable("Input.IC_DOWN", IC_DOWN); ! GetScript()->CreateVariable("Input.IC_LEFT", IC_LEFT); ! GetScript()->CreateVariable("Input.IC_RIGHT", IC_RIGHT); ! GetScript()->CreateVariable("Input.IC_INSERT", IC_INSERT); ! GetScript()->CreateVariable("Input.IC_DELETE", IC_DELETE); ! GetScript()->CreateVariable("Input.IC_HOME", IC_HOME); ! GetScript()->CreateVariable("Input.IC_END", IC_END); ! GetScript()->CreateVariable("Input.IC_PAGEUP", IC_PAGEUP); ! GetScript()->CreateVariable("Input.IC_PAGEDOWN", IC_PAGEDOWN); // key state modifier keys ! GetScript()->CreateVariable("Input.IC_NUMLOCK", IC_NUMLOCK); ! GetScript()->CreateVariable("Input.IC_CAPSLOCK", IC_CAPSLOCK); ! GetScript()->CreateVariable("Input.IC_SCROLLOCK", IC_SCROLLOCK); ! GetScript()->CreateVariable("Input.IC_LSHIFT", IC_LSHIFT); ! GetScript()->CreateVariable("Input.IC_RSHIFT", IC_RSHIFT); ! GetScript()->CreateVariable("Input.IC_LCTRL", IC_LCTRL); ! GetScript()->CreateVariable("Input.IC_RCTRL", IC_RCTRL); ! GetScript()->CreateVariable("Input.IC_LALT", IC_LALT); ! GetScript()->CreateVariable("Input.IC_RALT", IC_RALT); ! GetScript()->CreateVariable("Input.IC_LSUPER", IC_LSUPER); // Left "Windows" key ! GetScript()->CreateVariable("Input.IC_RSUPER", IC_RSUPER); // Right "Windows" key // other keys (cursor control, punctuation) ! GetScript()->CreateVariable("Input.IC_ESCAPE", IC_ESCAPE); ! GetScript()->CreateVariable("Input.IC_PRINT", IC_PRINT); ! GetScript()->CreateVariable("Input.IC_PAUSE", IC_PAUSE); ! GetScript()->CreateVariable("Input.IC_GRAVE", IC_GRAVE); ! GetScript()->CreateVariable("Input.IC_MINUS", IC_MINUS); ! GetScript()->CreateVariable("Input.IC_EQUALS", IC_EQUALS); ! GetScript()->CreateVariable("Input.IC_BACKSLASH", IC_BACKSLASH); ! GetScript()->CreateVariable("Input.IC_BACKSPACE", IC_BACKSPACE); ! GetScript()->CreateVariable("Input.IC_TAB", IC_TAB); ! GetScript()->CreateVariable("Input.IC_LBRACKET", IC_LBRACKET); ! GetScript()->CreateVariable("Input.IC_RBRACKET", IC_RBRACKET); ! GetScript()->CreateVariable("Input.IC_RETURN", IC_RETURN); ! GetScript()->CreateVariable("Input.IC_SEMICOLON", IC_SEMICOLON); ! GetScript()->CreateVariable("Input.IC_APOSTROPHE", IC_APOSTROPHE); ! GetScript()->CreateVariable("Input.IC_OEM_102", IC_OEM_102); // German <>| ! GetScript()->CreateVariable("Input.IC_COMMA", IC_COMMA); ! GetScript()->CreateVariable("Input.IC_PERIOD", IC_PERIOD); ! GetScript()->CreateVariable("Input.IC_SLASH", IC_SLASH); ! GetScript()->CreateVariable("Input.IC_SPACE", IC_SPACE); // mouse buttons ! GetScript()->CreateVariable("Input.IC_MOUSE_LEFT", IC_MOUSE_LEFT);// left ! GetScript()->CreateVariable("Input.IC_MOUSE_RIGHT", IC_MOUSE_RIGHT);// right ! GetScript()->CreateVariable("Input.IC_MOUSE_MIDDLE", IC_MOUSE_MIDDLE); // middle //mouse axis ! GetScript()->CreateVariable("Input.IC_AXISX", IC_AXISX); ! GetScript()->CreateVariable("Input.IC_AXISY", IC_AXISY); ! GetScript()->CreateVariable("Input.IC_AXISZ", IC_AXISZ); // timer ! GetScript()->CreateVariable("Input.IC_AXIST", IC_AXIST); // create the inputsystem --- 51,187 ---- // push our variables into the scriptserver ! GetScript()->CreateVariable("Input.IC_1", Input::IC_1); ! GetScript()->CreateVariable("Input.IC_2", Input::IC_2); ! GetScript()->CreateVariable("Input.IC_3", Input::IC_3); ! GetScript()->CreateVariable("Input.IC_4", Input::IC_4); ! GetScript()->CreateVariable("Input.IC_5", Input::IC_5); ! GetScript()->CreateVariable("Input.IC_6", Input::IC_6); ! GetScript()->CreateVariable("Input.IC_7", Input::IC_7); ! GetScript()->CreateVariable("Input.IC_8", Input::IC_8); ! GetScript()->CreateVariable("Input.IC_9", Input::IC_9); ! GetScript()->CreateVariable("Input.IC_0", Input::IC_0); // function keys ! GetScript()->CreateVariable("Input.IC_F1", Input::IC_F1); ! GetScript()->CreateVariable("Input.IC_F2", Input::IC_F2); ! GetScript()->CreateVariable("Input.IC_F3", Input::IC_F3); ! GetScript()->CreateVariable("Input.IC_F4", Input::IC_F4); ! GetScript()->CreateVariable("Input.IC_F5", Input::IC_F5); ! GetScript()->CreateVariable("Input.IC_F6", Input::IC_F6); ! GetScript()->CreateVariable("Input.IC_F7", Input::IC_F7); ! GetScript()->CreateVariable("Input.IC_F8", Input::IC_F8); ! GetScript()->CreateVariable("Input.IC_F9", Input::IC_F9); ! GetScript()->CreateVariable("Input.IC_F10", Input::IC_F10); ! GetScript()->CreateVariable("Input.IC_F11", Input::IC_F11); ! GetScript()->CreateVariable("Input.IC_F12", Input::IC_F12); // alphabet ! GetScript()->CreateVariable("Input.IC_A", Input::IC_A); ! GetScript()->CreateVariable("Input.IC_B", Input::IC_B); ! GetScript()->CreateVariable("Input.IC_C", Input::IC_C); ! GetScript()->CreateVariable("Input.IC_D", Input::IC_D); ! GetScript()->CreateVariable("Input.IC_E", Input::IC_E); ! GetScript()->CreateVariable("Input.IC_F", Input::IC_F); ! GetScript()->CreateVariable("Input.IC_G", Input::IC_G); ! GetScript()->CreateVariable("Input.IC_H", Input::IC_H); ! GetScript()->CreateVariable("Input.IC_I", Input::IC_I); ! GetScript()->CreateVariable("Input.IC_J", Input::IC_J); ! GetScript()->CreateVariable("Input.IC_K", Input::IC_K); ! GetScript()->CreateVariable("Input.IC_L", Input::IC_L); ! GetScript()->CreateVariable("Input.IC_M", Input::IC_M); ! GetScript()->CreateVariable("Input.IC_N", Input::IC_N); ! GetScript()->CreateVariable("Input.IC_O", Input::IC_O); ! GetScript()->CreateVariable("Input.IC_P", Input::IC_P); ! GetScript()->CreateVariable("Input.IC_Q", Input::IC_Q); ! GetScript()->CreateVariable("Input.IC_R", Input::IC_R); ! GetScript()->CreateVariable("Input.IC_S", Input::IC_S); ! GetScript()->CreateVariable("Input.IC_T", Input::IC_T); ! GetScript()->CreateVariable("Input.IC_U", Input::IC_U); ! GetScript()->CreateVariable("Input.IC_V", Input::IC_V); ! GetScript()->CreateVariable("Input.IC_W", Input::IC_W); ! GetScript()->CreateVariable("Input.IC_X", Input::IC_X); ! GetScript()->CreateVariable("Input.IC_Y", Input::IC_Y); ! GetScript()->CreateVariable("Input.IC_Z", Input::IC_Z); // keypad ! GetScript()->CreateVariable("Input.IC_KP0", Input::IC_KP0); ! GetScript()->CreateVariable("Input.IC_KP1", Input::IC_KP1); ! GetScript()->CreateVariable("Input.IC_KP2", Input::IC_KP2); ! GetScript()->CreateVariable("Input.IC_KP3", Input::IC_KP3); ! GetScript()->CreateVariable("Input.IC_KP4", Input::IC_KP4); ! GetScript()->CreateVariable("Input.IC_KP5", Input::IC_KP5); ! GetScript()->CreateVariable("Input.IC_KP6", Input::IC_KP6); ! GetScript()->CreateVariable("Input.IC_KP7", Input::IC_KP7); ! GetScript()->CreateVariable("Input.IC_KP8", Input::IC_KP8); ! GetScript()->CreateVariable("Input.IC_KP9", Input::IC_KP9); ! GetScript()->CreateVariable("Input.IC_KP_DECIMAL", Input::IC_KP_DECIMAL); ! GetScript()->CreateVariable("Input.IC_KP_DIVIDE", Input::IC_KP_DIVIDE); ! GetScript()->CreateVariable("Input.IC_KP_MULTIPLY", Input::IC_KP_MULTIPLY); ! GetScript()->CreateVariable("Input.IC_KP_MINUS", Input::IC_KP_MINUS); ! GetScript()->CreateVariable("Input.IC_KP_PLUS", Input::IC_KP_PLUS); ! GetScript()->CreateVariable("Input.IC_KP_ENTER", Input::IC_KP_ENTER); // arrows + home/end pad ! GetScript()->CreateVariable("Input.IC_UP", Input::IC_UP); ! GetScript()->CreateVariable("Input.IC_DOWN", Input::IC_DOWN); ! GetScript()->CreateVariable("Input.IC_LEFT", Input::IC_LEFT); ! GetScript()->CreateVariable("Input.IC_RIGHT", Input::IC_RIGHT); ! GetScript()->CreateVariable("Input.IC_INSERT", Input::IC_INSERT); ! GetScript()->CreateVariable("Input.IC_DELETE", Input::IC_DELETE); ! GetScript()->CreateVariable("Input.IC_HOME", Input::IC_HOME); ! GetScript()->CreateVariable("Input.IC_END", Input::IC_END); ! GetScript()->CreateVariable("Input.IC_PAGEUP", Input::IC_PAGEUP); ! GetScript()->CreateVariable("Input.IC_PAGEDOWN", Input::IC_PAGEDOWN); // key state modifier keys ! GetScript()->CreateVariable("Input.IC_NUMLOCK", Input::IC_NUMLOCK); ! GetScript()->CreateVariable("Input.IC_CAPSLOCK", Input::IC_CAPSLOCK); ! GetScript()->CreateVariable("Input.IC_SCROLLOCK", Input::IC_SCROLLOCK); ! GetScript()->CreateVariable("Input.IC_LSHIFT", Input::IC_LSHIFT); ! GetScript()->CreateVariable("Input.IC_RSHIFT", Input::IC_RSHIFT); ! GetScript()->CreateVariable("Input.IC_LCTRL", Input::IC_LCTRL); ! GetScript()->CreateVariable("Input.IC_RCTRL", Input::IC_RCTRL); ! GetScript()->CreateVariable("Input.IC_LALT", Input::IC_LALT); ! GetScript()->CreateVariable("Input.IC_RALT", Input::IC_RALT); ! GetScript()->CreateVariable("Input.IC_LSUPER", Input::IC_LSUPER); // Left "Windows" key ! GetScript()->CreateVariable("Input.IC_RSUPER", Input::IC_RSUPER); // Right "Windows" key // other keys (cursor control, punctuation) ! GetScript()->CreateVariable("Input.IC_ESCAPE", Input::IC_ESCAPE); ! GetScript()->CreateVariable("Input.IC_PRINT", Input::IC_PRINT); ! GetScript()->CreateVariable("Input.IC_PAUSE", Input::IC_PAUSE); ! GetScript()->CreateVariable("Input.IC_GRAVE", Input::IC_GRAVE); ! GetScript()->CreateVariable("Input.IC_MINUS", Input::IC_MINUS); ! GetScript()->CreateVariable("Input.IC_EQUALS", Input::IC_EQUALS); ! GetScript()->CreateVariable("Input.IC_BACKSLASH", Input::IC_BACKSLASH); ! GetScript()->CreateVariable("Input.IC_BACKSPACE", Input::IC_BACKSPACE); ! GetScript()->CreateVariable("Input.IC_TAB", Input::IC_TAB); ! GetScript()->CreateVariable("Input.IC_LBRACKET", Input::IC_LBRACKET); ! GetScript()->CreateVariable("Input.IC_RBRACKET", Input::IC_RBRACKET); ! GetScript()->CreateVariable("Input.IC_RETURN", Input::IC_RETURN); ! GetScript()->CreateVariable("Input.IC_SEMICOLON", Input::IC_SEMICOLON); ! GetScript()->CreateVariable("Input.IC_APOSTROPHE", Input::IC_APOSTROPHE); ! GetScript()->CreateVariable("Input.IC_OEM_102", Input::IC_OEM_102); // German <>| ! GetScript()->CreateVariable("Input.IC_COMMA", Input::IC_COMMA); ! GetScript()->CreateVariable("Input.IC_PERIOD", Input::IC_PERIOD); ! GetScript()->CreateVariable("Input.IC_SLASH", Input::IC_SLASH); ! GetScript()->CreateVariable("Input.IC_SPACE", Input::IC_SPACE); // mouse buttons ! GetScript()->CreateVariable("Input.IC_MOUSE_LEFT", Input::IC_MOUSE_LEFT);// left ! GetScript()->CreateVariable("Input.IC_MOUSE_RIGHT", Input::IC_MOUSE_RIGHT);// right ! GetScript()->CreateVariable("Input.IC_MOUSE_MIDDLE", Input::IC_MOUSE_MIDDLE); // middle //mouse axis ! GetScript()->CreateVariable("Input.IC_AXISX", Input::IC_AXISX); ! GetScript()->CreateVariable("Input.IC_AXISY", Input::IC_AXISY); ! GetScript()->CreateVariable("Input.IC_AXISZ", Input::IC_AXISZ); // timer ! GetScript()->CreateVariable("Input.IC_AXIST", Input::IC_AXIST); // create the inputsystem *************** *** 405,409 **** GetLog()->Error() << "(InputServer) ERROR: no InputSystem installed\n"; ! input.id = -1; return false; } --- 271,275 ---- GetLog()->Error() << "(InputServer) ERROR: no InputSystem installed\n"; ! input.mId = -1; return false; } *************** *** 411,432 **** if (! inputSystem->GetInput(input)) { ! input.id = -1; return false; } if ( ! (input.type == eUser) || (raw) ) { ! // return eUser input return true; } // translate raw input to binding ! TBindMap::iterator bindListIter = mBindings.find(input.code); if (bindListIter == mBindings.end()) { ! input.id = -1; return false; } --- 277,298 ---- if (! inputSystem->GetInput(input)) { ! input.mId = -1; return false; } if ( ! (input.mType == Input::eUser) || (raw) ) { ! // return Input::eUser input return true; } // translate raw input to binding ! TBindMap::iterator bindListIter = mBindings.find(input.mCode); if (bindListIter == mBindings.end()) { ! input.mId = -1; return false; } *************** *** 443,462 **** const Bind& bind = (*bindIter); ! //printf("Looking at: %d %d %d", (*bind).code, (*bind).cmd, (*bind).modifier); if (bind.modifier == mModifierState) { ! if (input.type == eButton) { if ((bind.event == eKeyUpDown) || ! (bind.event == eKeyUp && input.data.l == 0) || ! (bind.event == eKeyDown && input.data.l == 1) ) { ! input.id = bind.cmd; return true; } ! } else if (input.type == eAxis) { ! input.id = bind.cmd; return true; } --- 309,328 ---- const Bind& bind = (*bindIter); ! //printf("Looking at: %d %d %d", (*bind).mCode, (*bind).cmd, (*bind).modifier); if (bind.modifier == mModifierState) { ! if (input.mType == Input::eButton) { if ((bind.event == eKeyUpDown) || ! (bind.event == eKeyUp && input.mData.l == 0) || ! (bind.event == eKeyDown && input.mData.l == 1) ) { ! input.mId = bind.cmd; return true; } ! } else if (input.mType == Input::eAxis) { ! input.mId = bind.cmd; return true; } *************** *** 465,469 **** ! input.id = -1; return false; } --- 331,335 ---- ! input.mId = -1; return false; } *************** *** 496,500 **** } ! void InputServer::AddCode(TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod) { --- 362,366 ---- } ! void InputServer::AddCode(Input::TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod) { *************** *** 525,529 **** // separated string is in tokens first we handle all the modifiers ! bind.modifier = eNone; while (tokens.size() > 1) --- 391,395 ---- // separated string is in tokens first we handle all the modifiers ! bind.modifier = Input::eNone; while (tokens.size() > 1) *************** *** 569,586 **** int InputServer::ParseModifier(const std::string &modifier) const { ! if (modifier == "lshift") return eLShift; ! if (modifier == "rshift") return eRShift; ! if (modifier == "shift") return eShift; ! if (modifier == "lctrl") return eLCtrl; ! if (modifier == "rctrl") return eRCtrl; ! if (modifier == "ctrl") return eCtrl; ! if (modifier == "lalt") return eLAlt; ! if (modifier == "ralt") return eRAlt; ! if (modifier == "alt") return eAlt; ! return eNone; } ! bool InputServer::TranslateCode(TInputCode code, unsigned long state, char &ch) const { --- 435,452 ---- int InputServer::ParseModifier(const std::string &modifier) const { ! if (modifier == "lshift") return Input::eLShift; ! if (modifier == "rshift") return Input::eRShift; ! if (modifier == "shift") return Input::eShift; ! if (modifier == "lctrl") return Input::eLCtrl; ! if (modifier == "rctrl") return Input::eRCtrl; ! if (modifier == "ctrl") return Input::eCtrl; ! if (modifier == "lalt") return Input::eLAlt; ! if (modifier == "ralt") return Input::eRAlt; ! if (modifier == "alt") return Input::eAlt; ! return Input::eNone; } ! bool InputServer::TranslateCode(Input::TInputCode code, unsigned long state, char &ch) const { *************** *** 593,600 **** Input input; ! input.type = eUser; ! input.code = -1; ! input.id = cmd; ! input.data.l = 0; shared_ptr<InputSystem> inputSystem = GetInputSystem(); --- 459,466 ---- Input input; ! input.mType = Input::eUser; ! input.mCode = -1; ! input.mId = cmd; ! input.mData.l = 0; shared_ptr<InputSystem> inputSystem = GetInputSystem(); *************** *** 608,609 **** --- 474,480 ---- inputSystem->AddInput(input); } + + unsigned int& InputServer::GetModifierState() + { + return mModifierState; + } Index: scancodemap.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/scancodemap.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scancodemap.cpp 5 Dec 2005 21:38:22 -0000 1.1 --- scancodemap.cpp 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 1,2 **** --- 1,23 ---- + /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- + + this file is part of rcssserver3D + Fri May 9 2003 + Copyright (C) 2002,2003 Koblenz University + Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group + $Id$ + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ #include "scancodemap.h" *************** *** 11,62 **** } ! kerosin::InputServer::TInputCode ScanCodeMap::GetCode(const std::string &name) const { ! // loop through all entries in the map and find the one, which matches the symbolic name ! for (TScanCodeEntryMap::const_iterator i = mScanCodes.begin(); i != mScanCodes.end(); ++i) ! { ! if ((*i).second->name == name) return (*i).first; ! } ! return 0; } ! bool ScanCodeMap::TranslateCode(kerosin::InputServer::TInputCode code, unsigned long state, char &ch) const { ! if ((state & InputServer::eShift) && (state & InputServer::eAlt)) return false; ! TScanCodeEntryMap::const_iterator entry = mScanCodes.find(code); ! if (entry != mScanCodes.end()) ! { ! if (state & InputServer::eShift) ! { ! ch = (*entry).second->shiftModifier; ! return ch != 0; ! } ! if (state & InputServer::eAlt) ! { ! ch = (*entry).second->altModifier; ! return ch != 0; ! } ! ch = (*entry).second->noModifier; ! return ch != 0; ! } ! return false; } void ScanCodeMap::Reset() { ! for (TScanCodeEntryMap::iterator i = mScanCodes.begin(); i != mScanCodes.end(); ++i) ! { ! delete (*i).second; ! } } ! void ScanCodeMap::AddCode(InputServer::TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod) { ! TScanCodeEntry *entry = new TScanCodeEntry(); ! entry->Set(name, noMod, shiftMod, altMod); ! mScanCodes[ic] = entry; } --- 32,98 ---- } ! Input::TInputCode ScanCodeMap::GetCode(const std::string &name) const { ! // loop through all entries in the map and find the one, which matches the symbolic name ! for (TScanCodeEntryMap::const_iterator i = mScanCodes.begin(); i != mScanCodes.end(); ++i) ! { ! if ((*i).second->name == name) return (*i).first; ! } ! return 0; } ! bool ScanCodeMap::TranslateCode(Input::TInputCode code, ! unsigned long state, char &ch) const { ! if ( ! (state & Input::eShift) && ! (state & Input::eAlt) ! ) ! { ! return false; ! } ! TScanCodeEntryMap::const_iterator entry = mScanCodes.find(code); ! if (entry != mScanCodes.end()) ! { ! if (state & Input::eShift) ! { ! ch = (*entry).second->shiftModifier; ! return ch != 0; ! } ! ! if (state & Input::eAlt) ! { ! ch = (*entry).second->altModifier; ! return ch != 0; ! } ! ! ch = (*entry).second->noModifier; ! return ch != 0; ! } ! ! return false; } void ScanCodeMap::Reset() { ! for ( ! TScanCodeEntryMap::iterator i = mScanCodes.begin(); ! i != mScanCodes.end(); ! ++i ! ) ! { ! delete (*i).second; ! } } ! void ScanCodeMap::AddCode(Input::TInputCode ic, const std::string &name, ! char noMod, char shiftMod, char altMod) { ! TScanCodeEntry *entry = new TScanCodeEntry(); ! entry->Set(name, noMod, shiftMod, altMod); ! mScanCodes[ic] = entry; } Index: scancodemap.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/scancodemap.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** scancodemap.h 5 Dec 2005 21:38:22 -0000 1.1 --- scancodemap.h 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 58,63 **** struct TScanCodeEntry { ! std::string name; // name of the key ! char noModifier; // no modifiers '<' char shiftModifier; // shift modifier '>' char altModifier; // alt modifier '|' --- 58,63 ---- struct TScanCodeEntry { ! std::string name; // name of the key ! char noModifier; // no modifiers '<' char shiftModifier; // shift modifier '>' char altModifier; // alt modifier '|' *************** *** 72,76 **** }; protected: ! typedef std::map<kerosin::InputServer::TInputCode, TScanCodeEntry*> TScanCodeEntryMap; // // functions --- 72,76 ---- }; protected: ! typedef std::map<Input::TInputCode, TScanCodeEntry*> TScanCodeEntryMap; // // functions *************** *** 80,88 **** ~ScanCodeMap(); ! InputServer::TInputCode GetCode(const std::string &name) const; ! bool TranslateCode(InputServer::TInputCode code, unsigned long state, char &ch) const; ! void Reset(); ! void AddCode(InputServer::TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod); protected: //! this is the map which the translation process is based on --- 80,88 ---- ~ScanCodeMap(); ! Input::TInputCode GetCode(const std::string &name) const; ! bool TranslateCode(Input::TInputCode code, unsigned long state, char &ch) const; ! void Reset(); ! void AddCode(Input::TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod); protected: //! this is the map which the translation process is based on Index: inputserver.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/kerosin/inputserver/inputserver.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inputserver.h 5 Dec 2005 21:38:22 -0000 1.1 --- inputserver.h 25 Dec 2005 18:32:27 -0000 1.2 *************** *** 24,27 **** --- 24,28 ---- #include <zeitgeist/node.h> + #include "input.h" namespace kerosin *************** *** 67,141 **** public: - typedef int TInputCode; - - enum EModifiers - { - eNone = 0x0000, - eLShift = 0x0001, - eRShift = 0x0002, - eShift = 0x0003, // eLShift|eRShift - eLCtrl = 0x0040, - eRCtrl = 0x0080, - eCtrl = 0x00c0, // eLCtrl|eRCtrl - eLAlt = 0x0100, - eRAlt = 0x0200, - eAlt = 0x0300, // eLAlt|eRAlt - eNum = 0x1000, - eCaps = 0x2000, - }; - - //! this enumerates different tpyes of input events. - enum EType - { - eUnknown, // default value, indicating a not initialized - // input event - eButton, // all buttons of a keyboard and mouse buttons - eAxis, // two mouse axis, the mouse wheel and the - // time axis - eUser // a user specified input event (used by the - // window server) - }; - - /** this defines the input data structure, encapsulating all - input events generated by the devices. - */ - struct Input - { - public: - //! this indicates the input data type - EType type; - - //! the IC_ code of the button or the axis (see inputconst.h) - TInputCode code; - - /** this is a user defined value the Input event evaluated to, - or -1 to indicate a raw Input event. - */ - int id; - - //! union for additional data - union - { - /** this is used to encode a button event. currently only - 1 for 'pressed' and 0 for 'released' are used - */ - long l; - - //! this is used to encode a position on an axis. - float f; - } data; - - public: - //! this initializes values indicating an invalid input event - Input(EType t = eUnknown, TInputCode c=0, int i=-1) - : type(t),code(c),id(i) {} - - //! returns true if the input represents a key press event - bool KeyPress() const { return (data.l == 1); } - - //! returns true if the input represents a key release event - bool KeyRelease() const { return (data.l == 0); } - }; - /** this enumerates different filters that describing which button events are translated to user defined values (aka bindings). --- 68,71 ---- *************** *** 156,160 **** { int code; // a value identifying the button or ! // axis (see TInputCodes) int cmd; // the associated user defined value unsigned int modifier; // a bitmask of modifiers (see --- 86,90 ---- { int code; // a value identifying the button or ! // axis (see Input::TInputCodes) int cmd; // the associated user defined value unsigned int modifier; // a bitmask of modifiers (see *************** *** 211,215 **** //! add a code to the scancode map ! void AddCode(TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod); --- 141,145 ---- //! add a code to the scancode map ! void AddCode(Input::TInputCode ic, const std::string &name, char noMod, char shiftMod, char altMod); *************** *** 217,225 **** character. Untranslatable codes will return 0 */ ! bool TranslateCode(TInputCode code, unsigned long state, char &ch) const; //! invoke a certain input event void Invoke(int cmd); private: bool ParseBindDescription(Bind &bind, const std::string &desc); --- 147,158 ---- character. Untranslatable codes will return 0 */ ! bool TranslateCode(Input::TInputCode code, unsigned long state, char &ch) const; //! invoke a certain input event void Invoke(int cmd); + /** returns a reference to the modifier state map */ + unsigned int& GetModifierState(); + private: bool ParseBindDescription(Bind &bind, const std::string &desc); *************** *** 230,361 **** // Members // - public: - static const TInputCode IC_1; - static const TInputCode IC_2; - static const TInputCode IC_3; - static const TInputCode IC_4; - static const TInputCode IC_5; - static const TInputCode IC_6; - static const TInputCode IC_7; - static const TInputCode IC_8; - static const TInputCode IC_9; - static const TInputCode IC_0; - // function keys - static const TInputCode IC_F1; - static const TInputCode IC_F2; - static const TInputCode IC_F3; - static const TInputCode IC_F4; - static const TInputCode IC_F5; - static const TInputCode IC_F6; - static const TInputCode IC_F7; - static const TInputCode IC_F8; - static const TInputCode IC_F9; - static const TInputCode IC_F10; - static const TInputCode IC_F11; - static const TInputCode IC_F12; - // alphabet - static const TInputCode IC_A; - static const TInputCode IC_B; - static const TInputCode IC_C; - static const TInputCode IC_D; - static const TInputCode IC_E; - static const TInputCode IC_F; - static const TInputCode IC_G; - static const TInputCode IC_H; - static const TInputCode IC_I; - static const TInputCode IC_J; - static const TInputCode IC_K; - static const TInputCode IC_L; - static const TInputCode IC_M; - static const TInputCode IC_N; - static const TInputCode IC_O; - static const TInputCode IC_P; - static const TInputCode IC_Q; - static const TInputCode IC_R; - static const TInputCode IC_S; - static const TInputCode IC_T; - static const TInputCode IC_U; - static const TInputCode IC_V; - static const TInputCode IC_W; - static const TInputCode IC_X; - static const TInputCode IC_Y; - static const TInputCode IC_Z; - // keypad - static const TInputCode IC_KP0; - static const TInputCode IC_KP1; - static const TInputCode IC_KP2; - static const TInputCode IC_KP3; - static const TInputCode IC_KP4; - static const TInputCode IC_KP5; - static const TInputCode IC_KP6; - static const TInputCode IC_KP7; - static const TInputCode IC_KP8; - static const TInputCode IC_KP9; - static const TInputCode IC_KP_DECIMAL; - static const TInputCode IC_KP_DIVIDE; - static const TInputCode IC_KP_MULTIPLY; - static const TInputCode IC_KP_MINUS; - static const TInputCode IC_KP_PLUS; - static const TInputCode IC_KP_ENTER; - // arrows + home/end pad - static const TInputCode IC_UP; - static const TInputCode IC_DOWN; - static const TInputCode IC_LEFT; - static const TInputCode IC_RIGHT; - static const TInputCode IC_INSERT; - static const TInputCode IC_DELETE; - static const TInputCode IC_HOME; - static const TInputCode IC_END; - static const TInputCode IC_PAGEUP; - static const TInputCode IC_PAGEDOWN; - // key state modifier keys - static const TInputCode IC_NUMLOCK; - static const TInputCode IC_CAPSLOCK; - static const TInputCode IC_SCROLLOCK; - static const TInputCode IC_LSHIFT; - static const TInputCode IC_RSHIFT; - static const TInputCode IC_LCTRL; - static const TInputCode IC_RCTRL; - static const TInputCode IC_LALT; - static const TInputCode IC_RALT; - static const TInputCode IC_LSUPER; // Left "Windows" key - static const TInputCode IC_RSUPER; // Right "Windows" key - // other keys (cursor control, punctuation) - static const TInputCode IC_ESCAPE; - static const TInputCode IC_PRINT; - static const TInputCode IC_PAUSE; - static const TInputCode IC_GRAVE; - static const TInputCode IC_MINUS; - static const TInputCode IC_EQUALS; - static const TInputCode IC_BACKSLASH; - static const TInputCode IC_BACKSPACE; - - static const TInputCode IC_TAB; - static const TInputCode IC_LBRACKET; - static const TInputCode IC_RBRACKET; - static const TInputCode IC_RETURN; - - static const TInputCode IC_SEMICOLON; - static const TInputCode IC_APOSTROPHE; - - static const TInputCode IC_OEM_102; // German <>| - static const TInputCode IC_COMMA; - static const TInputCode IC_PERIOD; - static const TInputCode IC_SLASH; - - static const TInputCode IC_SPACE; - - // mouse buttons - static const TInputCode IC_MOUSE_LEFT; // left - static const TInputCode IC_MOUSE_RIGHT; // right - static const TInputCode IC_MOUSE_MIDDLE; // middle - - //mouse axis - static const TInputCode IC_AXISX; - static const TInputCode IC_AXISY; - static const TInputCode IC_AXISZ; - - // timer - static const TInputCode IC_AXIST; // this is the up-to-date state of the modifier keys --- 163,166 ---- |