Merge pull request #3258 from nakakura/gamepad-updating2

update gamepad/gamepad.d.ts
This commit is contained in:
Masahiro Wakame
2014-12-05 03:32:13 +09:00
2 changed files with 8 additions and 5 deletions

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++)

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