summaryrefslogtreecommitdiff
path: root/game/plugins/orientation.js
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@gmail.com>2014-09-21 08:00:06 +0200
committerJustin Worthe <justin.worthe@gmail.com>2014-09-21 08:00:06 +0200
commit373e5f472f829714939103617cfe14e98d981b18 (patch)
tree4fa9bf8609537bad5b12a7e51915f4a07dee2873 /game/plugins/orientation.js
parent8c70582bf01821f8a71910013372e3b12f06cdd3 (diff)
Removed unused states and templating of main.js
Diffstat (limited to 'game/plugins/orientation.js')
-rw-r--r--game/plugins/orientation.js40
1 files changed, 0 insertions, 40 deletions
diff --git a/game/plugins/orientation.js b/game/plugins/orientation.js
deleted file mode 100644
index 8ab922b..0000000
--- a/game/plugins/orientation.js
+++ /dev/null
@@ -1,40 +0,0 @@
-'use strict';
-
-var Orientation = function() {
- var self = this;
-
- self.onLeft = new Phaser.Signal();
- self.onRight = new Phaser.Signal();
- self.onUp = new Phaser.Signal();
- self.onDown = new Phaser.Signal();
-
- self.previousEvent = {
- gamma: 0,
- beta: 0
- };
-
- self.threshhold = 15;
-
- if (window.DeviceOrientationEvent) {
- window.addEventListener('deviceorientation', function(eventData) {
- if (eventData.gamma < -self.threshhold && self.previousEvent.gamma >= -self.threshhold) {
- self.onLeft.dispatch();
- }
- if (eventData.gamma > self.threshhold && self.previousEvent.gamma <= self.threshhold) {
- self.onRight.dispatch();
- }
- if (eventData.beta < -self.threshhold && self.previousEvent.beta >= -self.threshhold) {
- self.onUp.dispatch();
- }
- if (eventData.beta > self.threshhold && self.previousEvent.beta <= self.threshhold) {
- self.onDown.dispatch();
- }
-
- self.previousEvent.gamma = eventData.gamma;
- self.previousEvent.beta = eventData.beta;
- });
- }
-};
-
-
-module.exports = Orientation;