A Brief Explanation of cInput
Before we get to the nuts and bolts of defining the default inputs, it may be useful to clarify the mindset behind cInput and how it's intended to function behind-the-scenes.
Action
cInput primarily works with actions
which are generally named after what you intend to use an input to do. Some examples of action names could be "Jump"
, "Shoot"
, "Move Left"
, or "Move Right"
. That said, actions
can be named anything you want.
For each action, you can assign up to two inputs which cInput will use to get the values of the action. For example, the "Move Left"
action could have the A
and Left Arrow
keys assigned to it.
The word key
(or keys
) in this manual will most often refer to a key on the keyboard. However, because cInput attempts to mimic Unity's Input class as closely as possible, sometimes the word key
is used when referring to actions
(e.g., the GetKey()
or ChangeKey()
methods).
Additionally, the word button
(or buttons
) usually refers to a button on a gamepad. However, sometimes it is easier to use the word button
to refer to any inputs assigned to the action
itself, regardless of what types of inputs they may be. In this situation, the word button
is usually preceded with the name of the action, which will be in quotes. For example, the "Jump" button.
Axis
An axis
in cInput can be made up from one or two actions
. If only one action
is assigned to an axis
, the axis
will return a positive value between 0...1
. If two actions
are assigned to an axis
then the first action
will give the negative values (-1...0
) for the axis
, while the second action
will give the positive values (0...1
) for the axis
.
Because axes
are made up from actions
, you must first define the actions
for each axis
before you can define the axis
itself.
If the inputs used for an axis are digital inputs--meaning they have only two states: on or off (0
or 1
)--such as keyboard keys or most gamepad buttons, cInput will create a virtual (i.e. simulated) analog axis. In other words, instead of returning only integer values (-1
, 0
, or 1
), GetAxis()
will return a float value in the range of -1...1
inclusive. If this is undesirable and you want the values exactly as they actually are, use GetAxisRaw()
instead.
Last updated