From 81ccdaa12708d59b6d422ce446c71a68d6dc5a69 Mon Sep 17 00:00:00 2001 From: logsol Date: Sun, 30 Nov 2014 13:43:22 +0100 Subject: [PATCH] cleanup --- app/Game/Client/View/Abstract/View.js | 3 +- app/Game/Client/View/Pixi/View.js | 60 +-------------------------- 2 files changed, 3 insertions(+), 60 deletions(-) diff --git a/app/Game/Client/View/Abstract/View.js b/app/Game/Client/View/Abstract/View.js index 4ebac9c..6ff4f23 100755 --- a/app/Game/Client/View/Abstract/View.js +++ b/app/Game/Client/View/Abstract/View.js @@ -36,9 +36,8 @@ function (Abstract, DomController, Settings, Exception, Nc) { Abstract.prototype.addMethod.call(AbstractView, 'addFilter', ['mesh', 'options']); Abstract.prototype.addMethod.call(AbstractView, 'removeFilter', ['mesh', 'options']); Abstract.prototype.addMethod.call(AbstractView, 'setCameraPosition', ['x', 'y']); - Abstract.prototype.addMethod.call(AbstractView, 'setCameraZoom', ['z']); - Abstract.prototype.addMethod.call(AbstractView, 'onZoomIn'); Abstract.prototype.addMethod.call(AbstractView, 'onZoomIn'); + Abstract.prototype.addMethod.call(AbstractView, 'onZoomOut'); Abstract.prototype.addMethod.call(AbstractView, 'onZoomReset'); Abstract.prototype.addMethod.call(AbstractView, 'toggleInfo', ['show', 'string']); Abstract.prototype.addMethod.call(AbstractView, 'onCreateAndAddPlayerInfo', ['options']); diff --git a/app/Game/Client/View/Pixi/View.js b/app/Game/Client/View/Pixi/View.js index 2f3f4ef..3917099 100755 --- a/app/Game/Client/View/Pixi/View.js +++ b/app/Game/Client/View/Pixi/View.js @@ -48,7 +48,8 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer this.stage = new PIXI.Stage(0x333333); - this.initCamera(); + this.container = new PIXI.DisplayObjectContainer(); + this.stage.addChild(this.container); this.layerManager = new LayerManager(this.container, this.me); @@ -68,12 +69,6 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer this.renderer.render(this.stage); } - // Camera - PixiView.prototype.initCamera = function () { - this.container = new PIXI.DisplayObjectContainer(); - this.stage.addChild(this.container); - } - PixiView.prototype.calculateCenterPosition = function() { var target = this.me.getHeadPosition(); var centerPosition = {x: target.x, y: target.y}; @@ -89,63 +84,12 @@ function (Parent, DomController, PIXI, Settings, Nc, Exception, GameStats, Layer return centerPosition; }; -/* - PixiView.prototype.calculateCameraPosition = function() { - var targetZoom = this.currentZoom; - - var oldZoom = (this.container.scale.x + this.container.scale.y) / 2; - var newZoom = (targetZoom -oldZoom) * Settings.CAMERA_GLIDE / 100; - - this.container.scale.x += newZoom; - this.container.scale.y += newZoom; - - var target = this.me.getHeadPosition(); - target.x *= -Settings.RATIO * targetZoom; - target.y *= -Settings.RATIO * targetZoom; - - target.x -= this.me.playerController.xyInput.x * Settings.STAGE_WIDTH / 4; - target.y += this.me.playerController.xyInput.y * Settings.STAGE_HEIGHT / 4; - - var pos = this.getCameraPosition(); - - pos.x += (target.x -pos.x) * Settings.CAMERA_GLIDE / 100; - pos.y += (target.y -pos.y) * Settings.CAMERA_GLIDE / 100; - - return pos; - }; - - PixiView.prototype.setCameraPosition = function (x, y) { - if(!this.debugMode) { - this.container.position.x = x + Settings.STAGE_WIDTH / 2; - this.container.position.y = y + Settings.STAGE_HEIGHT / 2; - } - }; - - PixiView.prototype.getCameraPosition = function () { - var pos = this.container.position; - - pos.x = pos.x - Settings.STAGE_WIDTH / 2; - pos.y = pos.y - Settings.STAGE_HEIGHT / 2; - - return pos; - }; -*/ - PixiView.prototype.setCameraZoom = function (zoom) { -/* - var oldZoom = this.container.scale.x; - - this.container.scale.x += (zoom -oldZoom) * Settings.CAMERA_GLIDE / 100; - this.container.scale.y += (zoom -oldZoom) * Settings.CAMERA_GLIDE / 100; -*/ - }; - PixiView.prototype.onFullscreenChange = function(isFullScreen) { Parent.prototype.onFullscreenChange.call(this, isFullScreen); if(isFullScreen) { this.renderer.resize(window.innerWidth, window.innerHeight); this.currentZoom = window.innerWidth / 600; - console.log(this.currentZoom); } else { this.renderer.resize(600, 400); this.currentZoom = 1;