jeromeetienne / threex.keyboardstate

three.js extension to keep the current state of the keyboard

Home Page:http://jeromeetienne.github.io/threex.keyboardstate/examples/basic.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

threex.keyboardstate

threex.keyboardstate is a threex game extension for three.js which makes it easy to keep the current state of the keyboard. It is possible to query it at any time. No need of an event. This is particularly convenient in loop driven case, like in 3D demos or games. The syntax of the keys has been copied from jquery keyboard plugin to ease configuration. It can help you control the characters of your three.js games.

Show Don't Tell

A Screenshot

screenshot

How To Install It

You can install it manually. Just do

<script src='threex.keyboardstate.js'></script>

You can install with bower.

bower install threex.keyboardstate

How To Use It ?

Step 1: Create the object

var keyboard	= new THREEx.KeyboardState();

Step 2: Query the keyboard state

This will return true if shift and A are pressed, false otherwise

keyboard.pressed("shift+A")

Step 3: Stop listening to the keyboard

keyboard.destroy()

NOTE: this library may be nice as standaline. independant from three.js

About

three.js extension to keep the current state of the keyboard

http://jeromeetienne.github.io/threex.keyboardstate/examples/basic.html

License:MIT License


Languages

Language:HTML 53.7%Language:JavaScript 42.9%Language:Makefile 3.4%