Press 'c' to switch camera channel (front/bottom)

Esse commit está contido em:
Laurent Eschenauer
2013-09-03 14:00:45 +02:00
commit 7e32bffb69
2 arquivos alterados com 12 adições e 2 exclusões
+7
Ver Arquivo
@@ -1,3 +1,5 @@
var channel = 0;
function pilot(name, deps) { function pilot(name, deps) {
deps.io.sockets.on('connection', function (socket) { deps.io.sockets.on('connection', function (socket) {
socket.on('/pilot/move', function (cmd) { socket.on('/pilot/move', function (cmd) {
@@ -22,6 +24,11 @@ function pilot(name, deps) {
console.log("animate", cmd); console.log("animate", cmd);
return deps.client.animate(cmd.action, 500); return deps.client.animate(cmd.action, 500);
}); });
socket.on('/pilot/channel', function (cmd) {
channel = (channel == 0) ? 1 : 0;
console.log("switching to channel %d", channel);
return deps.client.config('video:video_channel', channel);
});
}); });
}; };
+5 -2
Ver Arquivo
@@ -10,7 +10,8 @@ PILOT_ACCELERATION = 0.04;
, backward = 's' , backward = 's'
, left = 'a' , left = 'a'
, right = 'd' , right = 'd'
, flip = 'f' , flip = 'f'
, channel = 'c'
; ;
if (options && options.keyboard === 'qwerty') { } if (options && options.keyboard === 'qwerty') { }
else if (options && options.keyboard === 'azerty') { else if (options && options.keyboard === 'azerty') {
@@ -75,7 +76,9 @@ PILOT_ACCELERATION = 0.04;
ev : 'move', ev : 'move',
action : 'right' action : 'right'
}; };
Keymap[keyCodeMap[channel]] = {
ev : 'channel'
};
/* /*
* Constructuor * Constructuor