Simple way of doing cross browser pointer lock. It also makes it fullscreen, as on older versions of Firefox, it is required to be fullscreen in order to get the pointer lock.
Based on the following:
Example of usage (on gh-page)
window.onload = -> showStatus = (str) -> document.querySelector("#status").textContent = str button = document.querySelector("#click") PointerLock.init onEnable: -> console.log "enabled!" showStatus "locked!" onDisable: -> console.log "disabled!" showStatus "not locked" button.addEventListener("click", -> PointerLock.fullScreenLock(document.querySelector("body")))
Created by Daniel Ribeiro.
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php