Gamepad Support For Flash Games?

  • 288 Views
  • 2 Replies
New Topic Respond to this Topic
Goldsickle
Goldsickle
  • Member since: Jan. 2, 2006
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Gamepad Support For Flash Games? Jun. 30th, 2012 @ 06:13 PM Reply

Is it impossible to implement gamepad support for browser games?

Specifically, gamepads with two analog sticks.
For example, using the analog stick to control a character's movement with a 360° direction, rather than the maximum 8 directions or using the analog stick to aim a cross hair.

arkrix
arkrix
  • Member since: May. 4, 2012
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to Gamepad Support For Flash Games? Jul. 1st, 2012 @ 08:58 AM Reply

I think it depends on how the gamepad works. I believe they simulate actual key presses and stuff. May be wrong though.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Gamepad Support For Flash Games? Jul. 1st, 2012 @ 01:43 PM Reply

ActionScript doesn't support gamepads, so you'd have to use something like Xpadder to covert the gamepad button presses into keyboard actions

At 7/1/12 08:58 AM, arkrix wrote: I think it depends on how the gamepad works. I believe they simulate actual key presses and stuff. May be wrong though.

Older gamepads might operate this way (and by old I mean from back in the 90s) but modern ones, such as the Xbox 360 controller, do not.
Pressings the buttons sends JOY_1, JOY_2, JOY_3, et cetera, signals. They have their own actions so that games can be designed specifically for them.

This C++ tutorial on Xinput covers a lot of how it all works.