S2ENGINE HD  1.4.6
Official manual about S2Engine HD editor and programming
Input Mapping

S2Engine HD has a tool for mapping input controls. This tool creates an input mapping configuration that engine automatically stores inside a file named input.cfg in the current project folder.
This file is automatically loaded when engine starts a project. Every project can have its input mapping configuration.
With this tool you can make an action inside the game to be associated to a key, a mouse button or a pad button, also you can make an analog value, a float in the [-x,x] interval to be associated, for example, to pad stick or mouse movements.

Note
x can be a any float value


In the first case we refer to Input Actions in the second one we refer to Input Axis.
To access input configuration tool you can click the tool icon on the main toolbar as showed into the following image:

keymap.jpg

The following image shows the Input Mapper dialog:

keymap06.jpg
  1. The input Actions list
  2. The input Axis list
  3. The list of elements for every input action/axis added

Configuring Input Map

To add a new Input Action click on + button as showed into the following image:

keymap07.jpg

A dialog will appear That lets you to insert the name to be associated to the new Action:

keymap03.jpg

The same operation is needed to add a new input axis, click on + of the InputAxis Group box:

keymap08.jpg

After you have added a new Input action/axis you must add an element to associate a key, a mouse movement/button, or a pad stick/button to the action/axis.

  • select the action/axis you want to configure
  • click on + button as showed into the following image:
    keymap09.jpg

A new item will appear, click on the ComboBox to choose what key/pad/mouse feature you want to associate:

keymap05.jpg
  • In the case of InputAxis you can also decide how much scaling must be applied to the returned value:
    keymap11.jpg
  • In the case of InputAction you can decide if the action must be returned after a combination with shift, alt or control keyboard buttons:
    keymap10.jpg
Note
As you seen you can associate more than one element to a single input action/axis. This is necessary in order to let game processing more than one input (mouse, pad, keyboard) with a single identifier at the same time. For example you can associate mouse left button, keyboard E key and gamepad Right Thumb button to the same action named as shoot
keymap12.jpg
Warning
In order to make engine saving the current InputMap you must close the dialog pressing OK button

Using Input Map

Once you have filled the input map with a set of actions and axis you can use it inside GameMachine or with script Standard Library. There are script Input functions and/or GameMachine Action Classes specialized for retrieving the value of an input axis or action given its name in the map, i.e. the name we have chosen when setting up input map configuration.