1

How should I understand this documentation: http://msdn.microsoft.com/en-us/library/dd757116%28v=VS.85%29.aspx

Can I only use 4 buttons and 1 analog stick? I've got a gamepad with 12 buttons, 2 analog joysticks and one "steering cross" (POV hat?). How many of these buttons can I use with winmm?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Moberg
  • 5,253
  • 4
  • 38
  • 54

1 Answers1

1

If you need more axis than are supported by winmm, consider DirectInput.

However, the page you linked clearly states that up to 32 buttons and 6 axes (3 2-D analog sticks) are supported by winmm. Looks like your gamepad will max out on axes, using all 6, and also use 12 out of 32 buttons.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • I think this refers to "Extended capabilities" which i don't know what it is. Because there isn't any defines for JOY_BUTTON5CHG etc. and MM_JOY1MOVE doesn't differentiate between sticks in any way I can see. – Moberg May 01 '11 at 15:43
  • @Moberg: The "extended capabilities" are provided by the "Ex" flavor of the API. `joyGetPosEx` is the extended version of `joyGetPos`. `JOYINFOEX` is the extended version of `JOYINFO`. – Ben Voigt May 01 '11 at 15:46
  • Can I capture these extension buttons or do I need to query them? Query means calling joyGetPos(Ex) regularly so that the JOYINFOEX struct gets updated to see the state of the gamepad? – Moberg May 01 '11 at 15:54
  • I would like to handle the joystick input in the message loop as I do with all keyboard and mouse input. – Moberg May 01 '11 at 16:02
  • 1
    @Moberg: I think you'll need to poll, or switch to DirectInput. Most applications using extended joysticks have a draw loop (aka game loop) anyway and for these polling is convenient. – Ben Voigt May 01 '11 at 16:06
  • I can use (wParam & JOY_BUTTON10) to see if button 10 is held down, but pressing the button won't trigger a windows event (at least not a MM_JOY1BUTTONDOWN message). – Moberg May 01 '11 at 16:07
  • OK thank you, maybe I can manage without all buttons, at least for a while. :) – Moberg May 01 '11 at 16:07
  • You can use joySetCapture to have Windows send joystick events to the message loop. – rdb Feb 08 '14 at 10:28
  • @rdb: clearly you missed the entire point of the question. `joySetCapture` will only send message for the first four buttons and first three axes. All the rest of the events are lost. – Ben Voigt Feb 08 '14 at 16:07