update gamepad/gamepad.d.ts

This commit is contained in:
Toshiya Nakakura
2014-12-03 13:34:08 +09:00
parent bd0833a22e
commit f56398eb68
2 changed files with 8 additions and 5 deletions
+3 -3
View File
@@ -51,9 +51,9 @@
if(pad){
for (var k = 0; k < pad.buttons.length; k++)
{
var button = pad.buttons[k];
if(button !== 0){
console.log('pad[' + pad.index + ']: ' + 'time=' + pad.timestamp + ' id="' + pad.id + '" button[' + k + '] = ' + button);
var button = pad.buttons[k];
if(button.pressed){
console.log('pad[' + pad.index + ']: ' + 'time=' + pad.timestamp + ' id="' + pad.id + '" button[' + k + '] = ' + button.value);
}
}
for (var k = 0; k < pad.axes.length; k++)
+5 -2
View File
@@ -36,7 +36,7 @@ declare module Gamepad{
* Array of values for all buttons of the gamepad. All button values must be linearly normalized to the range [0.0 .. 1.0]. 0.0 must mean fully unpressed, and 1.0 must mean fully pressed. It is recommended that buttons appear in decreasing importance such that the primary button, secondary button, tertiary button, and so on appear as elements 0, 1, 2, ... in the buttons array.
* @readonly
*/
buttons:number[];
buttons:GamepadButton[];
}
/**
@@ -55,7 +55,10 @@ declare module Gamepad{
length: number;
}
export interface GamepadButton{
pressed: boolean;
value: number;
}
/*
* @event gamepadconnected