antirez / load81

SDL based Lua programming environment for kids similar to Codea
BSD 2-Clause "Simplified" License
647 stars 64 forks source link

Joystick support (final) #54

Open seclorum opened 12 years ago

seclorum commented 12 years ago

I've re-implemented Joystick support, substituting joystick.count for JOYSTICKS, and re-working the API that was added to be more generally useful outside the scope of Joystick handling.

Joystick rescan is done whenever switching to the editor, meaning end-users can plug joysticks in and re-start their games if needed. Also dynamically adding up to 8 (hard-coded limit of SDL handles reserved) joysticks at rescan. Button support is included.

To use:

joystick.count = number of joysticks detected joystick[1].x / joystick[1].y = x/y axes joystick[1].button = 1 for down, 0 for up