Skip to content

Commit

Permalink
Trackpad adding and more hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
deanputney committed Nov 14, 2013
1 parent 69d9160 commit f102275
Show file tree
Hide file tree
Showing 3 changed files with 772 additions and 3 deletions.
Empty file added gamepad.js
Empty file.
66 changes: 63 additions & 3 deletions hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@ $(document).bind('keydown', '7', function(e) {
Spectrum.gain = 20;
});

$(document).bind('keydown', '-', function(e) {
$(document).bind('keydown', 'o', function(e) {
Spectrum.gainFactor -= .05;
});

$(document).bind('keydown', '+', function(e) {
$(document).bind('keydown', 'p', function(e) {
console.log(Spectrum.gainFactor);
Spectrum.gainFactor += .05;
Spectrum.gainFactor += 0.05;
});




// Camera position
$(document).bind('keydown', 'w', function(e) {
camera.translateY(10);
Expand Down Expand Up @@ -79,4 +81,62 @@ $(document).bind('keydown', 'd', function(e) {
$(document).bind('keydown', 'shift+d', function(e) {
camera.translateX(100);
camera.lookAt({x:0,y:0,z:0});
});





/* Gamepad binding */

console.log('binding down');
gamepad.bind(Gamepad.Event.BUTTON_DOWN, function(e) {
switch(e.control){
case 'Y':
game.BARS.toggleWireframe();
break;
case 'X':
game.BARS.toggleWireframe();
break;
case 'B':
console.log('color shift');
game.BARS.colorset.push(game.BARS.colorset.shift());
for(var xpos = 0; xpos < 12; xpos++ ){
game.BARS.objects[xpos].material = new THREE.MeshBasicMaterial( { color: game.BARS.colorset[xpos], wireframe: false, wireframeLinewidth: 3, overdraw: true } );
}
break;
case 'BACK':
window.location = window.location;
break;
}
});

gamepad.bind(Gamepad.Event.BUTTON_UP, function(e) {
switch(e.control){
case 'X':
game.BARS.toggleWireframe();
break;
case 'RB':
for(b in game.BARS.objects) {
game.BARS.objects[b].rotation.x += b/game.BARS.objects.length;
}
break;
case 'LB':
for(b in game.BARS.objects) {
game.BARS.objects[b].rotation.x -= b/game.BARS.objects.length;
}
break;
case 'DPAD_UP':
game.BARS.rotation.speed += 0.01;
break;
case 'DPAD_DOWN':
game.BARS.rotation.speed -= 0.01;
break;
case 'DPAD_RIGHT':
camera.orbit.speed += 10;
break;
case 'DPAD_LEFT':
camera.orbit.speed -= 10;
break;
}
});
Loading

0 comments on commit f102275

Please sign in to comment.