> 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

## 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>
