view Viewer_new/resources/keybord.js~ @ 8:e18bf5f59698

vacuum_ver5
author <e085737>
date Mon, 29 Nov 2010 16:39:20 +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 lock_on_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 lock_on_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(start_push){
        my_cube.title.hit = true;
    } 

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

}