summaryrefslogtreecommitdiff
path: root/test/testgamecontroller.c
Commit message (Collapse)AuthorAgeFilesLines
* testgamecontroller: log which controller the event came fromSam Lantinga2021-01-131-4/+6
|
* Updated copyright for 2021Sam Lantinga2021-01-021-1/+1
|
* Enable PS5 enhanced functionality for testgamecontrollerSam Lantinga2020-12-221-0/+1
|
* Set the pad lights on the PS5 controller corresponding to the player indexSam Lantinga2020-12-221-0/+8
| | | | Also allow setting the player index from testgamecontroller using the number keys
* Allow background input when testing game controllersSam Lantinga2020-12-041-0/+1
|
* Remember to close the game controller when we're done with itSam Lantinga2020-11-271-0/+2
|
* Open and test all connected controllersSam Lantinga2020-11-271-71/+155
|
* Some controllers don't always reset their triggers to zero when they are ↵Sam Lantinga2020-11-251-6/+8
| | | | released (e.g. Xbox One S in Bluetooth mode), so only trigger rumble if the trigger is pulled halfway or more.
* Automatically switch to testing a new controller when it's plugged inSam Lantinga2020-11-241-8/+10
|
* Allow testing a specific controllerSam Lantinga2020-11-231-0/+4
|
* Allow testing effects on PS4 controllersSam Lantinga2020-11-211-0/+1
| | | | Note, this will switch the controller into advanced report mode which breaks DirectInput on Windows
* Added API for sensors on game controllersSam Lantinga2020-11-171-19/+54
| | | | | | Added support for the PS4 controller gyro and accelerometer on iOS and HIDAPI drivers Also fixed an issue with the accelerometer on iOS having inverted axes
* Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial()Sam Lantinga2020-11-161-1/+7
|
* Improve LED color calculation, don't set LED unless left thumbstick is movedSam Lantinga2020-11-161-5/+22
|
* Added support for the touchpad on PS4 and PS5 controllersSam Lantinga2020-11-131-1/+17
|
* Fixed overflow in trigger rumble calculationSam Lantinga2020-11-121-1/+1
|
* Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers()Sam Lantinga2020-11-111-0/+21
|
* Be explicit about mapping the new game controller paddle buttonsSam Lantinga2020-11-071-48/+62
|
* Don't try to map the accelerometer as a game controllerSam Lantinga2020-11-061-0/+2
|
* iOS should use the same size window for the controller tests as other platformsSam Lantinga2020-11-061-5/+0
| | | | Otherwise the position of the button and axis elements won't be correct
* Added 4 auxiliary buttons to the game controller APISam Lantinga2020-11-061-0/+4
| | | | | | Xbox Elite controllers use AUX1-AUX4 to represent the paddle buttons when using the HIDAPI driver PS4 and PS5 controllers use AUX1 to represent the touchpad button Nintendo Switch Pro controllers use AUX1 to represent the capture button
* Added SDL_JoystickHasLEDSam Lantinga2020-11-051-0/+12
| | | | Currently, this is only supported by the PS4 HIDAPI driver.
* Added a Windows Gaming Input joystick driverSam Lantinga2020-04-181-161/+119
| | | | | | | | | This driver supports the Razer Atrox Arcade Stick Some of the quirks of this driver, inherent in Windows Gaming Input: * There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers. * You can't read the state of the guide button * You can't get controller events in the background
* Removed debug codeSam Lantinga2020-04-081-2/+0
|
* Fixed memory leak and removed debug code from Windows sensor implementationSam Lantinga2020-04-081-0/+2
|
* Fixed bug 5028 - Virtual Joysticks (new joystick backend)Sam Lantinga2020-03-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | David Ludwig I have created a new driver for SDL's Joystick and Game-Controller subsystem: a Virtual driver. This driver allows one to create a software-based joystick, which to SDL applications will look and react like a real joystick, but whose state can be set programmatically. A primary use case for this is to help enable developers to add touch-screen joysticks to their apps. The driver comes with a set of new, public APIs, with functions to attach and detach joysticks, set virtual-joystick state, and to determine if a joystick is a virtual-one. Use of virtual joysticks goes as such: 1. Attach one or more virtual joysticks by calling SDL_JoystickAttachVirtual. If successful, this returns the virtual-device's joystick-index. 2. Open the virtual joysticks (using indicies returned by SDL_JoystickAttachVirtual). 3. Call any of the SDL_JoystickSetVirtual* functions when joystick-state changes. Please note that virtual-joystick state will only get applied on the next call to SDL_JoystickUpdate, or when pumping or polling for SDL events (via SDL_PumpEvents or SDL_PollEvent). Here is a listing of the new, public APIs, at present and subject to change: ------------------------------------------------------------ /** * Attaches a new virtual joystick. * Returns the joystick's device index, or -1 if an error occurred. */ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nballs, int nbuttons, int nhats); /** * Detaches a virtual joystick * Returns 0 on success, or -1 if an error occurred. */ extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index); /** * Indicates whether or not a virtual-joystick is at a given device index. */ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index); /** * Set values on an opened, virtual-joystick's controls. * Returns 0 on success, -1 on error. */ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value); extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel); extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value); extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value); ------------------------------------------------------------ Miscellaneous notes on the initial patch, which are also subject to change: 1. no test code is present in SDL, yet. This should, perhaps, change. Initial development was done with an ImGui-based app, which potentially is too thick for use in SDL-official. If tests are to be added, what kind of tests? Automated? Graphical? 2. virtual game controllers can be created by calling SDL_JoystickAttachVirtual with a joystick-type of SDL_JOYSTICK_TYPE_GAME_CONTROLLER, with naxes (num axes) set to SDL_CONTROLLER_AXIS_MAX, and with nbuttons (num buttons) set to SDL_CONTROLLER_BUTTON_MAX. When updating their state, values of type SDL_GameControllerAxis or SDL_GameControllerButton can be casted to an int and used for the control-index (in calls to SDL_JoystickSetVirtual* functions). 3. virtual joysticks' guids are mostly all-zeros with the exception of the last two bytes, the first of which is a 'v', to indicate that the guid is a virtual one, and the second of which is a SDL_JoystickType that has been converted into a Uint8. 4. virtual joysticks are ONLY turned into virtual game-controllers if and when their joystick-type is set to SDL_JOYSTICK_TYPE_GAMECONTROLLER. This is controlled by having SDL's default list of game-controllers have a single entry for a virtual game controller (of guid, "00000000000000000000000000007601", which is subject to the guid-encoding described above). 5. regarding having to call SDL_JoystickUpdate, either directly or indirectly via SDL_PumpEvents or SDL_PollEvents, before new virtual-joystick state becomes active (as specified via SDL_JoystickSetVirtual* function-calls), this was done to match behavior found in SDL's other joystick drivers, almost all of which will only update SDL-state during SDL_JoystickUpdate. 6. the initial patch is based off of SDL 2.0.12 7. the virtual joystick subsystem is disabled by default. It should be possible to enable it by building with SDL_JOYSTICK_VIRTUAL=1 Questions, comments, suggestions, or bug reports very welcome!
* Use the triggers to test rumble for more fine grained vibration feedbackSam Lantinga2020-02-071-5/+7
|
* Updated copyright date for 2020Sam Lantinga2020-01-161-1/+1
|
* Automatically assign player indexes to game controllers, and allow changing ↵Sam Lantinga2019-12-201-2/+2
| | | | | | the player index for game controllers and joysticks. Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
* Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to ↵Sam Lantinga2019-11-221-1/+20
| | | | return the type of controller attached.
* test: replace some exit()s with returns.Ozkan Sezer2019-09-101-1/+1
|
* Updated copyright for 2019Sam Lantinga2019-01-041-1/+1
|
* Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and ↵Sam Lantinga2018-08-091-0/+5
| | | | | | Nintendo Switch Pro controller support across platforms. Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
* Updated copyright for 2018Sam Lantinga2018-01-031-1/+1
|
* Updated copyright for 2017Sam Lantinga2017-01-011-1/+1
|
* Fixed compiling of testgamecontroller program with C++.Philipp Wiesemann2016-12-281-2/+2
|
* Split controller axes into positive and negative sides so each can be bound ↵Sam Lantinga2016-12-271-10/+13
| | | | | | | independently. Using this a D-Pad can be mapped to a thumbstick and vice versa. Also added support for inverted axes, improving trigger binding support
* Only print out the controller mappings if we're not going to test a controllerSam Lantinga2016-12-091-7/+9
|
* Added an API to iterate over game controller mappingsSam Lantinga2016-11-291-0/+11
|
* Added USB VID/PID information to the SDL test programsSam Lantinga2016-11-101-1/+5
|
* Fixed black screen on Steam LinkSam Lantinga2016-10-131-1/+1
|
* Fixed compiling of three test programs with C++.Philipp Wiesemann2016-09-211-4/+4
|
* Fixed memory leak in game controller test program.Philipp Wiesemann2016-05-051-0/+2
|
* Updated copyright to 2016Sam Lantinga2016-01-021-1/+1
|
* Replaced tabs with spaces in test programs.Philipp Wiesemann2015-11-251-2/+2
|
* Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().Ryan C. Gordon2015-11-141-0/+8
|
* Added initial support for MFi game controllers on iOS.Alex Szpakowski2015-09-201-2/+2
|
* Updated the copyright year to 2015Sam Lantinga2015-05-261-1/+1
|
* Removed redundant NULL check in test program.Philipp Wiesemann2015-05-211-4/+2
|
* Added missing loop cancel for Emscripten in test programs.Philipp Wiesemann2015-05-181-0/+6
|