From 29074e51e88ca1f28fa21403dc80a72008148af1 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Fri, 19 Jun 2015 15:37:57 +0200 Subject: [PATCH] Added pointerlock option to camera --- controllers/prototype/views/prototype.jade | 4 ++-- js/Makefile | 1 + js/prototype/ButtonManager.js | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/controllers/prototype/views/prototype.jade b/controllers/prototype/views/prototype.jade index 6d2b1c7..87acf4a 100644 --- a/controllers/prototype/views/prototype.jade +++ b/controllers/prototype/views/prototype.jade @@ -34,8 +34,8 @@ block content input#fullarrow(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'}) label(for="fullarrow" style={'margin-right':'10px'}) Full arrow - input#collisions(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'}, checked) - label(for="collisions" style={'margin-right':'10px'}) Collisions + input#lock(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'}, checked) + label(for="lock" style={'margin-right':'10px'}) Use pointer lock input#showarrows(type="checkbox", style={'margin-right': '10px', 'margin-bottom': '10px'}, checked) label(for="showarrows" style={'margin-right':'10px'}) Show arrows diff --git a/js/Makefile b/js/Makefile index e5da56a..142903e 100644 --- a/js/Makefile +++ b/js/Makefile @@ -74,6 +74,7 @@ PrototypeTools: --js Hermite.js \ --js Camera.js \ --js PointerCamera.js \ + --js PointerLockCamera.js \ --js CameraContainer.js \ --js prototype/ArrowCamera.js \ --js prototype/FixedCamera.js \ diff --git a/js/prototype/ButtonManager.js b/js/prototype/ButtonManager.js index 3e0f759..1996c20 100644 --- a/js/prototype/ButtonManager.js +++ b/js/prototype/ButtonManager.js @@ -11,7 +11,7 @@ var ButtonManager = function(cameras, previewer) { this.undoElement = document.getElementById('undo'); this.redoElement = document.getElementById('redo'); - this.collisionElement = document.getElementById('collisions'); + this.pointerLockElement = document.getElementById('lock'); this.showarrowsElement = document.getElementById('showarrows'); this.recommendationElement = document.getElementById('recommendation'); @@ -19,6 +19,11 @@ var ButtonManager = function(cameras, previewer) { this.fullscreenElement.onclick = function() {fullscreen();}; (function(self) { + + self.pointerLockElement.onchange = function() { + self.cameras.mainCamera().shouldLock = self.pointerLockElement.checked; + } + self.undoElement.onclick = function() {self.cameras.mainCamera().undo(); self.updateElements();} self.redoElement.onclick = function() {self.cameras.mainCamera().redo(); self.updateElements();} @@ -31,7 +36,6 @@ var ButtonManager = function(cameras, previewer) { }; - self.collisionElement.onchange = function() {self.cameras.mainCamera().collisions = self.collisionElement.checked;} self.showarrowsElement.onchange = function() {self.showArrows = self.showarrowsElement.checked;} self.resetElement.onclick = function() {