Commit Graph

104 Commits

Author SHA1 Message Date
Alex Szpakowski 7e271fc53e Use SDL's rumble APIs for Joystick:setVibration, when available.
Fixes #1756
2021-12-11 11:52:42 -04:00
Alex Szpakowski f89aabb0bb Update copyright year for 2021 2021-04-04 16:14:45 -03:00
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski 33bc8aabfc Add Joystick:getGamepadMappingString and love.joystick.getGamepadMappingString(guid). Resolves issue #1371. 2019-09-15 14:02:19 -03:00
Alex Szpakowski aca979c3ea Add Joystick:getDeviceInfo(). Returns USB vendor id, product id, and product version numbers (consistent across operating systems).
Can be used to show different icons, etc. for different gamepads.
2019-06-29 21:01:17 -03:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Alex Szpakowski c8d2d76df7 Work around a compiler bug in old versions of VS2013 (resolves issue #1458). 2018-12-12 11:26:14 -04:00
enra64 3ed404388b fixed not being able to remap gamepads by resolving problem with re-initializing joysticks as gamepads 2017-09-16 09:30:46 +02:00
Bart van Strien 571503c02e Don't use deprecated isFile in love.joystick.loadGamepadMappings (fixes #1391) 2018-04-04 17:49:51 +02:00
Alex Szpakowski 8e83834722 Use the joystick's name in new gamepad mappings, when possible. Resolves issue #1370. 2018-02-16 18:20:35 -04:00
Alex Szpakowski 53872d813a Don't error when love.joystick.loadGamepadMappings is given an empty string/file, since saveGamepadMappings can produce that. Resolves issue #1375. 2018-02-07 22:32:06 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Bart van Strien 9e4374935d Show (short) list of possible enum values when an invalid value is encountered (resolves #1318)
All enum errors have (hopefully) been changed to a luax_enumerror, which has a
fixed error message. If additionally a list of valid options is passed, it
lists that in the error message. For every enum error with few options I've
implemented this using a getConstants call.

This solution has been designed specifically to reduce the number of template
instantiations (as I've been told that was a concern). All new template code
happens in places where there already was an instantiation of the relevant
StringMap. Of course there is still std::vector<std::string>...

--HG--
branch : minor
2017-10-02 17:11:53 +02:00
Bart van Strien 7fa8fe7572 Fix replacement when using love.joystick.setGamepadMapping (issue #1298)
The broken find code would previously cause the (duplicate) key to be appended
to the end, now it successfully replaces the previous value

--HG--
branch : minor
2017-07-28 14:49:35 +02:00
Alex Szpakowski 34ebe18f14 Use luaL_check/optinteger instead of luaL_check/optnumber when getting integer arguments to functions. Resolves issue #1251.
--HG--
branch : minor
2017-07-16 12:17:50 -03:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski b620f32200 Work around SDL issues in Joystick:getGamepadMapping with XInput controllers (issue #1239).
This doesn’t fix the underlying issues in SDL so there may be other aspects of love.joystick which are still affected.

--HG--
branch : minor
2016-12-10 16:14:14 -04:00
Bart van Strien 9f6aa716fa Pass Type to luax_register_type by pointer instead of reference
Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference.

<Textmode> the best kind of behavior

--HG--
branch : dynamiccore2
2016-11-14 21:51:47 +01:00
Bart van Strien d967a755e5 Make love::Type handle type names
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type

--HG--
branch : dynamiccore2
2016-11-14 21:06:53 +01:00
Bart van Strien 5d43c9601a Automatically deduce the type in luax_pushtype, if possible
--HG--
branch : dynamiccore2
2016-11-13 17:38:42 +01:00
Bart van Strien 7dd960619d Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
--HG--
branch : dynamiccore2
2016-11-13 17:13:40 +01:00
Bart van Strien c761202486 Build type information on first use (load-time), instead of using a hardcoded list
--HG--
branch : dynamiccore2
2016-11-13 16:38:57 +01:00
Alex Szpakowski 327682d07f Add support for passing a table to love.mouse.isDown, love.keyboard.isDown, love.keyboard.isScancodeDown, Joystick:isDown, and Joystick:isGamepadDown. 2016-09-19 22:43:47 -03:00
Alex Szpakowski 46a2e7b85c Happy new year! 🎉 2016-01-01 00:05:06 -04:00
Alex Szpakowski 2c4e713114 Imported some of the dynamiccore branch from love-experiments:
- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.

- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.

Also removed most of the header declarations for wrapper functions.
2015-11-29 20:38:12 -04:00
Alex Szpakowski 4dbc11800e Hopefully fixed the Windows/VS2013 build. 2015-09-05 11:30:59 -03:00
Alex Szpakowski dc7cffe111 Fixed the color set by love.graphics.setColor not being restored properly when love.graphics.pop is called after love.graphics.push("all"). 2015-09-05 11:20:47 -03:00
Bart van Strien 3cb777e2b7 Add basic lua 5.3 support 2015-06-16 10:25:41 +02:00
Alex Szpakowski 0f986b10aa Cleaned up some code, the 'ry' parameter of love.graphics.rectangle now defaults to the value of 'rx' rather than defaulting to 0. 2015-05-27 17:36:27 -03:00
Alex Szpakowski cffa899e03 Explicitly mention SDL in the error message caused by SDL subsystem initialization failure. 2015-03-26 14:51:47 -03:00
Bart van Strien 715cab4f6f Fix love.joystick.setGamepadMapping suffix overwriting bug
Previously, if "leftx" was mapped before "x", the latter mapping would overwrite
the former, or in general if any mapping was a suffix of another, it needed to
be mapped first.
2015-03-15 15:53:48 +01:00
Alex Szpakowski 2f419c1c83 Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
--HG--
branch : minor
2015-03-01 18:32:41 -04:00
Alex Szpakowski 5932c39c86 Removed some redundant code.
--HG--
branch : minor
2015-02-21 21:54:13 -04:00
Alex Szpakowski ebc68023a7 Fix many warnings about implicit integer conversions when compiling for 64 bits.
--HG--
branch : minor
2015-02-20 01:20:08 -04:00
Alex Szpakowski c7b45b3505 Updated copyright for the new year 2014-12-31 19:32:43 -04:00
Alex Szpakowski 195d41d1d9 Ignore lines starting with "#" when parsing the mappings string given to love.joystick.loadGamepadMappings. 2014-11-03 16:34:18 -04:00
Alex Szpakowski 0d28135465 Fixed love.joystick.loadGamepadMappings to work properly if a FileData object is passed to it. 2014-11-03 16:24:28 -04:00
Alex Szpakowski b9271ed25a Don't throw an error if the mappings passed to love.joystick.loadGamepadMappings contain mappings for other platforms but no mappings for the currently running platform. 2014-11-03 16:19:47 -04:00
Alex Szpakowski e26abb417e Fixed indentation. 2014-08-27 01:04:58 -03:00
Alex Szpakowski 1e8c9e18c3 Fixed love.joystick.setGamepadMapping: the generated SDL controller mapping string is no longer invalid, and joystick hats are now properly converted to the SDL representation. 2014-08-27 00:58:42 -03:00
Alex Szpakowski da7cd267ea Changed luax_pushtype to retain the pushed object itself, but only if the object isn't in the Lua state already.
Previously, calling e.g. love.graphics.getFont() 10,000 times would retain the object 10,000 times (and release it 10,000 times when the Font object was garbage-collected in the Lua state.) Now it will only retain it once and release it once.
2014-08-09 16:04:59 -03:00
Alex Szpakowski d52bab4221 Updated the new module changes to use more compile/link-time checking rather than runtime checking. 2014-07-21 15:12:01 -03:00
Alex Szpakowski 014b9a46e5 Updated the Lua wrapper code for modules to account for cases where the module's instance is removed from memory completely and recreated during the program's lifetime. 2014-07-21 14:52:01 -03:00
Alex Szpakowski ddb9997ead Replaced Joystick:saveGamepadMapping with love.joystick.saveGamepadMappings, which saves all gamepad mappings from both recently-used joysticks and recently-modified mappings. saveGamepadMappings returns a string of newline-separated mappings and takes an optional filename argument which writes it to a file. 2014-06-05 00:25:34 -03:00
Alex Szpakowski 10e0d4b900 Moved the love.joystick Lua wrapper code from modules/joystick/sdl/ to modules/joystick/. 2014-06-04 16:23:39 -03:00
Alex Szpakowski 4cd4d35739 Fixed some logic 2014-06-04 16:06:36 -03:00
Alex Szpakowski 42a565a0eb Fixed love.joystick.loadGamepadMappings to properly enable currently connected Joysticks as Gamepads when necessary. 2014-06-04 16:03:02 -03:00
Alex Szpakowski 79b453653a Added love.joystick.loadGamepadMappings (resolves issue #842), and Joystick:saveGamepadMapping.
The latter returns a mapping string, and the former loads a newline-separated list of mapping strings.
2014-06-04 15:50:06 -03:00
Alex Szpakowski dfa319e01a Replaced the EXCEPT_GUARD macro for converting love exceptions into Lua errors with the new luax_catchexcept function, which takes lambda function arguments. 2014-06-03 19:27:00 -03:00
Alex Szpakowski 036f6eb8cb Added an optional duration argument to Joystick:setVibration. 2014-05-10 16:52:40 -03:00