Translations:Touch controls/23/en
Appearance
- Position and size (attributes
"x"
,"y"
,"w"
,"h"
): the X/Y position and width/height are integers on a 1,000,000² grid. These unit grid values are converted to screen grid values at runtime in relation to the size and aspect ratio of the screen. This means buttons may appear stretched if the resolution is changed, but it allows us to provide a reasonable default for slightly different aspect ratios. - Shape (attribute
"shape"
): determines the shape of the button being rendered."rect"
: rectangle shape."circle"
: circle shape. The button size will automatically be adjusted so that width and height are identical.
- Visibility (attribute
"visibilities"
): an array of predefined visibility classes can be selected and the button is only shown if all conditions are satisfied. An empty array means that the button is always shown. The following visibility classes are defined:"ingame"
: player is ingame, i.e. not spectating."extra-menu"
,"extra-menu-2"
,"extra-menu-3"
,"extra-menu-4"
,"extra-menu-5"
: the extra menu with the given number is activated."zoom-allowed"
: zoom is allowed on this server."vote-active"
: a vote is currently active."dummy-allowed"
: dummy is allowed on this server."dummy-connected"
: dummy is currently connected."rcon-authed"
: player is currently authed in rcon."demo-player"
: demo player is currently active.- All visibility classes can be inverted by prefixing them with
-
, e.g."-ingame"
is satisfied when the player is not ingame, i.e. spectating.
- Behavior (attribute
"behavior"
): an object which describes the behavior of this touch button when it is activated/deactivated as well as its label. The attribute"type"
is used to differentiate which type of behavior is used. The behavior is either predefined (hard-coded) or based on generic console commands (like binds). Predefined behavior is only used where necessary, all other buttons are represented as generic binds.- Predefined behavior (attribute
"type"
set to"predefined"
): The attribute"id"
is set to a fixed string value which determines the specific predefined behavior. The following predefined behaviors can be used:"ingame-menu"
: Opens the ingame menu immediately when released."extra-menu"
: The extra menu button which toggles visibility of buttons with"extra-menu"
,"extra-menu-2"
,"extra-menu-3"
,"extra-menu-4"
and"extra-menu-5"
visibilities. Also opens the ingame menu on long press.- The attribute
"number"
specifies an integer between 1 and 5 to associate this button with the respective visibilities"extra-menu"
,"extra-menu-2"
,"extra-menu-3"
,"extra-menu-4"
,"extra-menu-5"
. If no"number"
is given, it will be set to1
automatically.
- The attribute
"emoticon"
: Opens the emoticon selector (this does not work with binds)."spectate"
: Opens the spectator menu (this does not work with binds)."swap-action"
: Swaps the active action (fire and hook) for direct touch input and virtual joysticks."use-action"
: Uses the active action with the current aiming position."joystick-action"
: Virtual joystick which uses the active action."joystick-aim"
: Virtual joystick which only aims without using an action."joystick-fire"
: Virtual joystick which always uses fire."joystick-hook"
: Virtual joystick which always uses hook.
- Bind behavior (attribute
"type"
set to"bind"
). Buttons with this behavior execute console commands like regular key binds.- The attribute
"label"
specifies as a string the label of the button. - The attribute
"label-type"
specifies as a string the type of the label of the button, i.e. how the attribute"label"
is interpreted:"plain"
: Label is used as is. If no"label-type"
is given, it will be set to"plain"
automatically."localized"
: Label is localized. Only usable for the default buttons for which there are translations available."icon"
: Icon font is used for the label. Icons must be encoded in UTF-16 using\uXXXX
, e.g.\uf3ce
for the mobile phone icon which has unicodef3ce
. Note that the icon must be available in the icon font that comes with DDNet, Font Awesome Free.
- The attribute
"command"
specifies as a string the command to execute in the console like a bind when this button is used, e.g."+fire"
for a button that uses the fire action.
- The attribute
- Bind toggle behavior (attribute
type
set to"bind-toggle"
). Buttons with this behavior cycle between executing one of two or more specified commands.- The attribute
"commands"
specifies an array of two or more commands in the order in which they are shown and executed. Each command is an object with the attributes"label"
,"label-type"
and"command"
which are defined the same as for the bind behavior described above. At least two command objects must be specified in the array.
- The attribute
- Predefined behavior (attribute