// KEY CODES
var ROTATE_UP = 101; 	// e
var ROTATE_DOWN = 100; // d
var ROTATE_LEFT = 115; // s
var ROTATE_RIGHT = 102; // f

var ZOOM_IN = 61; // +/=
var ZOOM_OUT = 45; // -/_

var MOVE_UP = 38; // up arrow
var MOVE_DOWN = 40; // down arrow
var MOVE_LEFT = 37; // left arrow
var MOVE_RIGHT = 39; // right arrow
var MOVE_IN = 13; // enter
var MOVE_OUT = 8; // backspace

// flag to tell draw() the scene has been updated
var event_queue = 0; 

// MONITOR FOR KEY PRESS EVENTS
$(document).bind('keypress', function(e) 
{
	var code = (e.keyCode ? e.keyCode : e.which);
	
	// update scence accordingly
	switch(code) 
	{	
		case ROTATE_UP:
		camera.tilt(1);
		break;
		
		case ROTATE_DOWN:
		camera.tilt(0);
		break;
		
		case ROTATE_LEFT:
		camera.pan(1);
		break;
		
		case ROTATE_RIGHT:
		camera.pan(0);
		break;

		case ZOOM_IN:
		camera.zoom(1);
		break;
		
		case ZOOM_OUT:
		camera.zoom(0);
		break;
		
		case MOVE_UP:
		camera.pedestal(1);
		break;
		
		case MOVE_DOWN:
		camera.pedestal(0);
		break;
		
		case MOVE_LEFT:
		camera.truck(1);
		break;
		
		case MOVE_RIGHT:
		camera.truck(0);
		break;
		
		case MOVE_IN:
		camera.dolly(1);
		break;
		
		case MOVE_OUT:
		camera.dolly(0);
		break;
	}

	e.stopPropagation();
	event_queue = 1; 
});

// Returns TRUE when an event has occured but not yet updated in draw
function consumeEvent() {
		event_queue--;
		return event_queue + 1;
}
@@ -371,136 +371,45 @@
 %0A// 
-flag to tell draw() the scene has been updated%0Avar event_queue = 0; %0A%0A// MONITOR FOR KEY PRESS EVENTS%0A$(document).bind('
+Handle user input%0Adocument.on
 keypress
 ', f
@@ -408,11 +408,9 @@
 ress
-', 
+=
 func
@@ -421,10 +421,11 @@
 (e) 
-%0A
 %7B
+%09%0A
 %0A%09va
@@ -472,39 +472,8 @@
 h);%0A
-%09%0A%09// update scence accordingly
 %0A%09sw
@@ -1099,168 +1099,7 @@
 ();%0A
-%09event_queue = 1; %0A%7D);%0A%0A// Returns TRUE when an event has occured but not yet updated in draw%0Afunction consumeEvent() %7B%0A%09%09event_queue--;%0A%09%09return event_queue + 1;%0A%7D
+%7D;%0A

Update events.js - No more jQuery or event queue thing!