diff --git a/examples/grab.js b/examples/grab.js index 8c799ca62f..c79259ed57 100644 --- a/examples/grab.js +++ b/examples/grab.js @@ -158,10 +158,7 @@ Mouse.prototype.startRotateDrag = function() { x: this.current.x, y: this.current.y }; - this.cursorRestore = { - x: Window.getCursorPositionX(), - y: Window.getCursorPositionY() - }; + this.cursorRestore = Reticle.getPosition(); } Mouse.prototype.getDrag = function() { @@ -177,7 +174,7 @@ Mouse.prototype.getDrag = function() { } Mouse.prototype.restoreRotateCursor = function() { - Window.setCursorPosition(this.cursorRestore.x, this.cursorRestore.y); + Reticle.setPosition(this.cursorRestore); this.current = { x: this.rotateStart.x, y: this.rotateStart.y diff --git a/examples/gracefulControls.js b/examples/gracefulControls.js index e2b603c5d7..ab5de48ae2 100644 --- a/examples/gracefulControls.js +++ b/examples/gracefulControls.js @@ -54,8 +54,8 @@ var velocity = { x: 0, y: 0, z: 0 }; var velocityVertical = 0; var enabled = false; -var lastX = Window.getCursorPositionX(); -var lastY = Window.getCursorPositionY(); +var lastX = Reticle.getPosition().x; +var lastY = Reticle.getPosition().y; var yawFromMouse = 0; var pitchFromMouse = 0; @@ -109,8 +109,8 @@ function update(dt) { } if (enabled && Window.hasFocus()) { - var x = Window.getCursorPositionX(); - var y = Window.getCursorPositionY(); + var x = Reticle.getPosition().x; + var y = Reticle.getPosition().y; yawFromMouse += ((x - lastX) * movementParameters.MOUSE_YAW_SCALE * movementParameters.MOUSE_SENSITIVITY); pitchFromMouse += ((y - lastY) * movementParameters.MOUSE_PITCH_SCALE * movementParameters.MOUSE_SENSITIVITY); @@ -173,7 +173,7 @@ function scriptEnding() { function resetCursorPosition() { var newX = Window.x + Window.innerWidth / 2; var newY = Window.y + Window.innerHeight / 2; - Window.setCursorPosition(newX, newY); + Reticle.setPosition({ x: newX, y: newY}); lastX = newX; lastY = newY; } @@ -194,7 +194,7 @@ function enable() { for (var i = 0; i < CAPTURED_KEYS.length; i++) { Controller.captureKeyEvents({ text: CAPTURED_KEYS[i] }); } - Window.setCursorVisible(false); + Reticle.setVisible(false); Script.update.connect(update); } } @@ -205,7 +205,7 @@ function disable() { for (var i = 0; i < CAPTURED_KEYS.length; i++) { Controller.releaseKeyEvents({ text: CAPTURED_KEYS[i] }); } - Window.setCursorVisible(true); + Reticle.setVisible(true); Script.update.disconnect(update); } } diff --git a/examples/libraries/entityCameraTool.js b/examples/libraries/entityCameraTool.js index d209ed6c5c..a8e9335956 100644 --- a/examples/libraries/entityCameraTool.js +++ b/examples/libraries/entityCameraTool.js @@ -281,8 +281,8 @@ CameraManager = function() { that.mouseMoveEvent = function(event) { if (that.enabled && that.mode != MODE_INACTIVE) { - var x = Window.getCursorPositionX(); - var y = Window.getCursorPositionY(); + var x = Reticle.getPosition().x; + var y = Reticle.getPosition().y; if (!hasDragged) { that.lastMousePosition.x = x; that.lastMousePosition.y = y; @@ -337,7 +337,7 @@ CameraManager = function() { } if (updatePosition) { - Window.setCursorPosition(newX, newY); + Reticle.setPosition({ x: newX, y: newY}); } that.lastMousePosition.x = newX; @@ -384,7 +384,7 @@ CameraManager = function() { if (!that.enabled) return; that.mode = MODE_INACTIVE; - Window.setCursorVisible(true); + Reticle.setVisible(true); } diff --git a/examples/mouseLook.js b/examples/mouseLook.js index 81bc9d2813..ea97ead8e9 100644 --- a/examples/mouseLook.js +++ b/examples/mouseLook.js @@ -9,8 +9,8 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -var lastX = Window.getCursorPositionX(); -var lastY = Window.getCursorPositionY(); +var lastX = Reticle.getPosition().x; +var lastY = Reticle.getPosition().y; var yawFromMouse = 0; var pitchFromMouse = 0; @@ -121,9 +121,9 @@ var mouseLook = (function () { function onScriptUpdate(dt) { if (active && Window.hasFocus()) { - var x = Window.getCursorPositionX(); + var x = Reticle.getPosition().x; // I'm not sure why this + 0.5 is necessary? - var y = Window.getCursorPositionY() + 0.5; + var y = Reticle.getPosition().y; + 0.5; yawFromMouse += ((x - lastX) * movementParameters.MOUSE_YAW_SCALE * movementParameters.MOUSE_SENSITIVITY); pitchFromMouse += ((y - lastY) * movementParameters.MOUSE_PITCH_SCALE * movementParameters.MOUSE_SENSITIVITY); @@ -155,7 +155,7 @@ var mouseLook = (function () { function resetCursorPosition() { var newX = Window.x + Window.innerWidth / 2.0; var newY = Window.y + Window.innerHeight / 2.0; - Window.setCursorPosition(newX, newY); + Reticle.setPosition({ x: newX, y: newY}); lastX = newX; lastY = newY; }