🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Orx now uses gamepad controller mapping

Started by
1 comment, last by sausagejohnson 5 years, 9 months ago

Last week, support was added to Orx for gamepad controller mapping as well as half-axes, analog thresholds and stick/button/trigger controls remapping.

This is made possible by utilizing the SDL Game Controller Database initiative in order to standardize controller sticks and buttons.

What this means for games is that no matter what type of controller you plug in, JOY_LX_1 means the X axis on the Left Stick of the first controller. This is much better than the previous JOY_X_1 which meant the same thing, but no guarantee which stick on your controller this would be. This greatly removes the need for creating a re-mapper screen to your games (though still good for convenience).

An example of use would look like the following. Firstly the config:


[MainInput]
JOY_LX_1   = LeftRight

Then in code:


if (orxInput_IsActive("LeftRight")) {
    orxFLOAT x = orxInput_GetValue("LeftRight");
    //do something
}

There are a number of joystick tutorials that cover the new features.

Indie game dev in the evenings. Always feel free to say hi.

Advertisement

In addition to Orx using the SDL controller database for out-of-the-box mappings (via the GLFW3 library); this week, it is now possible to add extra mappings directly into the data config of your game using the Input.MappingList property, for example:


[Input]
MappingList = 78696e70757401000000000000000000,XInput Gamepad (GLFW),platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b5,rightshoulder:b4,back:b7,start:b6,leftstick:b8,rightstick:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,dpup:h0.1,dpright:h0.2,dpdown:h0.4,dpleft:h0.8

The new feature is covered in this article: http://orx-project.org/wiki/en/tutorials/overriding_controller_mapping

Indie game dev in the evenings. Always feel free to say hi.

This topic is closed to new replies.

Advertisement