mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-11 08:00:21 +00:00
added tooltips
This commit is contained in:
@@ -189,6 +189,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
GamepadInput.mapping = {a:0,b:1,x:2,y:3,lb:4,rb:5,lt:6,rt:7,back:8,start:9,ls:10,rs:11 };
|
||||
GamepadInput.mapping_array = ["a","b","x","y","lb","rb","lt","rt","back","start","ls","rs"];
|
||||
|
||||
GamepadInput.prototype.getGamepad = function() {
|
||||
var getGamepads =
|
||||
navigator.getGamepads ||
|
||||
@@ -232,75 +235,44 @@
|
||||
for (var j = 0; j < gamepad.buttons.length; j++) {
|
||||
this._current_buttons[j] = gamepad.buttons[j].pressed;
|
||||
|
||||
//mapping of XBOX
|
||||
switch (
|
||||
j //I use a switch to ensure that a player with another gamepad could play
|
||||
) {
|
||||
case 0:
|
||||
xbox.buttons["a"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 1:
|
||||
xbox.buttons["b"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 2:
|
||||
xbox.buttons["x"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 3:
|
||||
xbox.buttons["y"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 4:
|
||||
xbox.buttons["lb"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 5:
|
||||
xbox.buttons["rb"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 6:
|
||||
xbox.buttons["lt"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 7:
|
||||
xbox.buttons["rt"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 8:
|
||||
xbox.buttons["back"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 9:
|
||||
xbox.buttons["start"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 10:
|
||||
xbox.buttons["ls"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 11:
|
||||
xbox.buttons["rs"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
case 12:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "up";
|
||||
xbox.hatmap |= GamepadInput.UP;
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "down";
|
||||
xbox.hatmap |= GamepadInput.DOWN;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "left";
|
||||
xbox.hatmap |= GamepadInput.LEFT;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "right";
|
||||
xbox.hatmap |= GamepadInput.RIGHT;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
xbox.buttons["home"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
if(j < 12)
|
||||
{
|
||||
xbox.buttons[ GamepadInput.mapping_array[j] ] = gamepad.buttons[j].pressed;
|
||||
if(gamepad.buttons[j].was_pressed)
|
||||
this.trigger( GamepadInput.mapping_array[j] + "_button_event" );
|
||||
}
|
||||
else //mapping of XBOX
|
||||
switch ( j ) //I use a switch to ensure that a player with another gamepad could play
|
||||
{
|
||||
case 12:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "up";
|
||||
xbox.hatmap |= GamepadInput.UP;
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "down";
|
||||
xbox.hatmap |= GamepadInput.DOWN;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "left";
|
||||
xbox.hatmap |= GamepadInput.LEFT;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if (gamepad.buttons[j].pressed) {
|
||||
xbox.hat += "right";
|
||||
xbox.hatmap |= GamepadInput.RIGHT;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
xbox.buttons["home"] = gamepad.buttons[j].pressed;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
gamepad.xbox = xbox;
|
||||
return gamepad;
|
||||
@@ -358,6 +330,16 @@
|
||||
["rs_button", "number"],
|
||||
["start_button", "number"],
|
||||
["back_button", "number"],
|
||||
["a_button_event", LiteGraph.EVENT ],
|
||||
["b_button_event", LiteGraph.EVENT ],
|
||||
["x_button_event", LiteGraph.EVENT ],
|
||||
["y_button_event", LiteGraph.EVENT ],
|
||||
["lb_button_event", LiteGraph.EVENT ],
|
||||
["rb_button_event", LiteGraph.EVENT ],
|
||||
["ls_button_event", LiteGraph.EVENT ],
|
||||
["rs_button_event", LiteGraph.EVENT ],
|
||||
["start_button_event", LiteGraph.EVENT ],
|
||||
["back_button_event", LiteGraph.EVENT ],
|
||||
["hat_left", "number"],
|
||||
["hat_right", "number"],
|
||||
["hat_up", "number"],
|
||||
|
||||
Reference in New Issue
Block a user