|
|
@@ -113,14 +113,19 @@ Build and run the example.
|
|
|
|
|
|
First you register each mapping name with its trigger(s). Remember the following:
|
|
|
|
|
|
-* An input trigger can be a key press or mouse action. +For example a mouse movement, a mouse click, or pressing the letter “P.
|
|
|
-* 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.
|
|
|
-* One named mapping can have several triggers. +For example, the “Rotate action can be triggered by a click and by pressing the spacebar.
|
|
|
+* An input trigger can be a key press or mouse action. +
|
|
|
+For example a mouse movement, a mouse click, or pressing the letter “P.
|
|
|
+* 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.
|
|
|
+* One named mapping can have several triggers. +
|
|
|
+For example, the “Rotate action can be triggered by a click and by pressing the spacebar.
|
|
|
|
|
|
Have a look at the code:
|
|
|
|
|
|
-. You register the mapping named “Rotate to the Spacebar key trigger. +`new KeyTrigger(KeyInput.KEY_SPACE)`).
|
|
|
-. In the same line, you also register “Rotate to an alternative mouse click trigger. +`new MouseButtonTrigger(MouseInput.BUTTON_LEFT)`
|
|
|
+. You register the mapping named “Rotate to the Spacebar key trigger. +
|
|
|
+`new KeyTrigger(KeyInput.KEY_SPACE)`).
|
|
|
+. In the same line, you also register “Rotate to an alternative mouse click trigger. +
|
|
|
+`new MouseButtonTrigger(MouseInput.BUTTON_LEFT)`
|
|
|
. You map the `Pause`, `Left`, `Right` mappings to the P, J, K keys, respectively.
|
|
|
|
|
|
[source,java]
|
|
|
@@ -298,7 +303,8 @@ a| Keyboard: Escape
|
|
|
a| KeyTrigger(KeyInput.KEY_ESCAPE)
|
|
|
|
|
|
a| Keyboard: Arrows
|
|
|
-a| KeyTrigger(KeyInput.KEY_UP), KeyTrigger(KeyInput.KEY_DOWN) +KeyTrigger(KeyInput.KEY_LEFT), KeyTrigger(KeyInput.KEY_RIGHT)
|
|
|
+a| KeyTrigger(KeyInput.KEY_UP), KeyTrigger(KeyInput.KEY_DOWN) +
|
|
|
+KeyTrigger(KeyInput.KEY_LEFT), KeyTrigger(KeyInput.KEY_RIGHT)
|
|
|
|
|
|
|===
|
|
|
|
|
|
@@ -327,7 +333,7 @@ inputManager.addMapping("Pause", new KeyTrigger(usersPauseKey));
|
|
|
|
|
|
[IMPORTANT]
|
|
|
====
|
|
|
-Link to user-proposed solutions: <<jm3/solutions#,Some proposed solutions>>
|
|
|
+Link to user-proposed solutions: <<jm3/solutions#,Some proposed solutions>> +
|
|
|
+++<u>Be sure to try to solve them for yourself first!</u>+++
|
|
|
====
|
|
|
|