Classes

Input

The Input class consists of various properties and methods for detecting and handling keyboard and mouse related interactions. When it comes to mobile, JackyJS automatically converts mousepress, mousedown, and mouseup events to their touch-based equivalents, so you don't have to; ie, there are no touch specific events.

NOTE: In a future version, JackyJS may be able to handle multi-touch events, but that is farther down the roadmap. For now, keep it simple stupid (K.I.S.S.) ;-)

The goal with JackyJS is to facilitate the production of casual games that can be played anywhere, in particular on mobile devices. It is for this reason you won't see FULL support for all types of keyboard and mouse events. With that said, there is enough here to build many types of games. Later down the road, depending on support and feedback, JackyJS may grow in these capabilities.

Properties (static)

Name Type Description
xNumberthe currently clicked/touched X game screen coordinate. **read-only**
yNumberthe currently clicked/touched Y game screen coordinate. **read-only**
xStartNumberthe initially clicked/touched X game screen coordinate. This is typically used with draggable entities. **read-only**
yStartNumberthe initially clicked/touched Y game screen coordinate. This is typically used with draggable entities. **read-only**
pageXNumberthe currently clicked/touched X window coordinate. **read-only**
pageYNumberthe currently clicked/touched Y window coordinate. **read-only**
keyCodesObjectan object literal which contains, as properties, the following supported keycodes. **read-only**

	keyCodes: {
		8: 'BACKSPACE',
		9: 'TAB',
		13: 'ENTER',
		16: 'SHIFT',
		17: 'CONTROL',
		18: 'ALT',
		20: 'CAPSLOCK',
		27: 'ESC',
		32: 'SPACEBAR',
		37: 'LEFT',
		38: 'UP',
		39: 'RIGHT',
		40: 'DOWN',
		224: 'COMMAND'
	}

keyPressedObjectan object literal which contains, as properties, existing keyCodes pressed. **read-only**
mousePressedObjectan object literal which contains, as properties, existing mouse buttons pressed. Currently only 'LEFT' exists; ie, no detection of right clicks. **read-only**

Methods (static)

Name Parameter Type Description
keyNonereturns TRUE if no keys are being pressed.
mouseNonereturns TRUE if mow mouse buttons are being pressed.
clearEventsclears all mouse and keyboard events. (This is used internally, but can be used at any time)