diff --git a/examples/gamepad-tester/gamepad-tester.json b/examples/gamepad-tester/gamepad-tester.json index 96d2b3e53..53872d4d9 100644 --- a/examples/gamepad-tester/gamepad-tester.json +++ b/examples/gamepad-tester/gamepad-tester.json @@ -440,7 +440,110 @@ "windowMask": false }, "objectsGroups": [], - "variables": [], + "variables": [ + { + "name": "ButtonNames", + "type": "array", + "children": [ + { + "type": "string", + "value": "A" + }, + { + "type": "string", + "value": "B" + }, + { + "type": "string", + "value": "X" + }, + { + "type": "string", + "value": "Y" + }, + { + "type": "string", + "value": "Up" + }, + { + "type": "string", + "value": "Down" + }, + { + "type": "string", + "value": "Left" + }, + { + "type": "string", + "value": "Right" + }, + { + "type": "string", + "value": "Back" + }, + { + "type": "string", + "value": "LB" + }, + { + "type": "string", + "value": "RB" + }, + { + "type": "string", + "value": "LT" + }, + { + "type": "string", + "value": "RT" + }, + { + "type": "string", + "value": "Click_Stick_Left" + }, + { + "type": "string", + "value": "Click_Stick_Right" + } + ] + }, + { + "name": "StickNames", + "type": "array", + "children": [ + { + "type": "string", + "value": "Left" + }, + { + "type": "string", + "value": "Right" + } + ] + }, + { + "name": "Directions", + "type": "array", + "children": [ + { + "type": "string", + "value": "Up" + }, + { + "type": "string", + "value": "Down" + }, + { + "type": "string", + "value": "Left" + }, + { + "type": "string", + "value": "Right" + } + ] + } + ], "instances": [], "objects": [ { @@ -592,6 +695,437 @@ "value": 0 } ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "disabled": true, + "name": "Debug", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"Gamepad count \" + ToString(Gamepads::GamepadCount()) + NewLine()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Repeat", + "repeatExpression": "4", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "PlayerId", + "+", + "1" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "NewLine()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Controller_X_is_connected" + }, + "parameters": [ + "", + "PlayerId", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"Gamepad \" + PlayerId + \" is connected\" + NewLine()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"Type: \" + Gamepads::GamepadType(PlayerId) + NewLine()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"Dead zone \" + ToString(Gamepads::Deadzone(PlayerId)) + NewLine()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"Last button: \" + Gamepads::LastButtonString(PlayerId, \"Xbox\") + \" (\" + ToString(Gamepads::LastButtonID(PlayerId)) + \")\" + NewLine()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Any_Button_pressed" + }, + "parameters": [ + "", + "PlayerId", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"some button is pressed\" + NewLine()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_any_button_released" + }, + "parameters": [ + "", + "PlayerId", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"some button is released\" + NewLine()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "ButtonNames", + "valueIteratorVariableName": "ButtonName", + "keyIteratorVariableName": "", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "PlayerId", + "ButtonName", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "ButtonName + \" is pressed\" + NewLine()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_released" + }, + "parameters": [ + "", + "PlayerId", + "ButtonName", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "ButtonName + \" is released\" + NewLine()" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "StickNames", + "valueIteratorVariableName": "StickName", + "keyIteratorVariableName": "", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::StickForce" + }, + "parameters": [ + "", + "!=", + "0", + "PlayerId", + "StickName", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "StickName + \" stick is pushed \" + ToString(Gamepads::StickForce(PlayerId, StickName)) + \" at \" + ToString(Gamepads::StickAngle(PlayerId, StickName)) + \"°\" + NewLine()" + ] + }, + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "StickName + \" stick is pushed \" + ToString(Gamepads::StickForceX(PlayerId, StickName)) + \" ; \" + ToString(Gamepads::StickForceY(PlayerId, StickName)) + \"°\" + NewLine()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "Directions", + "valueIteratorVariableName": "Directions", + "keyIteratorVariableName": "", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Axis_pushed" + }, + "parameters": [ + "", + "PlayerId", + "StickName", + "Direction", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "StickName + \" stick is pushed \" + Direction + NewLine()" + ] + } + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "PlayerId", + "\"LT\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"Left trigger is pressed \" + ToString(Gamepads::TriggerPressure(PlayerId, \"LT\")) + NewLine()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "Gamepads::C_Button_pressed" + }, + "parameters": [ + "", + "PlayerId", + "\"RT\"", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "Log", + "+", + "\"Right trigger is pressed \" + ToString(Gamepads::TriggerPressure(PlayerId, \"RT\")) + NewLine()" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "Log", + "\"info\"", + "" + ] + } + ] + } + ], + "variables": [ + { + "name": "PlayerId", + "type": "number", + "value": 0 + }, + { + "name": "Log", + "type": "string", + "value": "" + }, + { + "name": "ButtonName", + "type": "string", + "value": "" + }, + { + "name": "StickName", + "type": "string", + "value": "" + }, + { + "name": "Direction", + "type": "string", + "value": "" + } + ] + } + ], + "parameters": [] } ], "layers": [