Skip to content

Commit

Permalink
Added some additional gamepad related input mappings.
Browse files Browse the repository at this point in the history
  • Loading branch information
pspeed42 committed Sep 6, 2016
1 parent dd6c93c commit f87c9ba
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sim-eth-basic/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Version 3
* Added a debug TimeSequenceState that can pop-up a time sync debug display.
* Added "Resume" menu item to the In-Game menu.
* Added an in-game "Help" pop-up mapping to the F1 key.
* Added Gamepad mapping so "select" button will now open the in-game menu.
* Added Gamepad mapping so the HAT will strafe/elevate.


Version 2
Expand Down
3 changes: 3 additions & 0 deletions sim-eth-basic/src/main/java/example/MainGameFunctions.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
package example;

import com.jme3.input.KeyInput;
import com.simsilica.lemur.input.Button;
import com.simsilica.lemur.input.FunctionId;
import com.simsilica.lemur.input.InputMapper;

Expand All @@ -61,6 +62,8 @@ public class MainGameFunctions {
public static void initializeDefaultMappings( InputMapper inputMapper ) {

inputMapper.map(F_IN_GAME_MENU, KeyInput.KEY_ESCAPE);
inputMapper.map(F_IN_GAME_MENU, Button.JOYSTICK_SELECT); // the normal one
inputMapper.map(F_IN_GAME_MENU, Button.JOYSTICK_BUTTON8); // just in case it's not a gamepad
inputMapper.map(F_IN_GAME_HELP, KeyInput.KEY_F1);

inputMapper.map(F_TIME_DEBUG, KeyInput.KEY_F7);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,17 @@ public static void initializeDefaultMappings( InputMapper inputMapper ) {
inputMapper.map(F_STRAFE, Axis.JOYSTICK_LEFT_X);
inputMapper.map(F_STRAFE, KeyInput.KEY_D);
inputMapper.map(F_STRAFE, InputState.Negative, KeyInput.KEY_A);

inputMapper.map(F_STRAFE, Axis.JOYSTICK_HAT_X);
}

if( !inputMapper.hasMappings(F_ELEVATE) ) {
// Elevation only has key mappings but we still treat it like
// one "axis".
inputMapper.map(F_ELEVATE, KeyInput.KEY_Q);
inputMapper.map(F_ELEVATE, InputState.Negative, KeyInput.KEY_Z);

inputMapper.map(F_ELEVATE, Axis.JOYSTICK_HAT_Y);
}

if( !inputMapper.hasMappings(F_X_ROTATE) ) {
Expand Down
1 change: 1 addition & 0 deletions sim-eth-basic/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Loggers>
<Logger name="example" level="DEBUG"/>
<Logger name="com.simsilica.sim" level="TRACE"/>
<!-- <Logger name="com.simsilica.lemur.input.InputMapper" level="TRACE"/> -->
<!-- <Logger name="com.simsilica.lemur.CallMethodAction" level="TRACE"/> -->
<Root level="INFO">
<AppenderRef ref="RollingFile"/>
Expand Down

0 comments on commit f87c9ba

Please sign in to comment.