Exemple #1
0
bool CMouse::Init()
{
	CryLog("Initializing mouse");

	if (!CreateDirectInputDevice(&c_dfDIMouse2, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND, 4096))
		return false;
	
	// Set mouse axis mode.
	DIPROPDWORD dipdw = {{sizeof(DIPROPDWORD), sizeof(DIPROPHEADER), 0, DIPH_DEVICE}, DIPROPAXISMODE_REL};

	HRESULT hr = GetDirectInputDevice()->SetProperty( DIPROP_AXISMODE,&dipdw.diph );
	if  (FAILED(hr))
	{
		CryFatalError( "CMouse::Init SetProperty DIPROP_AXISMODE failed." );
		return false;
	}
	

	m_deltas.zero();
	m_oldDeltas.zero();
	m_deltasInertia.zero();
	m_mouseWheel = 0.0f;
	
	Acquire();

	// key mapping
	Symbol[eKI_Mouse1-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON0, eKI_Mouse1, "mouse1");
	Symbol[eKI_Mouse2-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON1, eKI_Mouse2, "mouse2");
	Symbol[eKI_Mouse3-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON2, eKI_Mouse3, "mouse3");
	Symbol[eKI_Mouse4-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON3, eKI_Mouse4, "mouse4");
	Symbol[eKI_Mouse5-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON4, eKI_Mouse5, "mouse5");
	Symbol[eKI_Mouse6-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON5, eKI_Mouse6, "mouse6");
	Symbol[eKI_Mouse7-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON6, eKI_Mouse7, "mouse7");
	Symbol[eKI_Mouse8-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON7, eKI_Mouse8, "mouse8");

	Symbol[eKI_MouseWheelUp-KI_MOUSE_BASE] = MapSymbol(_DIMOFS_WHEEL_UP, eKI_MouseWheelUp, "mwheel_up");
	Symbol[eKI_MouseWheelDown-KI_MOUSE_BASE] = MapSymbol(_DIMOFS_WHEEL_DOWN, eKI_MouseWheelDown, "mwheel_down");
	Symbol[eKI_MouseX-KI_MOUSE_BASE] = MapSymbol(DIMOFS_X, eKI_MouseX, "maxis_x", SInputSymbol::RawAxis);
	Symbol[eKI_MouseY-KI_MOUSE_BASE] = MapSymbol(DIMOFS_Y, eKI_MouseY, "maxis_y", SInputSymbol::RawAxis);
	Symbol[eKI_MouseZ-KI_MOUSE_BASE] = MapSymbol(DIMOFS_Z, eKI_MouseZ, "maxis_z", SInputSymbol::RawAxis);

	return true;
}
Exemple #2
0
bool CXInputDevice::Init()
{
	// setup input event names
	MapSymbol(XINPUT_GAMEPAD_DPAD_UP, eKI_XI_DPadUp, "xi_dpad_up");
	MapSymbol(XINPUT_GAMEPAD_DPAD_DOWN, eKI_XI_DPadDown, "xi_dpad_down");
	MapSymbol(XINPUT_GAMEPAD_DPAD_LEFT, eKI_XI_DPadLeft, "xi_dpad_left");
	MapSymbol(XINPUT_GAMEPAD_DPAD_RIGHT, eKI_XI_DPadRight, "xi_dpad_right");
	MapSymbol(XINPUT_GAMEPAD_START, eKI_XI_Start, "xi_start");
	MapSymbol(XINPUT_GAMEPAD_BACK, eKI_XI_Back, "xi_back");
	MapSymbol(XINPUT_GAMEPAD_LEFT_THUMB, eKI_XI_ThumbL, "xi_thumbl");
	MapSymbol(XINPUT_GAMEPAD_RIGHT_THUMB, eKI_XI_ThumbR, "xi_thumbr");
	MapSymbol(XINPUT_GAMEPAD_LEFT_SHOULDER, eKI_XI_ShoulderL, "xi_shoulderl");
	MapSymbol(XINPUT_GAMEPAD_RIGHT_SHOULDER, eKI_XI_ShoulderR, "xi_shoulderr");
	MapSymbol(XINPUT_GAMEPAD_A, eKI_XI_A, "xi_a");
	MapSymbol(XINPUT_GAMEPAD_B, eKI_XI_B, "xi_b");
	MapSymbol(XINPUT_GAMEPAD_X, eKI_XI_X, "xi_x");
	MapSymbol(XINPUT_GAMEPAD_Y, eKI_XI_Y, "xi_y");
	MapSymbol(_XINPUT_GAMEPAD_LEFT_TRIGGER, eKI_XI_TriggerL, "xi_triggerl",	SInputSymbol::Trigger);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_TRIGGER, eKI_XI_TriggerR, "xi_triggerr",	SInputSymbol::Trigger);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_X, eKI_XI_ThumbLX, "xi_thumblx",		SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_Y, eKI_XI_ThumbLY, "xi_thumbly",		SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_UP, eKI_XI_ThumbLUp, "xi_thumbl_up");
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_DOWN, eKI_XI_ThumbLDown, "xi_thumbl_down");
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_LEFT, eKI_XI_ThumbLLeft, "xi_thumbl_left");
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_RIGHT, eKI_XI_ThumbLRight, "xi_thumbl_right");
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_X, eKI_XI_ThumbRX, "xi_thumbrx",		SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_Y, eKI_XI_ThumbRY, "xi_thumbry",		SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_UP, eKI_XI_ThumbRUp, "xi_thumbr_up");
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_DOWN, eKI_XI_ThumbRDown, "xi_thumbr_down");
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_LEFT, eKI_XI_ThumbRLeft, "xi_thumbr_left");
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_RIGHT, eKI_XI_ThumbRRight, "xi_thumbr_right");
	MapSymbol(_XINPUT_GAMEPAD_LEFT_TRIGGER_BTN, eKI_XI_TriggerLBtn, "xi_triggerl_btn");	// trigger usable as a button
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_TRIGGER_BTN, eKI_XI_TriggerRBtn, "xi_triggerr_btn");	// trigger usable as a button


	//////////////////////////////////////////////////////////////////////////

	m_basicLeftMotorRumble = m_basicRightMotorRumble = 0.0f;
	m_frameLeftMotorRumble = m_frameRightMotorRumble = 0.0f;
	RestoreDefaultDeadZone();

	return true;
}
bool gkXboxInputDevice::Init()
{
	// setup input event names
	MapSymbol(XINPUT_GAMEPAD_DPAD_UP, eKI_Xbox_DPadUp);
	MapSymbol(XINPUT_GAMEPAD_DPAD_DOWN, eKI_Xbox_DPadDown);
	MapSymbol(XINPUT_GAMEPAD_DPAD_LEFT, eKI_Xbox_DPadLeft);
	MapSymbol(XINPUT_GAMEPAD_DPAD_RIGHT, eKI_Xbox_DPadRight);
	MapSymbol(XINPUT_GAMEPAD_START, eKI_Xbox_Start);
	MapSymbol(XINPUT_GAMEPAD_BACK, eKI_Xbox_Back);
	MapSymbol(XINPUT_GAMEPAD_LEFT_THUMB, eKI_Xbox_ThumbL);
	MapSymbol(XINPUT_GAMEPAD_RIGHT_THUMB, eKI_Xbox_ThumbR);
	MapSymbol(XINPUT_GAMEPAD_LEFT_SHOULDER, eKI_Xbox_ShoulderL);
	MapSymbol(XINPUT_GAMEPAD_RIGHT_SHOULDER, eKI_Xbox_ShoulderR);
	MapSymbol(XINPUT_GAMEPAD_A, eKI_Xbox_A);
	MapSymbol(XINPUT_GAMEPAD_B, eKI_Xbox_B);
	MapSymbol(XINPUT_GAMEPAD_X, eKI_Xbox_X);
	MapSymbol(XINPUT_GAMEPAD_Y, eKI_Xbox_Y);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_TRIGGER, eKI_Xbox_TriggerL,	SInputSymbol::Trigger);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_TRIGGER, eKI_Xbox_TriggerR,	SInputSymbol::Trigger);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_X, eKI_Xbox_ThumbLX, 	SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_Y, eKI_Xbox_ThumbLY,		SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_UP, eKI_Xbox_ThumbLUp);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_DOWN, eKI_Xbox_ThumbLDown);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_LEFT, eKI_Xbox_ThumbLLeft);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_THUMB_RIGHT, eKI_Xbox_ThumbLRight);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_X, eKI_Xbox_ThumbRX, SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_Y, eKI_Xbox_ThumbRY, SInputSymbol::Axis);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_UP, eKI_Xbox_ThumbRUp);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_DOWN, eKI_Xbox_ThumbRDown);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_LEFT, eKI_Xbox_ThumbRLeft);
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_THUMB_RIGHT, eKI_Xbox_ThumbRRight);
	MapSymbol(_XINPUT_GAMEPAD_LEFT_TRIGGER_BTN, eKI_Xbox_TriggerLBtn);	// trigger usable as a button
	MapSymbol(_XINPUT_GAMEPAD_RIGHT_TRIGGER_BTN, eKI_Xbox_TriggerRBtn);	// trigger usable as a button


	//////////////////////////////////////////////////////////////////////////


	m_basicLeftMotorRumble = m_basicRightMotorRumble = 0.0f;
	m_frameLeftMotorRumble = m_frameRightMotorRumble = 0.0f;
	//RestoreDefaultDeadZone();

	return true;
}
Exemple #4
0
void CSDLKeyboard::SetupKeyNames()
{
	MapSymbol(SDL_SCANCODE_BACKSPACE, eKI_Backspace, "backspace");
	MapSymbol(SDL_SCANCODE_TAB, eKI_Tab, "tab");
	// MapSymbol(SDLK_CLEAR clear);
	MapSymbol(SDL_SCANCODE_RETURN, eKI_Enter, "enter");
	MapSymbol(SDL_SCANCODE_PAUSE, eKI_Pause, "pause");
	MapSymbol(SDL_SCANCODE_ESCAPE, eKI_Escape, "escape");
	MapSymbol(SDL_SCANCODE_SPACE, eKI_Space, "space");
	//MapSymbol(SDLK_EXCLAIM '!' exclamation mark);
	//MapSymbol(SDLK_QUOTEDBL '"' double quote);
	//MapSymbol(SDLK_HASH '#' hash);
	//MapSymbol(SDLK_DOLLAR '$' dollar);
	//MapSymbol(SDLK_AMPERSAND '&' ampersand);
	//MapSymbol(SDLK_QUOTE '\'' single quote);
	//MapSymbol(SDLK_LEFTPAREN '(' left parenthesis);
	//MapSymbol(SDLK_RIGHTPAREN ')' right parenthesis);
	//MapSymbol(SDLK_ASTERISK '*' asterisk);
	//MapSymbol(SDLK_PLUS '+' plus sign);
	MapSymbol(SDL_SCANCODE_COMMA, eKI_Comma, "comma");
	MapSymbol(SDL_SCANCODE_MINUS, eKI_Minus, "minus");
	MapSymbol(SDL_SCANCODE_PERIOD, eKI_Period, "period");
	MapSymbol(SDL_SCANCODE_SLASH, eKI_Slash, "slash");
	MapSymbol(SDL_SCANCODE_0, eKI_0, "0");
	MapSymbol(SDL_SCANCODE_1, eKI_1, "1");
	MapSymbol(SDL_SCANCODE_2, eKI_2, "2");
	MapSymbol(SDL_SCANCODE_3, eKI_3, "3");
	MapSymbol(SDL_SCANCODE_4, eKI_4, "4");
	MapSymbol(SDL_SCANCODE_5, eKI_5, "5");
	MapSymbol(SDL_SCANCODE_6, eKI_6, "6");
	MapSymbol(SDL_SCANCODE_7, eKI_7, "7");
	MapSymbol(SDL_SCANCODE_8, eKI_8, "8");
	MapSymbol(SDL_SCANCODE_9, eKI_9, "9");
	//MapSymbol(SDL_SCANCODE_COLON, eKI_Colon, "colon");
	MapSymbol(SDL_SCANCODE_SEMICOLON, eKI_Semicolon, "semicolon");
	//MapSymbol(SDL_SCANCODE_LESS '<' less-than sign);
	MapSymbol(SDL_SCANCODE_EQUALS, eKI_Equals, "equals");
	//MapSymbol(SDL_SCANCODE_GREATER '>' greater-than sign);
	//MapSymbol(SDL_SCANCODE_QUESTION '?' question mark);
	//MapSymbol(SDL_SCANCODE_AT '@' at);
	MapSymbol(SDL_SCANCODE_LEFTBRACKET, eKI_LBracket, "lbracket");
	MapSymbol(SDL_SCANCODE_BACKSLASH, eKI_Backslash, "backslash");
	MapSymbol(SDL_SCANCODE_RIGHTBRACKET, eKI_RBracket, "rbracket");
	//MapSymbol(SDL_SCANCODE_CARET '^' caret);
	//MapSymbol(SDL_SCANCODE_UNDERSCORE, eKI_Underline, "underline");
	MapSymbol(SDL_SCANCODE_GRAVE, eKI_Tilde, "tilde"); // Yes, this is correct
	MapSymbol(SDL_SCANCODE_A, eKI_A, "a");
	MapSymbol(SDL_SCANCODE_B, eKI_B, "b");
	MapSymbol(SDL_SCANCODE_C, eKI_C, "c");
	MapSymbol(SDL_SCANCODE_D, eKI_D, "d");
	MapSymbol(SDL_SCANCODE_E, eKI_E, "e");
	MapSymbol(SDL_SCANCODE_F, eKI_F, "f");
	MapSymbol(SDL_SCANCODE_G, eKI_G, "g");
	MapSymbol(SDL_SCANCODE_H, eKI_H, "h");
	MapSymbol(SDL_SCANCODE_I, eKI_I, "i");
	MapSymbol(SDL_SCANCODE_J, eKI_J, "j");
	MapSymbol(SDL_SCANCODE_K, eKI_K, "k");
	MapSymbol(SDL_SCANCODE_L, eKI_L, "l");
	MapSymbol(SDL_SCANCODE_M, eKI_M, "m");
	MapSymbol(SDL_SCANCODE_N, eKI_N, "n");
	MapSymbol(SDL_SCANCODE_O, eKI_O, "o");
	MapSymbol(SDL_SCANCODE_P, eKI_P, "p");
	MapSymbol(SDL_SCANCODE_Q, eKI_Q, "q");
	MapSymbol(SDL_SCANCODE_R, eKI_R, "r");
	MapSymbol(SDL_SCANCODE_S, eKI_S, "s");
	MapSymbol(SDL_SCANCODE_T, eKI_T, "t");
	MapSymbol(SDL_SCANCODE_U, eKI_U, "u");
	MapSymbol(SDL_SCANCODE_V, eKI_V, "v");
	MapSymbol(SDL_SCANCODE_W, eKI_W, "w");
	MapSymbol(SDL_SCANCODE_X, eKI_X, "x");
	MapSymbol(SDL_SCANCODE_Y, eKI_Y, "y");
	MapSymbol(SDL_SCANCODE_Z, eKI_Z, "z");
	MapSymbol(SDL_SCANCODE_DELETE, eKI_Delete, "delete");
	//MapSymbol(SDLK_WORLD_0 world 0);
	//MapSymbol(SDLK_WORLD_1 world 1);
	//MapSymbol(SDLK_WORLD_2 world 2);
	//MapSymbol(SDLK_WORLD_3 world 3);
	//MapSymbol(SDLK_WORLD_4 world 4);
	//MapSymbol(SDLK_WORLD_5 world 5);
	//MapSymbol(SDLK_WORLD_6 world 6);
	//MapSymbol(SDLK_WORLD_7 world 7);
	//MapSymbol(SDLK_WORLD_8 world 8);
	//MapSymbol(SDLK_WORLD_9 world 9);
	//MapSymbol(SDLK_WORLD_10 world 10);
	//MapSymbol(SDLK_WORLD_11 world 11);
	//MapSymbol(SDLK_WORLD_12 world 12);
	//MapSymbol(SDLK_WORLD_13 world 13);
	//MapSymbol(SDLK_WORLD_14 world 14);
	//MapSymbol(SDLK_WORLD_15 world 15);
	//MapSymbol(SDLK_WORLD_16 world 16);
	//MapSymbol(SDLK_WORLD_17 world 17);
	//MapSymbol(SDLK_WORLD_18 world 18);
	//MapSymbol(SDLK_WORLD_19 world 19);
	//MapSymbol(SDLK_WORLD_20 world 20);
	//MapSymbol(SDLK_WORLD_21 world 21);
	//MapSymbol(SDLK_WORLD_22 world 22);
	//MapSymbol(SDLK_WORLD_23 world 23);
	//MapSymbol(SDLK_WORLD_24 world 24);
	//MapSymbol(SDLK_WORLD_25 world 25);
	//MapSymbol(SDLK_WORLD_26 world 26);
	//MapSymbol(SDLK_WORLD_27 world 27);
	//MapSymbol(SDLK_WORLD_28 world 28);
	//MapSymbol(SDLK_WORLD_29 world 29);
	//MapSymbol(SDLK_WORLD_30 world 30);
	//MapSymbol(SDLK_WORLD_31 world 31);
	//MapSymbol(SDLK_WORLD_32 world 32);
	//MapSymbol(SDLK_WORLD_33 world 33);
	//MapSymbol(SDLK_WORLD_34 world 34);
	//MapSymbol(SDLK_WORLD_35 world 35);
	//MapSymbol(SDLK_WORLD_36 world 36);
	//MapSymbol(SDLK_WORLD_37 world 37);
	//MapSymbol(SDLK_WORLD_38 world 38);
	//MapSymbol(SDLK_WORLD_39 world 39);
	//MapSymbol(SDLK_WORLD_40 world 40);
	//MapSymbol(SDLK_WORLD_41 world 41);
	//MapSymbol(SDLK_WORLD_42 world 42);
	//MapSymbol(SDLK_WORLD_43 world 43);
	//MapSymbol(SDLK_WORLD_44 world 44);
	//MapSymbol(SDLK_WORLD_45 world 45);
	//MapSymbol(SDLK_WORLD_46 world 46);
	//MapSymbol(SDLK_WORLD_47 world 47);
	//MapSymbol(SDLK_WORLD_48 world 48);
	//MapSymbol(SDLK_WORLD_49 world 49);
	//MapSymbol(SDLK_WORLD_50 world 50);
	//MapSymbol(SDLK_WORLD_51 world 51);
	//MapSymbol(SDLK_WORLD_52 world 52);
	//MapSymbol(SDLK_WORLD_53 world 53);
	//MapSymbol(SDLK_WORLD_54 world 54);
	//MapSymbol(SDLK_WORLD_55 world 55);
	//MapSymbol(SDLK_WORLD_56 world 56);
	//MapSymbol(SDLK_WORLD_57 world 57);
	//MapSymbol(SDLK_WORLD_58 world 58);
	//MapSymbol(SDLK_WORLD_59 world 59);
	//MapSymbol(SDLK_WORLD_60 world 60);
	//MapSymbol(SDLK_WORLD_61 world 61);
	//MapSymbol(SDLK_WORLD_62 world 62);
	//MapSymbol(SDLK_WORLD_63 world 63);
	//MapSymbol(SDLK_WORLD_64 world 64);
	//MapSymbol(SDLK_WORLD_65 world 65);
	//MapSymbol(SDLK_WORLD_66 world 66);
	//MapSymbol(SDLK_WORLD_67 world 67);
	//MapSymbol(SDLK_WORLD_68 world 68);
	//MapSymbol(SDLK_WORLD_69 world 69);
	//MapSymbol(SDLK_WORLD_70 world 70);
	//MapSymbol(SDLK_WORLD_71 world 71);
	//MapSymbol(SDLK_WORLD_72 world 72);
	//MapSymbol(SDLK_WORLD_73 world 73);
	//MapSymbol(SDLK_WORLD_74 world 74);
	//MapSymbol(SDLK_WORLD_75 world 75);
	//MapSymbol(SDLK_WORLD_76 world 76);
	//MapSymbol(SDLK_WORLD_77 world 77);
	//MapSymbol(SDLK_WORLD_78 world 78);
	//MapSymbol(SDLK_WORLD_79 world 79);
	//MapSymbol(SDLK_WORLD_80 world 80);
	//MapSymbol(SDLK_WORLD_81 world 81);
	//MapSymbol(SDLK_WORLD_82 world 82);
	//MapSymbol(SDLK_WORLD_83 world 83);
	//MapSymbol(SDLK_WORLD_84 world 84);
	//MapSymbol(SDLK_WORLD_85 world 85);
	//MapSymbol(SDLK_WORLD_86 world 86);
	//MapSymbol(SDLK_WORLD_87 world 87);
	//MapSymbol(SDLK_WORLD_88 world 88);
	//MapSymbol(SDLK_WORLD_89 world 89);
	//MapSymbol(SDLK_WORLD_90 world 90);
	//MapSymbol(SDLK_WORLD_91 world 91);
	//MapSymbol(SDLK_WORLD_92 world 92);
	//MapSymbol(SDLK_WORLD_93 world 93);
	//MapSymbol(SDLK_WORLD_94 world 94);
	//MapSymbol(SDLK_WORLD_95 world 95);
	MapSymbol(SDL_SCANCODE_KP_0, eKI_NP_0, "np_0");
	MapSymbol(SDL_SCANCODE_KP_1, eKI_NP_1, "np_1");
	MapSymbol(SDL_SCANCODE_KP_2, eKI_NP_2, "np_2");
	MapSymbol(SDL_SCANCODE_KP_3, eKI_NP_3, "np_3");
	MapSymbol(SDL_SCANCODE_KP_4, eKI_NP_4, "np_4");
	MapSymbol(SDL_SCANCODE_KP_5, eKI_NP_5, "np_5");
	MapSymbol(SDL_SCANCODE_KP_6, eKI_NP_6, "np_6");
	MapSymbol(SDL_SCANCODE_KP_7, eKI_NP_7, "np_7");
	MapSymbol(SDL_SCANCODE_KP_8, eKI_NP_8, "np_8");
	MapSymbol(SDL_SCANCODE_KP_9, eKI_NP_9, "np_9");
	MapSymbol(SDL_SCANCODE_KP_PERIOD, eKI_NP_Period, "np_period");
	MapSymbol(SDL_SCANCODE_KP_DIVIDE, eKI_NP_Divide, "np_divide");
	MapSymbol(SDL_SCANCODE_KP_MULTIPLY, eKI_NP_Multiply, "np_multiply");
	MapSymbol(SDL_SCANCODE_KP_MINUS, eKI_NP_Substract, "np_subtract");
	MapSymbol(SDL_SCANCODE_KP_PLUS, eKI_NP_Add, "np_add");
	MapSymbol(SDL_SCANCODE_KP_ENTER, eKI_NP_Enter, "np_enter");
	MapSymbol(SDL_SCANCODE_KP_EQUALS, eKI_NP_Enter, "np_enter");
	MapSymbol(SDL_SCANCODE_UP, eKI_Up, "up");
	MapSymbol(SDL_SCANCODE_DOWN, eKI_Down, "down");
	MapSymbol(SDL_SCANCODE_RIGHT, eKI_Right, "right");
	MapSymbol(SDL_SCANCODE_LEFT, eKI_Left, "left");
	MapSymbol(SDL_SCANCODE_INSERT, eKI_Insert, "insert");
	MapSymbol(SDL_SCANCODE_HOME, eKI_Home, "home");
	MapSymbol(SDL_SCANCODE_END, eKI_End, "end");
	MapSymbol(SDL_SCANCODE_PAGEUP, eKI_PgUp, "pgup");
	MapSymbol(SDL_SCANCODE_PAGEDOWN, eKI_PgDn, "pgdn");
	MapSymbol(SDL_SCANCODE_F1, eKI_F1, "f1");
	MapSymbol(SDL_SCANCODE_F2, eKI_F2, "f2");
	MapSymbol(SDL_SCANCODE_F3, eKI_F3, "f3");
	MapSymbol(SDL_SCANCODE_F4, eKI_F4, "f4");
	MapSymbol(SDL_SCANCODE_F5, eKI_F5, "f5");
	MapSymbol(SDL_SCANCODE_F6, eKI_F6, "f6");
	MapSymbol(SDL_SCANCODE_F7, eKI_F7, "f7");
	MapSymbol(SDL_SCANCODE_F8, eKI_F8, "f8");
	MapSymbol(SDL_SCANCODE_F9, eKI_F9, "f9");
	MapSymbol(SDL_SCANCODE_F10, eKI_F10, "f10");
	MapSymbol(SDL_SCANCODE_F11, eKI_F11, "f11");
	MapSymbol(SDL_SCANCODE_F12, eKI_F12, "f12");
	MapSymbol(SDL_SCANCODE_F13, eKI_F13, "f13");
	MapSymbol(SDL_SCANCODE_F14, eKI_F14, "f14");
	MapSymbol(SDL_SCANCODE_F15, eKI_F15, "f15");
	MapSymbol(SDL_SCANCODE_NUMLOCKCLEAR, eKI_NumLock, "numlock", SInputSymbol::Toggle, eMM_NumLock);
	MapSymbol(SDL_SCANCODE_CAPSLOCK, eKI_CapsLock, "capslock", SInputSymbol::Toggle, eMM_CapsLock);
	MapSymbol(SDL_SCANCODE_SCROLLLOCK, eKI_ScrollLock, "scrolllock", SInputSymbol::Toggle, eMM_ScrollLock);
	MapSymbol(SDL_SCANCODE_RSHIFT, eKI_RShift, "rshift", SInputSymbol::Button, eMM_RShift);
	MapSymbol(SDL_SCANCODE_LSHIFT, eKI_LShift, "lshift", SInputSymbol::Button, eMM_LShift);
	MapSymbol(SDL_SCANCODE_RCTRL, eKI_RCtrl, "rctrl", SInputSymbol::Button, eMM_RCtrl);
	MapSymbol(SDL_SCANCODE_LCTRL, eKI_LCtrl, "lctrl", SInputSymbol::Button, eMM_LCtrl);
	MapSymbol(SDL_SCANCODE_RALT, eKI_RAlt, "ralt", SInputSymbol::Button, eMM_RAlt);
	MapSymbol(SDL_SCANCODE_LALT, eKI_LAlt, "lalt", SInputSymbol::Button, eMM_LAlt);
	//MapSymbol(SDL_SCANCODE_RMETA right meta);
	//MapSymbol(SDL_SCANCODE_LMETA left meta);
	MapSymbol(SDL_SCANCODE_LGUI, eKI_LWin, "lwin", SInputSymbol::Button, eMM_LWin);
	MapSymbol(SDL_SCANCODE_RGUI, eKI_RWin, "rwin", SInputSymbol::Button, eMM_RWin);
	//MapSymbol(SDL_SCANCODE_MODE mode shift);
	//MapSymbol(SDL_SCANCODE_COMPOSE compose);
	//MapSymbol(SDL_SCANCODE_HELP help);
	MapSymbol(SDL_SCANCODE_PRINTSCREEN, eKI_Print, "print");
	//MapSymbol(SDL_SCANCODE_SYSREQ SysRq);
	MapSymbol(SDL_SCANCODE_PAUSE, eKI_Pause, "pause");
	//MapSymbol(SDL_SCANCODE_MENU menu);
	//MapSymbol(SDL_SCANCODE_POWER power);
	//MapSymbol(SDL_SCANCODE_EURO euro);
	//MapSymbol(SDL_SCANCODE_UNDO undo);
}
Exemple #5
0
bool CSDLPad::Init()
{
	// Setup symbols
	MapSymbol(SDL_GAMEPAD_DPAD_UP, eKI_XI_DPadUp, "xi_dpad_up");
	MapSymbol(SDL_GAMEPAD_DPAD_DOWN, eKI_XI_DPadDown, "xi_dpad_down");
	MapSymbol(SDL_GAMEPAD_DPAD_LEFT, eKI_XI_DPadLeft, "xi_dpad_left");
	MapSymbol(SDL_GAMEPAD_DPAD_RIGHT, eKI_XI_DPadRight, "xi_dpad_right");
	MapSymbol(SDL_GAMEPAD_START, eKI_XI_Start, "xi_start");
	MapSymbol(SDL_GAMEPAD_BACK, eKI_XI_Back, "xi_back");
	MapSymbol(SDL_GAMEPAD_LEFT_THUMB, eKI_XI_ThumbL, "xi_thumbl");
	MapSymbol(SDL_GAMEPAD_RIGHT_THUMB, eKI_XI_ThumbR, "xi_thumbr");
	MapSymbol(SDL_GAMEPAD_LEFT_SHOULDER, eKI_XI_ShoulderL, "xi_shoulderl");
	MapSymbol(SDL_GAMEPAD_RIGHT_SHOULDER, eKI_XI_ShoulderR, "xi_shoulderr");
	MapSymbol(SDL_GAMEPAD_A, eKI_XI_A, "xi_a");
	MapSymbol(SDL_GAMEPAD_B, eKI_XI_B, "xi_b");
	MapSymbol(SDL_GAMEPAD_X, eKI_XI_X, "xi_x");
	MapSymbol(SDL_GAMEPAD_Y, eKI_XI_Y, "xi_y");
	MapSymbol(SDL_GAMEPAD_LEFT_TRIGGER, eKI_XI_TriggerL, "xi_triggerl",	SInputSymbol::Trigger);
	MapSymbol(SDL_GAMEPAD_RIGHT_TRIGGER, eKI_XI_TriggerR, "xi_triggerr",	SInputSymbol::Trigger);
	MapSymbol(SDL_GAMEPAD_LEFT_THUMB_X, eKI_XI_ThumbLX, "xi_thumblx",		SInputSymbol::Axis);
	MapSymbol(SDL_GAMEPAD_LEFT_THUMB_Y, eKI_XI_ThumbLY, "xi_thumbly",		SInputSymbol::Axis);
	// Map left thumb dpad button events to corresponing dpad hat events
	MapSymbol(SDL_GAMEPAD_LEFT_THUMB_UP, eKI_XI_DPadUp, "xi_dpad_up");
	MapSymbol(SDL_GAMEPAD_LEFT_THUMB_DOWN, eKI_XI_DPadDown, "xi_dpad_down");
	MapSymbol(SDL_GAMEPAD_LEFT_THUMB_LEFT, eKI_XI_DPadLeft, "xi_dpad_left");
	MapSymbol(SDL_GAMEPAD_LEFT_THUMB_RIGHT, eKI_XI_DPadRight, "xi_dpad_right");
	MapSymbol(SDL_GAMEPAD_RIGHT_THUMB_X, eKI_XI_ThumbRX, "xi_thumbrx",		SInputSymbol::Axis);
	MapSymbol(SDL_GAMEPAD_RIGHT_THUMB_Y, eKI_XI_ThumbRY, "xi_thumbry",		SInputSymbol::Axis);
	/*MapSymbol(SDL_GAMEPAD_RIGHT_THUMB_UP, eKI_XI_ThumbRUp, "xi_thumbr_up");
	  MapSymbol(SDL_GAMEPAD_RIGHT_THUMB_DOWN, eKI_XI_ThumbRDown, "xi_thumbr_down");
	  MapSymbol(SDL_GAMEPAD_RIGHT_THUMB_LEFT, eKI_XI_ThumbRLeft, "xi_thumbr_left");
	  MapSymbol(SDL_GAMEPAD_RIGHT_THUMB_RIGHT, eKI_XI_ThumbRRight, "xi_thumbr_right");*/
	MapSymbol(SDL_GAMEPAD_LEFT_TRIGGER_BTN, eKI_XI_TriggerLBtn, "xi_triggerl_btn");	// trigger usable as a button
	MapSymbol(SDL_GAMEPAD_RIGHT_TRIGGER_BTN, eKI_XI_TriggerRBtn, "xi_triggerr_btn");	// trigger usable as a button

	return true;
}
Exemple #6
0
bool gkMouse::Init()
{
	if (!CreateDirectInputDevice(&c_dfDIMouse2, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND, 4096))
		return false;
	
	// Set mouse axis mode.
	DIPROPDWORD dipdw = {{sizeof(DIPROPDWORD), sizeof(DIPROPHEADER), 0, DIPH_DEVICE}, DIPROPAXISMODE_REL};

	HRESULT hr = GetDirectInputDevice()->SetProperty( DIPROP_AXISMODE,&dipdw.diph );
	if  (FAILED(hr))
	{
		gkLogError( _T("CMouse::Init SetProperty DIPROP_AXISMODE failed.") );
		return false;
	}

	gkLogMessage( _T("InputDevice [ Mouse ] Initialized.\n") );
	

	m_deltas.zero();
	m_oldDeltas.zero();
	m_deltasInertia.zero();
	m_mouseWheel = 0.0f;
	
	Acquire();

	// key mapping
	Symbol[eKI_Mouse1-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON0, eKI_Mouse1);
	Symbol[eKI_Mouse2-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON1, eKI_Mouse2);
	Symbol[eKI_Mouse3-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON2, eKI_Mouse3);
	Symbol[eKI_Mouse4-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON3, eKI_Mouse4);
	Symbol[eKI_Mouse5-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON4, eKI_Mouse5);
	Symbol[eKI_Mouse6-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON5, eKI_Mouse6);
	Symbol[eKI_Mouse7-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON6, eKI_Mouse7);
	Symbol[eKI_Mouse8-KI_MOUSE_BASE] = MapSymbol(DIMOFS_BUTTON7, eKI_Mouse8);

	Symbol[eKI_MouseWheelUp-KI_MOUSE_BASE] = MapSymbol(_DIMOFS_WHEEL_UP, eKI_MouseWheelUp);
	Symbol[eKI_MouseWheelDown-KI_MOUSE_BASE] = MapSymbol(_DIMOFS_WHEEL_DOWN, eKI_MouseWheelDown);
	Symbol[eKI_MouseX-KI_MOUSE_BASE] = MapSymbol(DIMOFS_X, eKI_MouseX, SInputSymbol::RawAxis);
	Symbol[eKI_MouseY-KI_MOUSE_BASE] = MapSymbol(DIMOFS_Y, eKI_MouseY, SInputSymbol::RawAxis);
	Symbol[eKI_MouseZ-KI_MOUSE_BASE] = MapSymbol(DIMOFS_Z, eKI_MouseZ, SInputSymbol::RawAxis);

	return true;
}