Virtual Gamepad Settings
If you need another layout for the virtual gamepad, you can map it yourself.
- Pull requests adding a mapping or improving a mapping are encouraged!
Example:
EJS_VirtualGamepadSettings = [
{
type: "button",
text: "Y",
id: "y",
location: "right",
left: 40,
bold: true,
input_value: 9
},
{
type: "button",
text: "X",
id: "X",
location: "right",
top: 40,
bold: true,
input_value: 1
},
{
type: "button",
text: "B",
id: "b",
location: "right",
left: 81,
top: 40,
bold: true,
input_value: 8
},
{
type: "button",
text: "A",
id: "a",
location: "right",
left: 40,
top: 80,
bold: true,
input_value: 0
},
{
type: "zone",
location: "left",
left: "50%",
top: "50%",
joystickInput: true,
color: "blue",
inputValues: [19, 18, 17, 16]
},
//Note- the dpad and the zone will overlap in this example, this is just to show what it should look like.
{
type: "dpad",
location: "left",
left: "50%",
right: "50%",
joystickInput: false,
inputValues: [4, 5, 6, 7]
},
{
type: "button",
text: "Start",
id: "start",
location: "center",
left: 60,
fontSize: 15,
block: true,
input_value: 3
},
{
type: "button",
text: "Select",
id: "select",
location: "center",
left: -5,
fontSize: 15,
block: true,
input_value: 2
}
]
Types:
zone
: The gamepad joystick.
d-pad
: A d-pad object.
button
: just a button.
Values needed for zone
type
Must be set to zone
.
location
: The area to place the joystick. Must be top
, left
, center
, or right
.
left
: The css left value (must be in a percentage).
right
: The css right value (must be in a percentage).
joystickInput
: Set this to true if the input values are [19, 18, 17, 16]
. This should only be set to true for analog inputs.
inputValues
: The values to input into the emulator. Normally either [19, 18, 17, 16]
or [4, 5, 6, 7]
.
color
: Sets the color of the zone object. Default: red
.
Values needed for dpad
type
must be set to dpad
.
location
: The area to place the dpad. Must be top
, left
, center
, or right
.
left
: the css left value (must be in a percentage).
right
: the css right value (must be in a percentage).
joystickInput
: Set this to true if the input values are [19, 18, 17, 16]
. This should only be set to true for analog inputs. Note that the dpad does not support analog values and the buttons are either down or up.
inputValues
: The values to input into the emulator. Normally either [19, 18, 17, 16]
or [4, 5, 6, 7]
.
Values needed for button
type
must be set to button
.
location
: The area to place the joystick. Must be top
, left
, center
, or right
.
text
: The inner text of the button.
block
: Will make the button appear as a block.
left
(optional): The css left value. Must be a number. Value is in px
.
right
(optional): The css right value. Must be a number. Value is in px
.
top
(optional): The css top value. Must be a number. Value is in px
.
bold
(default: false
): Will set the text in the button to be bold. Value is in px
.
fontSize
(default: 30
): Will set the text size of the button text. Value is in px
.
id
: The ID of the button. Must be unique.
input_value
: The input value. Available options can be found here.