Look at the inner methods of the InputListener
objects:
onAction(String name, boolean isPressed, float tpf)
inactionListener
onAnalog(String name, float intensity, float tpf)
inanalogListener
onTouch(String name, TouchEvent event, float tpf)
intouchListener
(not depicted)
When you implement the actual actions, you write a series of conditionals in these inner methods. When you want to detect several triggers (the most common scenario), add several else if
conditionals. You test for each mapping by name
, and then execute the desired action. In our example, we want the action to affect the blue cube (geom
).
Make
geom
accessible as a class field. Remember to adjust thegeom
object's constructor call insimpleInitApp()
method accordingly.private Geometry geom; ... geom = new Geometry("Box", mesh);
Now the
InputListener
objects in your class have access to the cube geometry.Let's handle
MAPPING_COLOR
first. In the inneronAction()
method of theactionListener...