Tangent128 / luasdl2

A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT.
ISC License
383 stars 73 forks source link

GamectlFunctions #37

Closed xriss closed 7 years ago

xriss commented 8 years ago

GamectlFunctions is not included in SDL.c

https://github.com/Tangent128/luasdl2/blob/master/src/SDL.c#L306

or exported in gamecontroller.h

I'm guessing this is all untested code as well so possibly not working in other ways? I'll see if I can patch it up into a working state...

xriss commented 8 years ago

The following changes got enough bits working that I could use game controllers in an event loop.

https://bitbucket.org/xixs/lua/commits/ef5bb4dd38ca7ffe3d51bcd02d9116c92b10d8cb

I also spotted a small event bug and added some missing enums ( you might not like where I decided to add them )

The following is some possibly helpful example code for using the game controllers ( the open/close stuff is a bit confusing when you try and handle hot pluging of devices )

https://bitbucket.org/xixs/bin/src/tip/lua/wetgenes/win/sdl.lua

Would you like me to do a proper pull request for the code in this patch?

Tangent128 commented 8 years ago

A pull request would be appreciated, yes.

Sanity check, these constants were in 2.0.0, right? (Otherwise you may want to add appropriate preprocessor directives to leave the enum entries out if an older library is being compiled against.)

xriss commented 8 years ago

All the Controller enums are in 2.0.0 (I double checked) so here's a pull request of the enums and enabling the game controller functions that are already in there but not actually exposed to lua.

https://github.com/Tangent128/luasdl2/pull/38

Web-eWorks commented 7 years ago

As the appropriate PR has been merged, I believe this issue can safely be closed, @Tangent128.