Ryan C. Gordon
3ff618a9c7
Cleanups in the joystick code.
...
Removed some redundant state and other confusions.
Fixes Bugzilla #2738 .
--HG--
extra : rebase_source : 35dd561553379e00eb8d169ce12ecc99393b2f84
2015-03-24 13:52:01 -04:00
Sam Lantinga
dc434901da
Fixed bug 2553 - Add support to all XInput devices
...
This adds support for all XInput devices, exposed through the SDL joystick API.
The button and axis reporting for XInput devices has been changed to match DirectInput and other platforms.
The game controller xinput mapping has been updated so this change is seamless.
There is a new hint, SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, for any applications that have hardcoded the old xinput button and axis set. This hint will be removed in SDL 2.1.
2014-06-24 13:31:25 -07:00
Sam Lantinga
229d08177a
You shouldn't get axis and hat events when your application doesn't have focus (unless you use the SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint)
2014-06-21 21:30:49 -07:00
Ryan C. Gordon
fbdde501ba
Removed SDL_SYS_JoystickNeedsPolling().
...
It was simpler to just have the polling (actually: hotplug detection)
functions return immediately if it's not an appropriate time to poll.
Note that previously, if any joystick/controller was opened, we would poll
every time anyhow, skipping this function.
2014-06-14 23:31:23 -04:00
Sam Lantinga
d7940a513e
Fixed bug 2374 - Update copyright for 2014...
...
Is it that time already??
2014-02-02 00:53:27 -08:00
Ryan C. Gordon
82edee6971
Make internal SDL sources include SDL_internal.h instead of SDL_config.h
...
The new header will include SDL_config.h, but allows for other global stuff.
--HG--
extra : rebase_source : ddf4a4c0dc2c554b98c82700798f343cd91b16e3
2013-11-24 23:56:17 -05:00
Sam Lantinga
de2ea4b8e8
Fixed signed/unsigned warning
2013-11-09 01:08:21 -08:00
Sam Lantinga
20e65317fa
Fixed some warnings building for 64-bit Windows
2013-10-21 01:16:16 -07:00
Sam Lantinga
ff55c5a474
Check for NULL joystick in SDL_JoystickGetGUID()
2013-10-06 13:49:23 -07:00
Jørgen P. Tjernø
70519db239
Fix to buffer overrun in SDL_JoystickGetGUIDString().
2013-09-05 15:49:57 -07:00
Sam Lantinga
08dfaaa2e6
Christoph Mallon: Remove pointless if (x) before SDL_free(x)
2013-08-29 08:29:21 -07:00
Gabriel Jacobo
271e0d67c4
OCD fixes: Adds a space before */
2013-08-21 09:43:09 -03:00
Gabriel Jacobo
25c9f2cd30
Fixes a few non C89 compliant comments
2013-08-20 19:49:24 -03:00
Philipp Wiesemann
e3b9fb7542
Corrected internal documentation in source.
2013-07-22 22:54:00 +02:00
Sam Lantinga
6956070880
Added a hint to control the Windows timer resolution: SDL_HINT_TIMER_RESOLUTION
...
Added an API to watch hint changes: SDL_AddHintCallback(), SDL_DelHintCallback()
You can now dynamically set the joystick background event hint.
2013-07-13 03:13:41 -07:00
Sam Lantinga
156a8638f0
Make it possible to use SDL events separately from the video subsystem.
2013-07-06 12:28:57 -07:00
Sam Lantinga
563185f19c
Only check for keyboard focus if the video subsystem was initialized.
...
Check the hint at initialization time, as an optimization. This isn't something we expect the application to change at runtime, and if it is we should add an API for it.
2013-06-28 23:29:13 -07:00
Sam Lantinga
5aa3492ef8
Fixed SDL building with the minimal configuration
2013-06-13 22:10:10 -07:00
Sam Lantinga
612ec5d29d
Slightly more efficient to check the event type first
2013-06-07 09:39:10 -07:00
Sam Lantinga
6879bf00c4
Fixed crash trying to get the GUID of an invalid joystick index
2013-06-06 18:20:06 -07:00
Jørgen P. Tjernø
e1e1fa3d61
Joystick: Only send joy events when focused.
...
This changes makes it so that you only receive joystick (and implicitly
gamecontroller) input events when your application has keyboard focus.
If you'd like to still receive events when your application is in the
background, set the SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS hint to "1".
This fixes http://bugzilla.libsdl.org/show_bug.cgi?id=1892
2013-06-05 15:11:38 -07:00
Sam Lantinga
0cb6385637
File style cleanup for the SDL 2.0 release
2013-05-18 14:17:52 -07:00
VALVE\alfred@alfredlinux.valvesoftware.com
3bf28ba7c8
- make sure to send a joy removed event even if the joystick wasn't opened under OSX
2013-04-22 15:24:35 -07:00
Ryan C. Gordon
4f438b70a2
Make SDL_SetError and friends unconditionally return -1.
...
This lets us change things like this...
if (Failed) {
SDL_SetError("We failed");
return -1;
}
...into this...
if (Failed) {
return SDL_SetError("We failed");
}
Fixes Bugzilla #1778 .
2013-03-31 12:48:50 -04:00
Sam Lantinga
95dcfa4c28
Happy New Year!
2013-02-15 08:47:44 -08:00
Sam Lantinga
80493dfae0
Only check SDL_SYS_JoystickNeedsPolling() if we know we don't need to poll for other reasons. This avoids a select() syscall on Linux if it isn't necessary.
2012-12-14 09:22:13 -08:00
Ryan C. Gordon
7cb9995377
Minor sanity checking and tweaks in SDL_JoystickGetGUIDString().
2012-12-11 18:46:09 -05:00
Sam Lantinga
89ef9e3168
Changes from Alfred:
...
- rename JoystickGUID -> SDL_JoystickGUID
- change SDL_JoystickGetGUIDString to take the string as an arg, rather than doing a malloc
2012-12-11 11:54:32 -08:00
Sam Lantinga
5417afcf11
Don't spam events if the axis values haven't changed
2012-12-11 10:49:54 -08:00
Sam Lantinga
556c764047
Fixed crashes in new joystick code
2012-11-28 11:52:38 -08:00
Sam Lantinga
03e08a6a79
Organized joystick hotplug code a bit.
...
Cleaned up names, return types, etc.
2012-11-27 00:58:12 -08:00
Sam Lantinga
968ccf93b1
Fixed iOS joystick support for new API
2012-11-26 21:11:28 -08:00
Sam Lantinga
34b88dfaae
Added hotplug joystick support and simplified game controller API, courtesy of Alfred Reynolds
2012-11-26 16:37:54 -08:00
Sam Lantinga
f380ecb137
Removed executable bit from source files
2012-09-27 14:35:28 -07:00
Sam Lantinga
5ef6f8e30f
Fixed bug 1337 - joystick crash due to heap corruption with btnx
2012-01-01 16:58:00 -05:00
Sam Lantinga
028e5dcdbd
Happy New Year!
2011-12-31 09:28:07 -05:00
Sam Lantinga
29177954e7
It works better if you compile it.
2011-11-29 02:28:34 -05:00
Sam Lantinga
f98e88676c
Better fix, iterate backwards over the array so we don't care whether the close code shuffles things down.
2011-11-29 02:27:34 -05:00
Sam Lantinga
22e0d6fa53
Closing the joystick removes it from the list.
2011-11-29 02:15:39 -05:00
Sam Lantinga
10823d6065
Invalid assert. It's perfectly legit to initialize the joystick subsystem and get no joysticks.
2011-11-29 02:12:24 -05:00
Ryan C. Gordon
33981bc8ba
Patched to compile.
2011-09-01 14:02:12 -04:00
Ryan C. Gordon
af022f47ed
Removed unused variable.
2011-09-01 04:34:05 -04:00
Ryan C. Gordon
6b4a7b19a4
Clean up any opened joysticks during SDL_JoystickQuit().
...
Otherwise, these leak memory and maybe operating system handles.
2011-09-01 04:25:15 -04:00
Sam Lantinga
b0660ba5ff
SDL 1.3 is now under the zlib license.
2011-04-08 13:03:26 -07:00
Sam Lantinga
e5803d148c
Happy 2011! :)
2011-02-11 22:37:15 -08:00
Sam Lantinga
c3daf0f0cd
Removed completely non-portable event thread hack.
...
Next I'll be working on generalizing the event sources and making the event queue lock-free. :)
2011-01-27 22:44:08 -08:00
Sam Lantinga
1fb2a69487
General improvements for user custom event registration
...
* Switched event type to enum (int32)
* Switched polling by mask to polling by type range
* Added SDL_RegisterEvents() to allow dynamic user event registration
* Spread events out to allow inserting new related events without breaking binary compatibility
* Added padding to event structures so they're the same size regardless of 32-bit compiler structure packing settings
* Split SDL_HasEvent() to SDL_HasEvent() for a single event and SDL_HasEvents() for a range of events
* Added SDL_GetEventState() as a shortcut for SDL_EventState(X, SDL_QUERY)
* Added SDL_FlushEvent() and SDL_FlushEvents() to clear events from the event queue
2010-03-25 01:08:26 -07:00
Sam Lantinga
4d3df8b3e3
Fixed bug #926
...
Updated copyright to LGPL version 2.1 and year 2010
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404453
2010-01-24 21:10:53 +00:00
Ryan C. Gordon
516aaa5d6c
Merged r3787:3788 from branches/SDL-1.2: better failures for joystick opening.
...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404358
2010-01-06 06:40:16 +00:00
Sam Lantinga
5575687744
Debian patch: 218_joystick_memmove.diff
...
--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404032
2009-10-10 10:02:17 +00:00