view Vacuum/resources/keybord.js @ 0:718974a1a32b

Vacuum
author <e085737>
date Tue, 07 Dec 2010 17:31:15 +0900
parents
children
line wrap: on
line source


var currentlyPressedKeys = Object();

function HandleKeyDown(event){ 
    currentlyPressedKeys[event.keyCode] = true;
}

function HandleKeyUp(event){
    currentlyPressedKeys[event.keyCode] = false;
}

function HandleKeys() {
    var left_push     = currentlyPressedKeys[37]     /* ←  */
    var down_push     = currentlyPressedKeys[40]     /* ↓  */
    var right_push    = currentlyPressedKeys[39]     /* →  */
    var up_push       = currentlyPressedKeys[38]     /* ↑  */
    var vacuum_push   = currentlyPressedKeys[90]     /* z */
    var circle_push   = currentlyPressedKeys[88]     /* x */
    var start_push    = currentlyPressedKeys[13]     /* Enter */ 
    var zoom_in_push  = currentlyPressedKeys[75]     /* k */
    var zoom_out_push = currentlyPressedKeys[76]     /* l */



    this.right_hold = function(){
	return right_push
    }

    this.left_hold = function(){
	return left_push
    }

    this.up_hold = function(){
	return up_push
    }

    this.down_hold = function(){
	return down_push
    }

    this.vacuum_hold = function(){
	return vacuum_push
    }

    this.lock_on_hold = function(){
	return circle_push
    }

    this.start_hold = function(){
	return start_push
    }

    this.zoom_in_hold = function(){
	return zoom_in_push
    }

    this.zoom_out_hold = function(){
	return zoom_out_push
    }


    if(zoom_in_push){
        view_point += 5.0
    }
    
    if(zoom_out_push){
	view_point -= 5.0
    }

}