|
@@ -121,17 +121,17 @@ Build and run the example.
|
|
First you register each mapping name with its trigger(s). Remember the following:
|
|
First you register each mapping name with its trigger(s). Remember the following:
|
|
|
|
|
|
* An input trigger can be a key press or mouse action. +
|
|
* An input trigger can be a key press or mouse action. +
|
|
-For example a mouse movement, a mouse click, or pressing the letter “P.
|
|
|
|
|
|
+For example a mouse movement, a mouse click, or pressing the letter "`P`".
|
|
* The mapping name is a string that you can choose. +
|
|
* The mapping name is a string that you can choose. +
|
|
-The name should describe the action (e.g. “Rotate), and not the trigger. Because the trigger can change.
|
|
|
|
|
|
+The name should describe the action (e.g. "`Rotate`"), and not the trigger. Because the trigger can change.
|
|
* One named mapping can have several triggers. +
|
|
* One named mapping can have several triggers. +
|
|
-For example, the “Rotate action can be triggered by a click and by pressing the spacebar.
|
|
|
|
|
|
+For example, the "`Rotate`" action can be triggered by a click and by pressing the spacebar.
|
|
|
|
|
|
Have a look at the code:
|
|
Have a look at the code:
|
|
|
|
|
|
-. You register the mapping named “Rotate to the Spacebar key trigger. +
|
|
|
|
|
|
+. You register the mapping named "`Rotate`" to the Spacebar key trigger. +
|
|
`new KeyTrigger(KeyInput.KEY_SPACE)`).
|
|
`new KeyTrigger(KeyInput.KEY_SPACE)`).
|
|
-. In the same line, you also register “Rotate to an alternative mouse click trigger. +
|
|
|
|
|
|
+. In the same line, you also register "`Rotate`" to an alternative mouse click trigger. +
|
|
`new MouseButtonTrigger(MouseInput.BUTTON_LEFT)`
|
|
`new MouseButtonTrigger(MouseInput.BUTTON_LEFT)`
|
|
. You map the `Pause`, `Left`, `Right` mappings to the P, J, K keys, respectively.
|
|
. You map the `Pause`, `Left`, `Right` mappings to the P, J, K keys, respectively.
|
|
+
|
|
+
|
|
@@ -149,7 +149,7 @@ Have a look at the code:
|
|
|
|
|
|
Now you need to register your trigger mappings.
|
|
Now you need to register your trigger mappings.
|
|
|
|
|
|
-. You register the pause action to the ActionListener, because it is an “on/off action.
|
|
|
|
|
|
+. You register the pause action to the ActionListener, because it is an "`on/off`" action.
|
|
. You register the movement actions to the AnalogListener, because they are gradual actions.
|
|
. You register the movement actions to the AnalogListener, because they are gradual actions.
|
|
+
|
|
+
|
|
[source,java]
|
|
[source,java]
|
|
@@ -255,7 +255,7 @@ It's okay to use only one of the two Listeners, and not implement the other one,
|
|
|
|
|
|
== Analog, Pressed, or Released?
|
|
== Analog, Pressed, or Released?
|
|
|
|
|
|
-Technically, every input can be either an “analog or a “digital action. Here is how you find out which listener is the right one for which type of input.
|
|
|
|
|
|
+Technically, every input can be either an "`analog`" or a "`digital`" action. Here is how you find out which listener is the right one for which type of input.
|
|
|
|
|
|
Mappings registered to the *AnalogListener* are triggered repeatedly and gradually.
|
|
Mappings registered to the *AnalogListener* are triggered repeatedly and gradually.
|
|
|
|
|
|
@@ -268,7 +268,7 @@ In order to see the total time that a key has been pressed for then the incoming
|
|
|
|
|
|
* Example: Navigational events (e.g. Left, Right, Rotate, Run, Strafe), situations where you interact continuously.
|
|
* Example: Navigational events (e.g. Left, Right, Rotate, Run, Strafe), situations where you interact continuously.
|
|
|
|
|
|
-Mappings registered to the *ActionListener* are digital either-or actions – “Pressed or released? On or off?
|
|
|
|
|
|
+Mappings registered to the *ActionListener* are digital either-or actions – "`Pressed`" or "`Peleased`"? "`On`" or "`Off`"?
|
|
|
|
|
|
* Parameters:
|
|
* Parameters:
|
|
.. JME gives you access to the name of the triggered action.
|
|
.. JME gives you access to the name of the triggered action.
|