[Ohrrpgce] Gamepad buttons/axes

Ralph Versteegen teeemcee at gmail.com
Thu Nov 19 20:53:48 PST 2020


On Fri, 20 Nov 2020 at 15:48, Ralph Versteegen <teeemcee at gmail.com> wrote:

> Using SDL2's gamecontroller API will allow a consistent numbering of
> buttons and axes, so we'll add new constants for them. E.g. A, B, X, Y
> buttons will be 0-3.
>
> (Also, DirectInput and SDL's joystick API report hats in addition to
> buttons and axes, but we currently ignore those and apparently can continue
> to.)
>
> I'm not a gamepad user so I'm a bit confused about how to handle the
> dpad... should both the (left) dpad and the left thumbstick, if they exist,
> be mapped to the same thing, and appear both as joy:up/down/left/right
> buttons and also as x/y axes? I'm told some games treat them separately, so
> we can provide an option to separate them; though it seems to me combining
> them should be the default. I guess that should be game setting rather than
> a player-controlled setting, because either the game is scripted to expect
> them to be separate (in which case it's unplayable with a gamepad that
> doesn't have/report both), or it doesn't in which case there's no reason
> for a player to separate them.
>

Also, I think we should also add four more up/down/left/right virtual
buttons for the right thumbstick. That way, if you want to use it for
8-directional input you don't need to write a complicated script to convert
x and y into angle then into directions, while compensating for the dead
zone. I've been asked to add commands to get the angle and
magnitude/displacement of a stick too, but it's still nontrivial to go from
angle to 8 directions.
Note this would imply that if you want the dpad and left stick to be
separate you still need to figure out what to do with the angle of the left
stick yourself, since there wouldn't be up/down/left/right virtual buttons
for it. I don't see that as a concern.


> Also, I see that SDL2 and Android at least both report L1, R1 shoulder
> triggers/buttons as buttons, but L2, R2 triggers as axes, not buttons. I
> guess we should report L1/L2/R1/R2 as four buttons, and also L2/R2 as axes?
>
> I'm going to punt the question of how to handle mapping of joysticks to
> player numbers (which SDL2 also has functions for) to a future version.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20201120/a176daf4/attachment.html>


More information about the Ohrrpgce mailing list