> For the complete documentation index, see [llms.txt](https://electoriaengine.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://electoriaengine.gitbook.io/api/engine/inputs.md).

# Inputs

No support for joystick. because there is no joystick

## Mouse

<pre class="language-javascript" data-overflow="wrap" data-full-width="true"><code class="lang-javascript">hidecursor()
showcursor()
disablemouse()
enablemouse()//turns on the mouse (comes on automatically)
console.log(getMouselocation())//{x: 147, y: 181, lastx: 394, lasty: 337}
//previous mouse position: layerx,layery,maybe you use this system in dragging

leftclicked = function(location,component){
    if(component) console.log(component.name+": you are clicked me",location)
    else console.log(location)//{x: 1026, y: 724}
}
rightclicked = function(location,component){
    if(component) console.log(component.name+": you are right clicked me",location)
    else console.log(location)//{x: 1026, y: 724}
}
mousemove = function(location,component){
    if(component) console.log(component.name+": you are hover me",location)
    else console.log(location)//{x: 1026, y: 724}
}
mouseup = function(location,component){
<strong>    if(component) console.log(component.name+": you got your mouse up",location)
</strong>    else console.log(location)//{x: 1026, y: 724}
}
mousedown = function(location,component){
    if(component) console.log(component.name+": you got your mouse down",location)
    else console.log(location)//{x: 1026, y: 724}
}
mousescroll = function(location,speed){
    console.log(location,speed)//location could be: down,up
    //down 100
    //up -100
}
editcursor("pointer")//replaces the mouse
editcursor("url('test.gif'), auto")//you can change cursor to png
</code></pre>

### Edit cursors

{% embed url="<https://codepen.io/chriscoyier/pen/AmEYvZ>" %}
**all mouse types. example: editcursor("wait")**
{% endembed %}

## Keyboard

<pre class="language-javascript" data-overflow="wrap"><code class="lang-javascript">disablekeyboard()//switches off the keyboard
enablekeyboard()//turns on the keyboard (comes on automatically)
keydown = function(key){
    console.log(key)//ARROWDOWN
}
keyup = function(key){
<strong>    console.log(key)//ENTER
</strong>}
keypress = function(key){
    console.log(key)//W
}
</code></pre>

{% hint style="info" %}
Keys are always uppercase
{% endhint %}

{% hint style="info" %}
Sometimes keypress may **not understand or understand the key too much**. To prevent this, you can change the **forcepresstime** in **onload.js.**
{% endhint %}

## Touch screen

<pre class="language-javascript"><code class="lang-javascript"><strong>disabletouch()//touch closes
</strong>enabletouch()//turns on the touch (comes on automatically)
touchmove = function(fingers){
<strong>    console.log(fingers)
</strong><strong>    /*
</strong><strong>    [
</strong><strong>    {finger: 1, x: 873, y: 459, component: false }, 
</strong><strong>    {finger: 2, x: 971, y: 423, component: {} },
</strong><strong>    ]
</strong><strong>    */
</strong>}
touchstart = function(fingers){
    console.log(fingers)//[{finger: 1, x: 873, y: 459, component: false}]
    if(component.name == "player1") console.log("You are clicked me") 
}
touchend = function(fingers){
    console.log(fingers)//[{finger: 1, x: 873, y: 459, component: false}]
}
</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://electoriaengine.gitbook.io/api/engine/inputs.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
