Pardon the mess, Play My Code is in beta!

READY TO PLAY?
CLICK TO LOG IN!

sign up - lost password

getControls

getControls()

This returns a Controls object. It is essentially the same as performing 'new Controls()', except this will always return the same object.

The advantage this function has is that because the same controls object is always returned, it allows you to avoid creating lots and lots of them on each frame. This is because typically only 1 Controls object is ever needed.

c = getControls()
mouseX = c.getMouseX()
mouseY = c.getMouseY()

if getControls().isKeyDown( :space )
    // do something
end

See Also