| 2556 | } |
| 2557 | |
| 2558 | void ControllerButtonEvent(SDL_ControllerButtonEvent event) |
| 2559 | { |
| 2560 | // map controller buttons to keyboard keys |
| 2561 | if (event.type == SDL_CONTROLLERBUTTONDOWN) |
| 2562 | { |
| 2563 | InputKeyboardDown(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0); |
| 2564 | InputArrowKeysDown(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0); |
| 2565 | |
| 2566 | if (event.button == SDL_CONTROLLER_BUTTON_LEFT_TRIGGER) |
| 2567 | { |
| 2568 | // Handle picking events using the game controller |
| 2569 | g_lastx = g_screenWidth / 2; |
| 2570 | g_lasty = g_screenHeight / 2; |
| 2571 | g_lastb = 1; |
| 2572 | |
| 2573 | // record that we need to update the picked particle |
| 2574 | g_mousePicked = true; |
| 2575 | } |
| 2576 | } |
| 2577 | else |
| 2578 | { |
| 2579 | InputKeyboardUp(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0); |
| 2580 | InputArrowKeysUp(GetKeyFromGameControllerButton(SDL_GameControllerButton(event.button)), 0, 0); |
| 2581 | |
| 2582 | if (event.button == SDL_CONTROLLER_BUTTON_LEFT_TRIGGER) |
| 2583 | { |
| 2584 | // Handle picking events using the game controller |
| 2585 | g_lastx = g_screenWidth / 2; |
| 2586 | g_lasty = g_screenHeight / 2; |
| 2587 | g_lastb = -1; |
| 2588 | } |
| 2589 | } |
| 2590 | } |
| 2591 | |
| 2592 | void ControllerDeviceUpdate() |
| 2593 | { |
no test coverage detected