commit
fc6186a632
5 changed files with 232 additions and 154 deletions
|
@ -66,93 +66,93 @@ int main()
|
||||||
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
DrawTexture(texXboxPad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
// Draw buttons: xbox home
|
// Draw buttons: xbox home
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_HOME)) DrawCircle(394, 89, 19, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(394, 89, 19, RED);
|
||||||
|
|
||||||
// Draw buttons: basic
|
// Draw buttons: basic
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_START)) DrawCircle(436, 150, 9, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawCircle(436, 150, 9, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_SELECT)) DrawCircle(352, 150, 9, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawCircle(352, 150, 9, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_X)) DrawCircle(501, 151, 15, BLUE);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(501, 151, 15, BLUE);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_A)) DrawCircle(536, 187, 15, LIME);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(536, 187, 15, LIME);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_B)) DrawCircle(572, 151, 15, MAROON);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(572, 151, 15, MAROON);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_Y)) DrawCircle(536, 115, 15, GOLD);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(536, 115, 15, GOLD);
|
||||||
|
|
||||||
// Draw buttons: d-pad
|
// Draw buttons: d-pad
|
||||||
DrawRectangle(317, 202, 19, 71, BLACK);
|
DrawRectangle(317, 202, 19, 71, BLACK);
|
||||||
DrawRectangle(293, 228, 69, 19, BLACK);
|
DrawRectangle(293, 228, 69, 19, BLACK);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(317, 202, 19, 26, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(317, 202 + 45, 19, 26, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(292, 228, 25, 19, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(292 + 44, 228, 26, 19, RED);
|
||||||
|
|
||||||
// Draw buttons: left-right back
|
// Draw buttons: left-right back
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_LB)) DrawCircle(259, 61, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(259, 61, 20, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_XBOX_BUTTON_RB)) DrawCircle(536, 61, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(536, 61, 20, RED);
|
||||||
|
|
||||||
// Draw axis: left joystick
|
// Draw axis: left joystick
|
||||||
DrawCircle(259, 152, 39, BLACK);
|
DrawCircle(259, 152, 39, BLACK);
|
||||||
DrawCircle(259, 152, 34, LIGHTGRAY);
|
DrawCircle(259, 152, 34, LIGHTGRAY);
|
||||||
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X)*20),
|
DrawCircle(259 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_X)*20),
|
||||||
152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y)*20), 25, BLACK);
|
152 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
DrawCircle(461, 237, 38, BLACK);
|
DrawCircle(461, 237, 38, BLACK);
|
||||||
DrawCircle(461, 237, 33, LIGHTGRAY);
|
DrawCircle(461, 237, 33, LIGHTGRAY);
|
||||||
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_X)*20),
|
DrawCircle(461 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||||
237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RIGHT_Y)*20), 25, BLACK);
|
237 - (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(170, 30, 15, 70, GRAY);
|
DrawRectangle(170, 30, 15, 70, GRAY);
|
||||||
DrawRectangle(604, 30, 15, 70, GRAY);
|
DrawRectangle(604, 30, 15, 70, GRAY);
|
||||||
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT))/2.0f)*70), RED);
|
DrawRectangle(170, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED);
|
||||||
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT))/2.0f)*70), RED);
|
DrawRectangle(604, 30, 15, (((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED);
|
||||||
|
|
||||||
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
|
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER)), 10, 40, 10, BLACK);
|
||||||
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
|
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER)), 10, 60, 10, BLACK);
|
||||||
}
|
}
|
||||||
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
|
||||||
{
|
{
|
||||||
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
DrawTexture(texPs3Pad, 0, 0, DARKGRAY);
|
||||||
|
|
||||||
// Draw buttons: ps
|
// Draw buttons: ps
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_PS)) DrawCircle(396, 222, 13, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE)) DrawCircle(396, 222, 13, RED);
|
||||||
|
|
||||||
// Draw buttons: basic
|
// Draw buttons: basic
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SELECT)) DrawRectangle(328, 170, 32, 13, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_LEFT)) DrawRectangle(328, 170, 32, 13, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_START)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_MIDDLE_RIGHT)) DrawTriangle((Vector2){ 436, 168 }, (Vector2){ 436, 185 }, (Vector2){ 464, 177 }, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_TRIANGLE)) DrawCircle(557, 144, 13, LIME);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_UP)) DrawCircle(557, 144, 13, LIME);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CIRCLE)) DrawCircle(586, 173, 13, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT)) DrawCircle(586, 173, 13, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_CROSS)) DrawCircle(557, 203, 13, VIOLET);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_DOWN)) DrawCircle(557, 203, 13, VIOLET);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_SQUARE)) DrawCircle(527, 173, 13, PINK);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_FACE_LEFT)) DrawCircle(527, 173, 13, PINK);
|
||||||
|
|
||||||
// Draw buttons: d-pad
|
// Draw buttons: d-pad
|
||||||
DrawRectangle(225, 132, 24, 84, BLACK);
|
DrawRectangle(225, 132, 24, 84, BLACK);
|
||||||
DrawRectangle(195, 161, 84, 25, BLACK);
|
DrawRectangle(195, 161, 84, 25, BLACK);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_UP)) DrawRectangle(225, 132, 24, 29, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_DOWN)) DrawRectangle(225, 132 + 54, 24, 30, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_LEFT)) DrawRectangle(195, 161, 30, 25, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_FACE_RIGHT)) DrawRectangle(195 + 54, 161, 30, 25, RED);
|
||||||
|
|
||||||
// Draw buttons: left-right back buttons
|
// Draw buttons: left-right back buttons
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_L1)) DrawCircle(239, 82, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_LEFT_TRIGGER_1)) DrawCircle(239, 82, 20, RED);
|
||||||
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_PS3_BUTTON_R1)) DrawCircle(557, 82, 20, RED);
|
if (IsGamepadButtonDown(GAMEPAD_PLAYER1, GAMEPAD_BUTTON_RIGHT_TRIGGER_1)) DrawCircle(557, 82, 20, RED);
|
||||||
|
|
||||||
// Draw axis: left joystick
|
// Draw axis: left joystick
|
||||||
DrawCircle(319, 255, 35, BLACK);
|
DrawCircle(319, 255, 35, BLACK);
|
||||||
DrawCircle(319, 255, 31, LIGHTGRAY);
|
DrawCircle(319, 255, 31, LIGHTGRAY);
|
||||||
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_X)*20),
|
DrawCircle(319 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_X)*20),
|
||||||
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_LEFT_Y)*20), 25, BLACK);
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
// Draw axis: right joystick
|
// Draw axis: right joystick
|
||||||
DrawCircle(475, 255, 35, BLACK);
|
DrawCircle(475, 255, 35, BLACK);
|
||||||
DrawCircle(475, 255, 31, LIGHTGRAY);
|
DrawCircle(475, 255, 31, LIGHTGRAY);
|
||||||
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_X)*20),
|
DrawCircle(475 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_X)*20),
|
||||||
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_RIGHT_Y)*20), 25, BLACK);
|
255 + (GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_Y)*20), 25, BLACK);
|
||||||
|
|
||||||
// Draw axis: left-right triggers
|
// Draw axis: left-right triggers
|
||||||
DrawRectangle(169, 48, 15, 70, GRAY);
|
DrawRectangle(169, 48, 15, 70, GRAY);
|
||||||
DrawRectangle(611, 48, 15, 70, GRAY);
|
DrawRectangle(611, 48, 15, 70, GRAY);
|
||||||
DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_L2))/2.0f)*70), RED);
|
DrawRectangle(169, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_TRIGGER))/2.0f)*70), RED);
|
||||||
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2))/2.0f)*70), RED);
|
DrawRectangle(611, 48, 15, (((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_RIGHT_TRIGGER))/2.0f)*70), RED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,8 +32,8 @@ void App::Update()
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
posX += GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_X) * 5;
|
posX += GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_X) * 5;
|
||||||
posY += GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LEFT_Y) * -5;
|
posY += GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_AXIS_LEFT_Y) * -5;
|
||||||
|
|
||||||
auto mPos = GetMousePosition();
|
auto mPos = GetMousePosition();
|
||||||
|
|
||||||
|
|
|
@ -371,27 +371,30 @@ protected:
|
||||||
GamepadReading reading = gamepad->GetCurrentReading();
|
GamepadReading reading = gamepad->GetCurrentReading();
|
||||||
|
|
||||||
// NOTE: Maybe it would be wiser to redefine the gamepad button mappings in "raylib.h" for the UWP platform instead of remapping them manually
|
// NOTE: Maybe it would be wiser to redefine the gamepad button mappings in "raylib.h" for the UWP platform instead of remapping them manually
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_A, ((reading.Buttons & GamepadButtons::A) == GamepadButtons::A));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_DOWN, ((reading.Buttons & GamepadButtons::A) == GamepadButtons::A));
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_B, ((reading.Buttons & GamepadButtons::B) == GamepadButtons::B));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT, ((reading.Buttons & GamepadButtons::B) == GamepadButtons::B));
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_X, ((reading.Buttons & GamepadButtons::X) == GamepadButtons::X));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_LEFT, ((reading.Buttons & GamepadButtons::X) == GamepadButtons::X));
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_Y, ((reading.Buttons & GamepadButtons::Y) == GamepadButtons::Y));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_FACE_UP, ((reading.Buttons & GamepadButtons::Y) == GamepadButtons::Y));
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_LB, ((reading.Buttons & GamepadButtons::LeftShoulder) == GamepadButtons::LeftShoulder));
|
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_RB, ((reading.Buttons & GamepadButtons::RightShoulder) == GamepadButtons::RightShoulder));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_TRIGGER_1, ((reading.Buttons & GamepadButtons::LeftShoulder) == GamepadButtons::LeftShoulder));
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_SELECT, ((reading.Buttons & GamepadButtons::View) == GamepadButtons::View)); // Changed for XB1 Controller
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_RIGHT_TRIGGER_1, ((reading.Buttons & GamepadButtons::RightShoulder) == GamepadButtons::RightShoulder));
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_START, ((reading.Buttons & GamepadButtons::Menu) == GamepadButtons::Menu)); // Changed for XB1 Controller
|
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_UP, ((reading.Buttons & GamepadButtons::DPadUp) == GamepadButtons::DPadUp));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_MIDDLE_LEFT, ((reading.Buttons & GamepadButtons::View) == GamepadButtons::View)); // Changed for XB1 Controller
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_RIGHT, ((reading.Buttons & GamepadButtons::DPadRight) == GamepadButtons::DPadRight));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_MIDDLE_RIGHT, ((reading.Buttons & GamepadButtons::Menu) == GamepadButtons::Menu)); // Changed for XB1 Controller
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_DOWN, ((reading.Buttons & GamepadButtons::DPadDown) == GamepadButtons::DPadDown));
|
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_LEFT, ((reading.Buttons & GamepadButtons::DPadLeft) == GamepadButtons::DPadLeft));
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_UP, ((reading.Buttons & GamepadButtons::DPadUp) == GamepadButtons::DPadUp));
|
||||||
RegisterGamepadButton(i, GAMEPAD_XBOX_BUTTON_HOME, false); // Home button not supported by UWP
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_RIGHT, ((reading.Buttons & GamepadButtons::DPadRight) == GamepadButtons::DPadRight));
|
||||||
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_DOWN, ((reading.Buttons & GamepadButtons::DPadDown) == GamepadButtons::DPadDown));
|
||||||
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_LEFT_FACE_LEFT, ((reading.Buttons & GamepadButtons::DPadLeft) == GamepadButtons::DPadLeft));
|
||||||
|
RegisterGamepadButton(i, GAMEPAD_BUTTON_MIDDLE, false); // Home button not supported by UWP
|
||||||
|
|
||||||
// Get current axis state
|
// Get current axis state
|
||||||
RegisterGamepadAxis(i, GAMEPAD_XBOX_AXIS_LEFT_X, (float)reading.LeftThumbstickX);
|
RegisterGamepadAxis(i, GAMEPAD_AXIS_LEFT_X, (float)reading.LeftThumbstickX);
|
||||||
RegisterGamepadAxis(i, GAMEPAD_XBOX_AXIS_LEFT_Y, (float)reading.LeftThumbstickY);
|
RegisterGamepadAxis(i, GAMEPAD_AXIS_LEFT_Y, (float)reading.LeftThumbstickY);
|
||||||
RegisterGamepadAxis(i, GAMEPAD_XBOX_AXIS_RIGHT_X, (float)reading.RightThumbstickX);
|
RegisterGamepadAxis(i, GAMEPAD_AXIS_RIGHT_X, (float)reading.RightThumbstickX);
|
||||||
RegisterGamepadAxis(i, GAMEPAD_XBOX_AXIS_RIGHT_Y, (float)reading.RightThumbstickY);
|
RegisterGamepadAxis(i, GAMEPAD_AXIS_RIGHT_Y, (float)reading.RightThumbstickY);
|
||||||
RegisterGamepadAxis(i, GAMEPAD_XBOX_AXIS_LT, (float)reading.LeftTrigger);
|
RegisterGamepadAxis(i, GAMEPAD_AXIS_LEFT_TRIGGER, (float)reading.LeftTrigger);
|
||||||
RegisterGamepadAxis(i, GAMEPAD_XBOX_AXIS_RT, (float)reading.RightTrigger);
|
RegisterGamepadAxis(i, GAMEPAD_AXIS_RIGHT_TRIGGER, (float)reading.RightTrigger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
141
src/core.c
141
src/core.c
|
@ -3081,6 +3081,97 @@ static bool GetMouseButtonStatus(int button)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GamepadButton GetGamepadButton(int button)
|
||||||
|
{
|
||||||
|
GamepadButton b = GAMEPAD_BUTTON_UNKNOWN;
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
switch (button)
|
||||||
|
{
|
||||||
|
case GLFW_GAMEPAD_BUTTON_Y: b = GAMEPAD_BUTTON_RIGHT_FACE_UP; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_B: b = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_A: b = GAMEPAD_BUTTON_RIGHT_FACE_DOWN; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_X: b = GAMEPAD_BUTTON_RIGHT_FACE_LEFT; break;
|
||||||
|
|
||||||
|
case GLFW_GAMEPAD_BUTTON_LEFT_BUMPER: b = GAMEPAD_BUTTON_LEFT_TRIGGER_1; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER: b = GAMEPAD_BUTTON_RIGHT_TRIGGER_1; break;
|
||||||
|
|
||||||
|
case GLFW_GAMEPAD_BUTTON_BACK: b = GAMEPAD_BUTTON_MIDDLE_LEFT; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_GUIDE: b = GAMEPAD_BUTTON_MIDDLE; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_START: b = GAMEPAD_BUTTON_MIDDLE_RIGHT; break;
|
||||||
|
|
||||||
|
case GLFW_GAMEPAD_BUTTON_DPAD_UP: b = GAMEPAD_BUTTON_LEFT_FACE_UP; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT: b = GAMEPAD_BUTTON_LEFT_FACE_RIGHT; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN: b = GAMEPAD_BUTTON_LEFT_FACE_DOWN; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT: b = GAMEPAD_BUTTON_LEFT_FACE_LEFT; break;
|
||||||
|
|
||||||
|
case GLFW_GAMEPAD_BUTTON_LEFT_THUMB: b = GAMEPAD_BUTTON_LEFT_THUMB; break;
|
||||||
|
case GLFW_GAMEPAD_BUTTON_RIGHT_THUMB: b = GAMEPAD_BUTTON_RIGHT_THUMB; break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_UWP)
|
||||||
|
b = button; // UWP will provide the correct button
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
// https://www.w3.org/TR/gamepad/#gamepad-interface
|
||||||
|
switch (button)
|
||||||
|
{
|
||||||
|
case 0: b = GAMEPAD_BUTTON_RIGHT_FACE_DOWN; break;
|
||||||
|
case 1: b = GAMEPAD_BUTTON_RIGHT_FACE_RIGHT; break;
|
||||||
|
case 2: b = GAMEPAD_BUTTON_RIGHT_FACE_LEFT; break;
|
||||||
|
case 3: b = GAMEPAD_BUTTON_RIGHT_FACE_UP; break;
|
||||||
|
case 4: b = GAMEPAD_BUTTON_LEFT_TRIGGER_1; break;
|
||||||
|
case 5: b = GAMEPAD_BUTTON_RIGHT_TRIGGER_1; break;
|
||||||
|
case 6: b = GAMEPAD_BUTTON_LEFT_TRIGGER_2; break;
|
||||||
|
case 7: b = GAMEPAD_BUTTON_RIGHT_TRIGGER_2; break;
|
||||||
|
case 8: b = GAMEPAD_BUTTON_MIDDLE_LEFT; break;
|
||||||
|
case 9: b = GAMEPAD_BUTTON_MIDDLE_RIGHT; break;
|
||||||
|
case 10: b = GAMEPAD_BUTTON_LEFT_THUMB; break;
|
||||||
|
case 11: b = GAMEPAD_BUTTON_RIGHT_THUMB; break;
|
||||||
|
case 12: b = GAMEPAD_BUTTON_LEFT_FACE_UP; break;
|
||||||
|
case 13: b = GAMEPAD_BUTTON_LEFT_FACE_DOWN; break;
|
||||||
|
case 14: b = GAMEPAD_BUTTON_LEFT_FACE_LEFT; break;
|
||||||
|
case 15: b = GAMEPAD_BUTTON_LEFT_FACE_RIGHT; break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GamepadAxis GetGamepadAxis(int axis)
|
||||||
|
{
|
||||||
|
GamepadAxis a = GAMEPAD_AXIS_UNKNOWN;
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
switch(axis)
|
||||||
|
{
|
||||||
|
case GLFW_GAMEPAD_AXIS_LEFT_X: a = GAMEPAD_AXIS_LEFT_X; break;
|
||||||
|
case GLFW_GAMEPAD_AXIS_LEFT_Y: a = GAMEPAD_AXIS_LEFT_Y; break;
|
||||||
|
case GLFW_GAMEPAD_AXIS_RIGHT_X: a = GAMEPAD_AXIS_RIGHT_X; break;
|
||||||
|
case GLFW_GAMEPAD_AXIS_RIGHT_Y: a = GAMEPAD_AXIS_RIGHT_Y; break;
|
||||||
|
case GLFW_GAMEPAD_AXIS_LEFT_TRIGGER: a = GAMEPAD_AXIS_LEFT_TRIGGER; break;
|
||||||
|
case GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER: a = GAMEPAD_AXIS_RIGHT_TRIGGER; break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_UWP)
|
||||||
|
a = axis; // UWP will provide the correct axis
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WEB)
|
||||||
|
// https://www.w3.org/TR/gamepad/#gamepad-interface
|
||||||
|
switch(axis)
|
||||||
|
{
|
||||||
|
case 0: a = GAMEPAD_AXIS_LEFT_X;
|
||||||
|
case 1: a = GAMEPAD_AXIS_LEFT_Y;
|
||||||
|
case 2: a = GAMEPAD_AXIS_RIGHT_X;
|
||||||
|
case 3: a = GAMEPAD_AXIS_RIGHT_X;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
// Poll (store) all input events
|
// Poll (store) all input events
|
||||||
static void PollInputEvents(void)
|
static void PollInputEvents(void)
|
||||||
{
|
{
|
||||||
|
@ -3232,6 +3323,10 @@ static void PollInputEvents(void)
|
||||||
case UWP_MSG_SET_GAMEPAD_AXIS:
|
case UWP_MSG_SET_GAMEPAD_AXIS:
|
||||||
{
|
{
|
||||||
if ((msg->paramInt0 < MAX_GAMEPADS) && (msg->paramInt1 < MAX_GAMEPAD_AXIS)) gamepadAxisState[msg->paramInt0][msg->paramInt1] = msg->paramFloat0;
|
if ((msg->paramInt0 < MAX_GAMEPADS) && (msg->paramInt1 < MAX_GAMEPAD_AXIS)) gamepadAxisState[msg->paramInt0][msg->paramInt1] = msg->paramFloat0;
|
||||||
|
|
||||||
|
// Register buttons for 2nd triggers
|
||||||
|
currentGamepadState[msg->paramInt0][GAMEPAD_BUTTON_LEFT_TRIGGER_2] = (char)(gamepadAxisState[msg->paramInt0][GAMEPAD_AXIS_LEFT_TRIGGER] > 0.1);
|
||||||
|
currentGamepadState[msg->paramInt0][GAMEPAD_BUTTON_RIGHT_TRIGGER_2] = (char)(gamepadAxisState[msg->paramInt0][GAMEPAD_AXIS_RIGHT_TRIGGER] > 0.1);
|
||||||
} break;
|
} break;
|
||||||
case UWP_MSG_SET_DISPLAY_DIMS:
|
case UWP_MSG_SET_DISPLAY_DIMS:
|
||||||
{
|
{
|
||||||
|
@ -3295,7 +3390,7 @@ static void PollInputEvents(void)
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
// Check if gamepads are ready
|
// Check if gamepads are ready
|
||||||
// NOTE: We do it here in case of disconection
|
// NOTE: We do it here in case of disconnection
|
||||||
for (int i = 0; i < MAX_GAMEPADS; i++)
|
for (int i = 0; i < MAX_GAMEPADS; i++)
|
||||||
{
|
{
|
||||||
if (glfwJoystickPresent(i)) gamepadReady[i] = true;
|
if (glfwJoystickPresent(i)) gamepadReady[i] = true;
|
||||||
|
@ -3312,33 +3407,37 @@ static void PollInputEvents(void)
|
||||||
|
|
||||||
// Get current gamepad state
|
// Get current gamepad state
|
||||||
// NOTE: There is no callback available, so we get it manually
|
// NOTE: There is no callback available, so we get it manually
|
||||||
const unsigned char *buttons;
|
// Get remapped buttons
|
||||||
int buttonsCount;
|
GLFWgamepadstate state;
|
||||||
|
glfwGetGamepadState(i, &state); // This remapps all gamepads so they have their buttons mapped like an xbox controller
|
||||||
|
const unsigned char *buttons = state.buttons;
|
||||||
|
|
||||||
buttons = glfwGetJoystickButtons(i, &buttonsCount);
|
for (int k = 0; (buttons != NULL) && (k < GLFW_GAMEPAD_BUTTON_DPAD_LEFT + 1) && (k < MAX_GAMEPAD_BUTTONS); k++)
|
||||||
|
|
||||||
for (int k = 0; (buttons != NULL) && (k < buttonsCount) && (buttonsCount < MAX_GAMEPAD_BUTTONS); k++)
|
|
||||||
{
|
{
|
||||||
|
const GamepadButton button = GetGamepadButton(k);
|
||||||
|
|
||||||
if (buttons[k] == GLFW_PRESS)
|
if (buttons[k] == GLFW_PRESS)
|
||||||
{
|
{
|
||||||
currentGamepadState[i][k] = 1;
|
currentGamepadState[i][button] = 1;
|
||||||
lastGamepadButtonPressed = k;
|
lastGamepadButtonPressed = button;
|
||||||
}
|
}
|
||||||
else currentGamepadState[i][k] = 0;
|
else currentGamepadState[i][button] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current axis state
|
// Get current axis state
|
||||||
const float *axes;
|
const float *axes = state.axes;
|
||||||
int axisCount = 0;
|
|
||||||
|
|
||||||
axes = glfwGetJoystickAxes(i, &axisCount);
|
for (int k = 0; (axes != NULL) && (k < GLFW_GAMEPAD_AXIS_LAST + 1) && (k < MAX_GAMEPAD_AXIS); k++)
|
||||||
|
|
||||||
for (int k = 0; (axes != NULL) && (k < axisCount) && (k < MAX_GAMEPAD_AXIS); k++)
|
|
||||||
{
|
{
|
||||||
gamepadAxisState[i][k] = axes[k];
|
const GamepadAxis axis = GetGamepadAxis(k);
|
||||||
|
gamepadAxisState[i][axis] = axes[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
gamepadAxisCount = axisCount;
|
// Register buttons for 2nd triggers (because GLFW doesn't count these as buttons but rather axis)
|
||||||
|
currentGamepadState[i][GAMEPAD_BUTTON_LEFT_TRIGGER_2] = (char)(gamepadAxisState[i][GAMEPAD_AXIS_LEFT_TRIGGER] > 0.1);
|
||||||
|
currentGamepadState[i][GAMEPAD_BUTTON_RIGHT_TRIGGER_2] = (char)(gamepadAxisState[i][GAMEPAD_AXIS_RIGHT_TRIGGER] > 0.1);
|
||||||
|
|
||||||
|
gamepadAxisCount = GLFW_GAMEPAD_AXIS_LAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3372,12 +3471,13 @@ static void PollInputEvents(void)
|
||||||
// Register buttons data for every connected gamepad
|
// Register buttons data for every connected gamepad
|
||||||
for (int j = 0; (j < gamepadState.numButtons) && (j < MAX_GAMEPAD_BUTTONS); j++)
|
for (int j = 0; (j < gamepadState.numButtons) && (j < MAX_GAMEPAD_BUTTONS); j++)
|
||||||
{
|
{
|
||||||
|
const GamepadButton button = GetGamepadButton(j);
|
||||||
if (gamepadState.digitalButton[j] == 1)
|
if (gamepadState.digitalButton[j] == 1)
|
||||||
{
|
{
|
||||||
currentGamepadState[i][j] = 1;
|
currentGamepadState[i][button] = 1;
|
||||||
lastGamepadButtonPressed = j;
|
lastGamepadButtonPressed = button;
|
||||||
}
|
}
|
||||||
else currentGamepadState[i][j] = 0;
|
else currentGamepadState[i][button] = 0;
|
||||||
|
|
||||||
//TraceLog(LOG_DEBUG, "Gamepad %d, button %d: Digital: %d, Analog: %g", gamepadState.index, j, gamepadState.digitalButton[j], gamepadState.analogButton[j]);
|
//TraceLog(LOG_DEBUG, "Gamepad %d, button %d: Digital: %d, Analog: %g", gamepadState.index, j, gamepadState.digitalButton[j], gamepadState.analogButton[j]);
|
||||||
}
|
}
|
||||||
|
@ -3385,7 +3485,8 @@ static void PollInputEvents(void)
|
||||||
// Register axis data for every connected gamepad
|
// Register axis data for every connected gamepad
|
||||||
for (int j = 0; (j < gamepadState.numAxes) && (j < MAX_GAMEPAD_AXIS); j++)
|
for (int j = 0; (j < gamepadState.numAxes) && (j < MAX_GAMEPAD_AXIS); j++)
|
||||||
{
|
{
|
||||||
gamepadAxisState[i][j] = gamepadState.axis[j];
|
const GamepadAxis axis = GetGamepadAxis(j);
|
||||||
|
gamepadAxisState[i][axis] = gamepadState.axis[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
gamepadAxisCount = gamepadState.numAxes;
|
gamepadAxisCount = gamepadState.numAxes;
|
||||||
|
|
120
src/raylib.h
120
src/raylib.h
|
@ -619,83 +619,57 @@ typedef enum {
|
||||||
GAMEPAD_PLAYER4 = 3
|
GAMEPAD_PLAYER4 = 3
|
||||||
} GamepadNumber;
|
} GamepadNumber;
|
||||||
|
|
||||||
// PS3 USB Controller Buttons
|
// Gamepad Buttons
|
||||||
// TODO: Provide a generic way to list gamepad controls schemes,
|
typedef enum
|
||||||
// defining specific controls schemes is not a good option
|
{
|
||||||
typedef enum {
|
// This is here just for error checking
|
||||||
GAMEPAD_PS3_BUTTON_TRIANGLE = 0,
|
GAMEPAD_BUTTON_UNKNOWN = 0,
|
||||||
GAMEPAD_PS3_BUTTON_CIRCLE = 1,
|
|
||||||
GAMEPAD_PS3_BUTTON_CROSS = 2,
|
|
||||||
GAMEPAD_PS3_BUTTON_SQUARE = 3,
|
|
||||||
GAMEPAD_PS3_BUTTON_L1 = 6,
|
|
||||||
GAMEPAD_PS3_BUTTON_R1 = 7,
|
|
||||||
GAMEPAD_PS3_BUTTON_L2 = 4,
|
|
||||||
GAMEPAD_PS3_BUTTON_R2 = 5,
|
|
||||||
GAMEPAD_PS3_BUTTON_START = 8,
|
|
||||||
GAMEPAD_PS3_BUTTON_SELECT = 9,
|
|
||||||
GAMEPAD_PS3_BUTTON_PS = 12,
|
|
||||||
GAMEPAD_PS3_BUTTON_UP = 24,
|
|
||||||
GAMEPAD_PS3_BUTTON_RIGHT = 25,
|
|
||||||
GAMEPAD_PS3_BUTTON_DOWN = 26,
|
|
||||||
GAMEPAD_PS3_BUTTON_LEFT = 27
|
|
||||||
} GamepadPS3Button;
|
|
||||||
|
|
||||||
// PS3 USB Controller Axis
|
// This is normally ABXY/Circle, Triangle, Square, Cross. No support for 6 button controllers though..
|
||||||
typedef enum {
|
GAMEPAD_BUTTON_LEFT_FACE_UP,
|
||||||
GAMEPAD_PS3_AXIS_LEFT_X = 0,
|
GAMEPAD_BUTTON_LEFT_FACE_RIGHT,
|
||||||
GAMEPAD_PS3_AXIS_LEFT_Y = 1,
|
GAMEPAD_BUTTON_LEFT_FACE_DOWN,
|
||||||
GAMEPAD_PS3_AXIS_RIGHT_X = 2,
|
GAMEPAD_BUTTON_LEFT_FACE_LEFT,
|
||||||
GAMEPAD_PS3_AXIS_RIGHT_Y = 5,
|
|
||||||
GAMEPAD_PS3_AXIS_L2 = 3, // [1..-1] (pressure-level)
|
// This is normally a DPAD
|
||||||
GAMEPAD_PS3_AXIS_R2 = 4 // [1..-1] (pressure-level)
|
GAMEPAD_BUTTON_RIGHT_FACE_UP,
|
||||||
} GamepadPS3Axis;
|
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT,
|
||||||
|
GAMEPAD_BUTTON_RIGHT_FACE_DOWN,
|
||||||
|
GAMEPAD_BUTTON_RIGHT_FACE_LEFT,
|
||||||
|
|
||||||
// Xbox360 USB Controller Buttons
|
// Triggers
|
||||||
typedef enum {
|
GAMEPAD_BUTTON_LEFT_TRIGGER_1,
|
||||||
GAMEPAD_XBOX_BUTTON_A = 0,
|
GAMEPAD_BUTTON_LEFT_TRIGGER_2,
|
||||||
GAMEPAD_XBOX_BUTTON_B = 1,
|
GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
|
||||||
GAMEPAD_XBOX_BUTTON_X = 2,
|
GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
|
||||||
GAMEPAD_XBOX_BUTTON_Y = 3,
|
|
||||||
GAMEPAD_XBOX_BUTTON_LB = 4,
|
|
||||||
GAMEPAD_XBOX_BUTTON_RB = 5,
|
|
||||||
GAMEPAD_XBOX_BUTTON_SELECT = 6,
|
|
||||||
GAMEPAD_XBOX_BUTTON_START = 7,
|
|
||||||
GAMEPAD_XBOX_BUTTON_HOME = 8,
|
|
||||||
GAMEPAD_XBOX_BUTTON_UP = 10,
|
|
||||||
GAMEPAD_XBOX_BUTTON_RIGHT = 11,
|
|
||||||
GAMEPAD_XBOX_BUTTON_DOWN = 12,
|
|
||||||
GAMEPAD_XBOX_BUTTON_LEFT = 13
|
|
||||||
} GamepadXbox360Button;
|
|
||||||
|
|
||||||
// Xbox360 USB Controller Axis,
|
// These are buttons in the center of the gamepad
|
||||||
// NOTE: For Raspberry Pi, axis must be reconfigured
|
GAMEPAD_BUTTON_MIDDLE_LEFT, //PS3 Select
|
||||||
typedef enum {
|
GAMEPAD_BUTTON_MIDDLE, //PS Button/XBOX Button
|
||||||
GAMEPAD_XBOX_AXIS_LEFT_X = 0, // [-1..1] (left->right)
|
GAMEPAD_BUTTON_MIDDLE_RIGHT, //PS3 Start
|
||||||
GAMEPAD_XBOX_AXIS_LEFT_Y = 1, // [1..-1] (up->down)
|
|
||||||
GAMEPAD_XBOX_AXIS_RIGHT_X = 2, // [-1..1] (left->right)
|
|
||||||
GAMEPAD_XBOX_AXIS_RIGHT_Y = 3, // [1..-1] (up->down)
|
|
||||||
GAMEPAD_XBOX_AXIS_LT = 4, // [-1..1] (pressure-level)
|
|
||||||
GAMEPAD_XBOX_AXIS_RT = 5 // [-1..1] (pressure-level)
|
|
||||||
} GamepadXbox360Axis;
|
|
||||||
|
|
||||||
// Android Gamepad Controller (SNES CLASSIC)
|
// These are the joystick press in buttons
|
||||||
typedef enum {
|
GAMEPAD_BUTTON_LEFT_THUMB,
|
||||||
GAMEPAD_ANDROID_DPAD_UP = 19,
|
GAMEPAD_BUTTON_RIGHT_THUMB
|
||||||
GAMEPAD_ANDROID_DPAD_DOWN = 20,
|
} GamepadButton;
|
||||||
GAMEPAD_ANDROID_DPAD_LEFT = 21,
|
|
||||||
GAMEPAD_ANDROID_DPAD_RIGHT = 22,
|
typedef enum
|
||||||
GAMEPAD_ANDROID_DPAD_CENTER = 23,
|
{
|
||||||
GAMEPAD_ANDROID_BUTTON_A = 96,
|
// This is here just for error checking
|
||||||
GAMEPAD_ANDROID_BUTTON_B = 97,
|
GAMEPAD_AXIS_UNKNOWN = 0,
|
||||||
GAMEPAD_ANDROID_BUTTON_C = 98,
|
|
||||||
GAMEPAD_ANDROID_BUTTON_X = 99,
|
// Left stick
|
||||||
GAMEPAD_ANDROID_BUTTON_Y = 100,
|
GAMEPAD_AXIS_LEFT_X,
|
||||||
GAMEPAD_ANDROID_BUTTON_Z = 101,
|
GAMEPAD_AXIS_LEFT_Y,
|
||||||
GAMEPAD_ANDROID_BUTTON_L1 = 102,
|
|
||||||
GAMEPAD_ANDROID_BUTTON_R1 = 103,
|
// Right stick
|
||||||
GAMEPAD_ANDROID_BUTTON_L2 = 104,
|
GAMEPAD_AXIS_RIGHT_X,
|
||||||
GAMEPAD_ANDROID_BUTTON_R2 = 105
|
GAMEPAD_AXIS_RIGHT_Y,
|
||||||
} GamepadAndroid;
|
|
||||||
|
// Pressure levels for the back triggers
|
||||||
|
GAMEPAD_AXIS_LEFT_TRIGGER, // [1..-1] (pressure-level)
|
||||||
|
GAMEPAD_AXIS_RIGHT_TRIGGER // [1..-1] (pressure-level)
|
||||||
|
} GamepadAxis;
|
||||||
|
|
||||||
// Shader location point type
|
// Shader location point type
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue