GameStick input?

How do you get input from the gamestick controller and how do you handle multiple controllers?

Events?

See:  http://coronalabs.com/blog/2013/08/27/tutorial-introduction-to-game-controllers/

and: https://coronalabs.com/blog/2013/09/24/tutorial-controllers-and-axis/

Rob

Thank you very much! The second link is a bit complicated and confusing… Gotta spend more time on it to understand it…

I found it’s good to get the first one down before trying to deal with the Axis inputs. Buttons are easier to deal with.  There are two big issues that make axis work hairy:  One is identifying them.  Other than the Left analog stick being pretty consistently Axis1 and Axis2 after that it’s a guessing game.  You basically have to write a test program that dumps the data from the event and press the buttons and figure out what’s what.  One of the best practices is to actually build an axis mapping screen into your app where you say “Press the Left Trigger” and it reads the event to figure out what input it is.  This is the way many PC games work with joy sticks.   The second issue is dealing with the analog results.    It took me a while to figure out the math to rotate a character based on stick in put.

So get the first blog down and get comfortable with the event system, then digest the Axis one secondly as it kind of builds upon the first one.

Rob

I got key events down alright… I have bern using the KeyEvent example project as reference, but still as I see it they got soo much extra sruff in the 2nd link, like getting the rotarion and that stuff. I just need the +x & +y values and then I can lookup how to do more complicated stuff like rotation later

See:  http://coronalabs.com/blog/2013/08/27/tutorial-introduction-to-game-controllers/

and: https://coronalabs.com/blog/2013/09/24/tutorial-controllers-and-axis/

Rob

Thank you very much! The second link is a bit complicated and confusing… Gotta spend more time on it to understand it…

I found it’s good to get the first one down before trying to deal with the Axis inputs. Buttons are easier to deal with.  There are two big issues that make axis work hairy:  One is identifying them.  Other than the Left analog stick being pretty consistently Axis1 and Axis2 after that it’s a guessing game.  You basically have to write a test program that dumps the data from the event and press the buttons and figure out what’s what.  One of the best practices is to actually build an axis mapping screen into your app where you say “Press the Left Trigger” and it reads the event to figure out what input it is.  This is the way many PC games work with joy sticks.   The second issue is dealing with the analog results.    It took me a while to figure out the math to rotate a character based on stick in put.

So get the first blog down and get comfortable with the event system, then digest the Axis one secondly as it kind of builds upon the first one.

Rob

I got key events down alright… I have bern using the KeyEvent example project as reference, but still as I see it they got soo much extra sruff in the 2nd link, like getting the rotarion and that stuff. I just need the +x & +y values and then I can lookup how to do more complicated stuff like rotation later