Repository navigation
Input Handling
See LibGDX Input Handling documentation.
Requires mini2Dx 1.3.0 or above
mini2Dx builds on top of LibGDX's Controller API to add explicit mappings and interfaces for common game controllers. The currently supported controllers are:
- Xbox 360 Controller
- Xbox One Controller
Playstation controllers are currently planned also.
To get access to a specific controller mapping, first retrieve the Controller instance through the LibGDX API and then switch over the mapping using the ControllerMapping class.
//Retrieve controller using LibGDX API
Controller controller = ...;
switch(ControllerMapping.getControllerType(controller)) {
case ControllerType.XBOX_ONE:
return ControllerMapping.xboxOne(controller);
case ControllerType.XBOX_360:
return ControllerMapping.xbox360(controller);
...
}The framework will return an implementation of MdxController corresponding to controller, for example Xbox360Controller
Once you have your controller instance you can attach listeners to it. The API also provides adapter classes for you to extend in case you don't want to implement the listener interfaces.
- Xbox360ControllerListener / Xbox360ControllerAdapter
- XboxOneControllerListener / XboxOneControllerAdapter
Dead zones are a common problem for analog sticks. Mini2Dx provides dead zone handling built into the API. Based on Doing Thumbstick Dead Zones Right there are several dead zone handling implementations available.
- AxialDeadZone
- RadialDeadZone
- ScaledRadialDeadZone
To apply them to your controllers, pass the instances as an argument when creating the controller.
RadialDeadZone leftStickDeadZone = new RadialDeadZone();
RadialDeadZone rightStickDeadZone = new RadialDeadZone();
//Retrieve controller using LibGDX API
Controller controller = ...;
switch(ControllerMapping.getControllerType(controller)) {
case ControllerType.XBOX_ONE:
return ControllerMapping.xboxOne(controller, leftStickDeadZone, rightStickDeadZone);
case ControllerType.XBOX_360:
return ControllerMapping.xbox360(controller, leftStickDeadZone, rightStickDeadZone);
...
}Getting Started
Graphics
Gameplay
Data
- Asset Management
- Saving and loading player data
- Converting objects to/from JSON
- Converting objects to/from XML
User Interfaces / HUDs
Structuring your code
Releasing your game