added zooming with +, - and 0

This commit is contained in:
logsol 2014-07-07 23:32:11 +02:00
parent cc8cf6c5f9
commit ac27da1e31
7 changed files with 82 additions and 12 deletions

View file

@ -30,6 +30,7 @@ function (Key) {
}
KeyboardInput.prototype._onKeyDown = function (e) {
console.log(e.keyCode)
var key = this._getKeyByKeyCode(e.keyCode);
if (key && !key.getActive()) {

View file

@ -38,7 +38,11 @@ function (Parent, KeyboardInput, MouseInput, Nc, GamepadInput) {
space: 32,
tab: 9
tab: 9,
plus: 187,
minus: 189,
zero: 48
}
this.init(keys);
@ -63,6 +67,10 @@ function (Parent, KeyboardInput, MouseInput, Nc, GamepadInput) {
this.keyboardInput.registerKey(keys.up, 'jump', 'jumpStop');
this.keyboardInput.registerKey(keys.space, 'jump', 'jumpStop');
this.keyboardInput.registerKey(keys.plus, 'zoomIn');
this.keyboardInput.registerKey(keys.minus, 'zoomOut');
this.keyboardInput.registerKey(keys.zero, 'zoomReset');
this.keyboardInput.registerKey(keys.tab, 'showInfo', 'hideInfo');
this.keyboardInput.registerKey(keys.f, 'handActionLeft');
@ -127,6 +135,18 @@ function (Parent, KeyboardInput, MouseInput, Nc, GamepadInput) {
Nc.trigger(Nc.ns.client.game.gameInfo.toggle, false);
};
PlayerController.prototype.zoomIn = function() {
Nc.trigger(Nc.ns.client.game.zoomIn, true);
};
PlayerController.prototype.zoomOut = function() {
Nc.trigger(Nc.ns.client.game.zoomOut, false);
};
PlayerController.prototype.zoomReset = function() {
Nc.trigger(Nc.ns.client.game.zoomReset, false);
};
PlayerController.prototype.destroy = function() {
Nc.offAll(this.ncTokens);
Parent.prototype.destroy.call(this);