> For the complete documentation index, see [llms.txt](https://kap35.gitbook.io/kap-engine-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kap35.gitbook.io/kap-engine-wiki/user-manual/input/getinput.md).

# getInput

{% hint style="warning" %}
This function is only accessible in a component function
{% endhint %}

getInput is a useful fucntion for your component if you want to check if player do something with the keyboard or mouse click.

To check this there is 4 functions :&#x20;

* getKey()
* getKeyDown()
* getKeyUp()
* getAxis()

### How to use these functions ?

```cpp
void onUpdate() {

    //vertical variable take a value between -1.0f and 1.0f
    float vertical = getInput().getAxis("Vertical");

    //check is there is action with a key (but do not precise the actions)
    if (getInput().getKey(KapEngine::Events::Key::UP)) {
        //do something
    }
    
    //check if key is pressed
    if (getInput().getKeyDown(KapEngine::Events::Key::UP)) {
        //do something
    }
    
    //check if key is released
    if (getInput().getKeyUp(KapEngine::Events::Key::UP)) {
        //do something
    }
}
```
