Skip to content

Commit f87c9ba

Browse files
committed
Added some additional gamepad related input mappings.
1 parent dd6c93c commit f87c9ba

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

sim-eth-basic/release-notes.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Version 3
1010
* Added a debug TimeSequenceState that can pop-up a time sync debug display.
1111
* Added "Resume" menu item to the In-Game menu.
1212
* Added an in-game "Help" pop-up mapping to the F1 key.
13+
* Added Gamepad mapping so "select" button will now open the in-game menu.
14+
* Added Gamepad mapping so the HAT will strafe/elevate.
1315

1416

1517
Version 2

sim-eth-basic/src/main/java/example/MainGameFunctions.java

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
package example;
3838

3939
import com.jme3.input.KeyInput;
40+
import com.simsilica.lemur.input.Button;
4041
import com.simsilica.lemur.input.FunctionId;
4142
import com.simsilica.lemur.input.InputMapper;
4243

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

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

6669
inputMapper.map(F_TIME_DEBUG, KeyInput.KEY_F7);

sim-eth-basic/src/main/java/example/view/PlayerMovementFunctions.java

+4
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,17 @@ public static void initializeDefaultMappings( InputMapper inputMapper ) {
9393
inputMapper.map(F_STRAFE, Axis.JOYSTICK_LEFT_X);
9494
inputMapper.map(F_STRAFE, KeyInput.KEY_D);
9595
inputMapper.map(F_STRAFE, InputState.Negative, KeyInput.KEY_A);
96+
97+
inputMapper.map(F_STRAFE, Axis.JOYSTICK_HAT_X);
9698
}
9799

98100
if( !inputMapper.hasMappings(F_ELEVATE) ) {
99101
// Elevation only has key mappings but we still treat it like
100102
// one "axis".
101103
inputMapper.map(F_ELEVATE, KeyInput.KEY_Q);
102104
inputMapper.map(F_ELEVATE, InputState.Negative, KeyInput.KEY_Z);
105+
106+
inputMapper.map(F_ELEVATE, Axis.JOYSTICK_HAT_Y);
103107
}
104108

105109
if( !inputMapper.hasMappings(F_X_ROTATE) ) {

sim-eth-basic/src/main/resources/log4j2.xml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<Loggers>
1717
<Logger name="example" level="DEBUG"/>
1818
<Logger name="com.simsilica.sim" level="TRACE"/>
19+
<!-- <Logger name="com.simsilica.lemur.input.InputMapper" level="TRACE"/> -->
1920
<!-- <Logger name="com.simsilica.lemur.CallMethodAction" level="TRACE"/> -->
2021
<Root level="INFO">
2122
<AppenderRef ref="RollingFile"/>

0 commit comments

Comments
 (0)