Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Contribution Scores
Random page
Help about MediaWiki
External Links
Homepage
Discord
Forum
Funding
DDraceNetwork
Search
Search
English
Create account
Log in
Personal tools
Create account
Log in
Export translations
Translate
English
Language statistics
Message group statistics
Export
Tools
Tools
move to sidebar
hide
Actions
Language statistics
Message group statistics
Export
General
Special pages
Printable version
Settings
Group
Aled
Android Tutorial for DDNet 9.3.1
Automapper
Binds
Block
Bomb
Catch16
Category:Templates
Collision
Common Terminology
DDRace
Death
Deepfly
Demos
Development
Drag Part
Dragger
Dummy
Dummy drag
Edge jump
Extra tools
FAQ
FNG
Foot
Freeze
Getting started
GFX Troubleshooting
Gores
Grenade
Hammer
Hammerfly
Hammerhit
Hook
Hookfly
How to contribute
Infection
Jetpack
Jump
KoG
LAN Server
Laser
Main Page
Map
Mapping
Monster
Movement
Ninja
Pistol
Pseudofly
Ranks and Points
Resources
Rocketfly
Settings and Commands
Shotgun
Shotgunfly
Skin Creation
Speedups
Stoppers
Switch layer
Teams
TeeSmash
TeeWare
Telegun
Teleporter
Teleportfly
Template:Infobox mod
Template:Infobox weapon
Template:MigrateTranslationText
Template:Note
Template:Stub
Template:Tip
Template:Todo
Template:Warning
Ticks
Tiles
Timeline
Touch controls
Troubleshooting
Tune zones
Vanilla
World
ZCatch
Language
aa - Afar
aae - Arbëresh
ab - Abkhazian
abs - Ambonese Malay
ace - Achinese
acm - Iraqi Arabic
ady - Adyghe
ady-cyrl - Adyghe (Cyrillic script)
aeb - Tunisian Arabic
aeb-arab - Tunisian Arabic (Arabic script)
aeb-latn - Tunisian Arabic (Latin script)
af - Afrikaans
aln - Gheg Albanian
alt - Southern Altai
am - Amharic
ami - Amis
an - Aragonese
ang - Old English
ann - Obolo
anp - Angika
ar - Arabic
arc - Aramaic
arn - Mapuche
arq - Algerian Arabic
ary - Moroccan Arabic
arz - Egyptian Arabic
as - Assamese
ase - American Sign Language
ast - Asturian
atj - Atikamekw
av - Avaric
avk - Kotava
awa - Awadhi
ay - Aymara
az - Azerbaijani
azb - South Azerbaijani
ba - Bashkir
ban - Balinese
ban-bali - Balinese (Balinese script)
bar - Bavarian
bbc - Batak Toba
bbc-latn - Batak Toba (Latin script)
bcc - Southern Balochi
bci - Baoulé
bcl - Central Bikol
bdr - West Coast Bajau
be - Belarusian
be-tarask - Belarusian (Taraškievica orthography)
bew - Betawi
bg - Bulgarian
bgn - Western Balochi
bh - Bhojpuri
bho - Bhojpuri
bi - Bislama
bjn - Banjar
blk - Pa'O
bm - Bambara
bn - Bangla
bo - Tibetan
bpy - Bishnupriya
bqi - Bakhtiari
br - Breton
brh - Brahui
bs - Bosnian
btm - Batak Mandailing
bto - Iriga Bicolano
bug - Buginese
bxr - Russia Buriat
ca - Catalan
cbk-zam - Chavacano
cdo - Mindong
ce - Chechen
ceb - Cebuano
ch - Chamorro
chn - Chinook Jargon
cho - Choctaw
chr - Cherokee
chy - Cheyenne
ckb - Central Kurdish
co - Corsican
cps - Capiznon
cpx - Pu–Xian Min
cpx-hans - Pu–Xian Min (Simplified Han script)
cpx-hant - Pu–Xian Min (Traditional Han script)
cpx-latn - Pu–Xian Min (Latin script)
cr - Cree
crh - Crimean Tatar
crh-cyrl - Crimean Tatar (Cyrillic script)
crh-latn - Crimean Tatar (Latin script)
crh-ro - Dobrujan Tatar
cs - Czech
csb - Kashubian
cu - Church Slavic
cv - Chuvash
cy - Welsh
da - Danish
dag - Dagbani
de - German
de-at - Austrian German
de-ch - Swiss High German
de-formal - German (formal address)
dga - Dagaare
din - Dinka
diq - Zazaki
dsb - Lower Sorbian
dtp - Central Dusun
dty - Doteli
dv - Divehi
dz - Dzongkha
ee - Ewe
efi - Efik
egl - Emilian
el - Greek
eml - Emiliano-Romagnolo
en - English
en-ca - Canadian English
en-gb - British English
eo - Esperanto
es - Spanish
es-419 - Latin American Spanish
es-formal - Spanish (formal address)
et - Estonian
eu - Basque
ext - Extremaduran
fa - Persian
fat - Fanti
ff - Fula
fi - Finnish
fit - Tornedalen Finnish
fj - Fijian
fo - Faroese
fon - Fon
fr - French
frc - Cajun French
frp - Arpitan
frr - Northern Frisian
fur - Friulian
fy - Western Frisian
ga - Irish
gaa - Ga
gag - Gagauz
gan - Gan
gan-hans - Gan (Simplified Han script)
gan-hant - Gan (Traditional Han script)
gcf - Guadeloupean Creole
gcr - Guianan Creole
gd - Scottish Gaelic
gl - Galician
gld - Nanai
glk - Gilaki
gn - Guarani
gom - Goan Konkani
gom-deva - Goan Konkani (Devanagari script)
gom-latn - Goan Konkani (Latin script)
gor - Gorontalo
got - Gothic
gpe - Ghanaian Pidgin
grc - Ancient Greek
gsw - Alemannic
gu - Gujarati
guc - Wayuu
gur - Frafra
guw - Gun
gv - Manx
ha - Hausa
hak - Hakka Chinese
haw - Hawaiian
he - Hebrew
hi - Hindi
hif - Fiji Hindi
hif-latn - Fiji Hindi (Latin script)
hil - Hiligaynon
hno - Northern Hindko
ho - Hiri Motu
hr - Croatian
hrx - Hunsrik
hsb - Upper Sorbian
hsn - Xiang
ht - Haitian Creole
hu - Hungarian
hu-formal - Hungarian (formal address)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
ibb - Ibibio
id - Indonesian
ie - Interlingue
ig - Igbo
igl - Igala
ii - Sichuan Yi
ik - Inupiaq
ike-cans - Eastern Canadian (Aboriginal syllabics)
ike-latn - Eastern Canadian (Latin script)
ilo - Iloko
inh - Ingush
io - Ido
is - Icelandic
it - Italian
iu - Inuktitut
ja - Japanese
jam - Jamaican Creole English
jbo - Lojban
jut - Jutish
jv - Javanese
ka - Georgian
kaa - Kara-Kalpak
kab - Kabyle
kai - Karekare
kbd - Kabardian
kbd-cyrl - Kabardian (Cyrillic script)
kbp - Kabiye
kcg - Tyap
kea - Kabuverdianu
kg - Kongo
kge - Komering
khw - Khowar
ki - Kikuyu
kiu - Kirmanjki
kj - Kuanyama
kjh - Khakas
kjp - Eastern Pwo
kk - Kazakh
kk-arab - Kazakh (Arabic script)
kk-cn - Kazakh (China)
kk-cyrl - Kazakh (Cyrillic script)
kk-kz - Kazakh (Kazakhstan)
kk-latn - Kazakh (Latin script)
kk-tr - Kazakh (Turkey)
kl - Kalaallisut
km - Khmer
kn - Kannada
ko - Korean
ko-kp - Korean (North Korea)
koi - Komi-Permyak
kr - Kanuri
krc - Karachay-Balkar
kri - Krio
krj - Kinaray-a
krl - Karelian
ks - Kashmiri
ks-arab - Kashmiri (Arabic script)
ks-deva - Kashmiri (Devanagari script)
ksh - Colognian
ksw - S'gaw Karen
ku - Kurdish
ku-arab - Kurdish (Arabic script)
ku-latn - Kurdish (Latin script)
kum - Kumyk
kus - Kʋsaal
kv - Komi
kw - Cornish
ky - Kyrgyz
la - Latin
lad - Ladino
lb - Luxembourgish
lbe - Lak
lez - Lezghian
lfn - Lingua Franca Nova
lg - Ganda
li - Limburgish
lij - Ligurian
liv - Livonian
lki - Laki
lld - Ladin
lmo - Lombard
ln - Lingala
lo - Lao
loz - Lozi
lrc - Northern Luri
lt - Lithuanian
ltg - Latgalian
lus - Mizo
luz - Southern Luri
lv - Latvian
lzh - Literary Chinese
lzz - Laz
mad - Madurese
mag - Magahi
mai - Maithili
map-bms - Basa Banyumasan
mdf - Moksha
mg - Malagasy
mh - Marshallese
mhr - Eastern Mari
mi - Māori
min - Minangkabau
mk - Macedonian
ml - Malayalam
mn - Mongolian
mnc - Manchu
mnc-latn - Manchu (Latin script)
mnc-mong - Manchu (Mongolian script)
mni - Manipuri
mnw - Mon
mo - Moldovan
mos - Mossi
mr - Marathi
mrh - Mara
mrj - Western Mari
ms - Malay
ms-arab - Malay (Jawi script)
mt - Maltese
mus - Muscogee
mwl - Mirandese
my - Burmese
myv - Erzya
mzn - Mazanderani
na - Nauru
nah - Nāhuatl
nan - Minnan
nap - Neapolitan
nb - Norwegian Bokmål
nds - Low German
nds-nl - Low Saxon
ne - Nepali
new - Newari
ng - Ndonga
nia - Nias
nit - కొలామి
niu - Niuean
nl - Dutch
nl-informal - Dutch (informal address)
nmz - Nawdm
nn - Norwegian Nynorsk
no - Norwegian
nod - Northern Thai
nog - Nogai
nov - Novial
nqo - N’Ko
nrm - Norman
nso - Northern Sotho
nv - Navajo
ny - Nyanja
nyn - Nyankole
nyo - Nyoro
nys - Nyungar
oc - Occitan
ojb - Northwestern Ojibwa
olo - Livvi-Karelian
om - Oromo
or - Odia
os - Ossetic
pa - Punjabi
pag - Pangasinan
pam - Pampanga
pap - Papiamento
pcd - Picard
pcm - Nigerian Pidgin
pdc - Pennsylvania German
pdt - Plautdietsch
pfl - Palatine German
pi - Pali
pih - Norfuk / Pitkern
pl - Polish
pms - Piedmontese
pnb - Western Punjabi
pnt - Pontic
prg - Prussian
ps - Pashto
pt - Portuguese
pt-br - Brazilian Portuguese
pwn - Paiwan
qqq - Message documentation
qu - Quechua
qug - Chimborazo Highland Quichua
rgn - Romagnol
rif - Riffian
rki - Arakanese
rm - Romansh
rmc - Carpathian Romani
rmy - Vlax Romani
rn - Rundi
ro - Romanian
roa-tara - Tarantino
rsk - Pannonian Rusyn
ru - Russian
rue - Rusyn
rup - Aromanian
ruq - Megleno-Romanian
ruq-cyrl - Megleno-Romanian (Cyrillic script)
ruq-latn - Megleno-Romanian (Latin script)
rut - Rutul
rw - Kinyarwanda
ryu - Okinawan
sa - Sanskrit
sah - Yakut
sat - Santali
sc - Sardinian
scn - Sicilian
sco - Scots
sd - Sindhi
sdc - Sassarese Sardinian
sdh - Southern Kurdish
se - Northern Sami
se-fi - Northern Sami (Finland)
se-no - Northern Sami (Norway)
se-se - Northern Sami (Sweden)
sei - Seri
ses - Koyraboro Senni
sg - Sango
sgs - Samogitian
sh - Serbo-Croatian
sh-cyrl - Serbo-Croatian (Cyrillic script)
sh-latn - Serbo-Croatian (Latin script)
shi - Tachelhit
shi-latn - Tachelhit (Latin script)
shi-tfng - Tachelhit (Tifinagh script)
shn - Shan
shy - Shawiya
shy-latn - Shawiya (Latin script)
si - Sinhala
simple - Simple English
sjd - Kildin Sami
sje - Pite Sami
sk - Slovak
skr - Saraiki
skr-arab - Saraiki (Arabic script)
sl - Slovenian
sli - Lower Silesian
sm - Samoan
sma - Southern Sami
smn - Inari Sami
sms - Skolt Sami
sn - Shona
so - Somali
sq - Albanian
sr - Serbian
sr-ec - Serbian (Cyrillic script)
sr-el - Serbian (Latin script)
srn - Sranan Tongo
sro - Campidanese Sardinian
ss - Swati
st - Southern Sotho
stq - Saterland Frisian
sty - Siberian Tatar
su - Sundanese
sv - Swedish
sw - Swahili
syl - Sylheti
szl - Silesian
szy - Sakizaya
ta - Tamil
tay - Tayal
tcy - Tulu
tdd - Tai Nuea
te - Telugu
tet - Tetum
tg - Tajik
tg-cyrl - Tajik (Cyrillic script)
tg-latn - Tajik (Latin script)
th - Thai
ti - Tigrinya
tk - Turkmen
tl - Tagalog
tly - Talysh
tly-cyrl - Talysh (Cyrillic script)
tn - Tswana
to - Tongan
tok - Toki Pona
tpi - Tok Pisin
tr - Turkish
tru - Turoyo
trv - Taroko
ts - Tsonga
tt - Tatar
tt-cyrl - Tatar (Cyrillic script)
tt-latn - Tatar (Latin script)
ttj - Tooro
tum - Tumbuka
tw - Twi
ty - Tahitian
tyv - Tuvinian
tzm - Central Atlas Tamazight
udm - Udmurt
ug - Uyghur
ug-arab - Uyghur (Arabic script)
ug-latn - Uyghur (Latin script)
uk - Ukrainian
ur - Urdu
uz - Uzbek
uz-cyrl - Uzbek (Cyrillic script)
uz-latn - Uzbek (Latin script)
ve - Venda
vec - Venetian
vep - Veps
vi - Vietnamese
vls - West Flemish
vmf - Main-Franconian
vmw - Makhuwa
vo - Volapük
vot - Votic
vro - Võro
wa - Walloon
wal - Wolaytta
war - Waray
wls - Wallisian
wo - Wolof
wuu - Wu
wuu-hans - Wu (Simplified Han script)
wuu-hant - Wu (Traditional Han script)
xal - Kalmyk
xh - Xhosa
xmf - Mingrelian
xsy - Saisiyat
yi - Yiddish
yo - Yoruba
yrl - Nheengatu
yue - Cantonese
yue-hans - Cantonese (Simplified Han script)
yue-hant - Cantonese (Traditional Han script)
za - Zhuang
zea - Zeelandic
zgh - Standard Moroccan Tamazight
zh - Chinese
zh-cn - Chinese (China)
zh-hans - Simplified Chinese
zh-hant - Traditional Chinese
zh-hk - Chinese (Hong Kong)
zh-mo - Chinese (Macau)
zh-my - Chinese (Malaysia)
zh-sg - Chinese (Singapore)
zh-tw - Chinese (Taiwan)
zu - Zulu
Format
Export for off-line translation
Export in native format
Export in CSV format
Fetch
<languages/> <div lang="en" dir="ltr" class="mw-content-ltr"> Touch controls are available in the DDNet client since version 18.8, which also marks the first recent release of the client for Android. The previous version for Android is DDNet 9.3.1 for which a [[Special:MyLanguage/Android Tutorial for DDNet 9.3.1|separate tutorial]] exists. In the following we will only consider the touch controls as of versions 18.8 and newer. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The user interface can be used with touch controls as follows: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * Touch anywhere to move the cursor and perform a left click. * Touch and hold for at least 0.5 seconds on roughly the same position to perform a right click. * Use two fingers to scroll up and down in scrollable lists like the server browser and in the console. * On Android: Use the (virtual) Back button like the Escape key to close menus etc. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The ingame touch controls can be enabled/disabled with the config variable <code>cl_touch_controls</code>, which defaults to <code>1</code> on Android and <code>0</code> on other platforms. Touch controls should also work on other platforms that support touch devices, but this guide has primarily been tested on Android. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The ingame touch controls consist of various on-screen touch buttons. The different buttons are only shown when they are usable depending on the context, e.g. buttons for movement are only shown when ingame. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Default touch button configuration == </div> [[File:Touch Controls Default.png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Screenshot of the default touch controls ingame.</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> Movement buttons for left, right and jump actions are arranged in a <code>⊥</code>-pattern similar to WASD controls. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> For the fire and hook action, two modes are implemented: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> # Direct touch input: the mouse is moved exactly where the player touches on the screen. # Virtual joystick: a button is used to emulate a joystick, which moves the mouse relative to the center of the screen. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> In either mode, a button is used to switch between the active actions (fire and hook). While the virtual joystick is being held down, this button uses the other action directly instead of switching it. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The direct touch input mode can be adjusted separately for ingame/spectating, to prevent accidental direct touch input when using a joystick. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When spectating, direct touch input is used to allow panning the map directly like in an image/map viewer. Virtual joysticks can also be used to pan the map while spectating. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Two separate buttons are shown to switch to the previous and next weapons. </div> [[File:Touch Controls Default All.png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Screenshot of the default touch controls ingame with all buttons being previewed.</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> A hamburger menu button <code>☰</code> is used to toggle the visibility of lesser used touch buttons. This includes buttons for showing the scoreboard, showing the emoticon selector, showing the spectator menu, opening team and team chat, voting yes/no, and zooming. Long pressing the hamburger menu button will open the ingame menu. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When the dummy is connected, a button for swapping between main and dummy is shown. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The emoticon selector and spectator menu are activated with the respective touch buttons and can be deactivated by touching outside of them or by using the back-button, as toggling them while the ingame touch button is pressed down is currently not feasible and also inconvenient at least for using the spectator menu. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Touch button configuration format == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The default button layout described above is loaded from the file <code>touch_controls.json</code> in the <code>data</code> directory which should not be modified. This layout can be overridden by creating a file <code>touch_controls.json</code> in the config directory. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The touch button configuration is a text file in JSON format. It is recommended to first learn the basics of the JSON format to understand the following guide. The configuration must be a valid JSON file. Guides and validation tools for the JSON format are available on the internet. The structure of the JSON file is described in the following. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The root element in the JSON file must be an object. The attribute <code>"touch-buttons"</code> of the root object specifies an array of touch button objects. Each touch button object has the following adjustable properties: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * Position and size (attributes <code>"x"</code>, <code>"y"</code>, <code>"w"</code>, <code>"h"</code>): 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 <code>"shape"</code>): determines the shape of the button being rendered. ** <code>"rect"</code>: rectangle shape. ** <code>"circle"</code>: circle shape. The button size will automatically be adjusted so that width and height are identical. * Visibility (attribute <code>"visibilities"</code>): 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: ** <code>"ingame"</code>: player is ingame, i.e. not spectating. ** <code>"extra-menu"</code>, <code>"extra-menu-2"</code>, <code>"extra-menu-3"</code>, <code>"extra-menu-4"</code>, <code>"extra-menu-5"</code>: the extra menu with the given number is activated. ** <code>"zoom-allowed"</code>: zoom is allowed on this server. ** <code>"vote-active"</code>: a vote is currently active. ** <code>"dummy-allowed"</code>: dummy is allowed on this server. ** <code>"dummy-connected"</code>: dummy is currently connected. ** <code>"rcon-authed"</code>: player is currently authed in rcon. ** <code>"demo-player"</code>: demo player is currently active. ** All visibility classes can be inverted by prefixing them with <code>-</code>, e.g. <code>"-ingame"</code> is satisfied when the player is not ingame, i.e. spectating. * Behavior (attribute <code>"behavior"</code>): an object which describes the behavior of this touch button when it is activated/deactivated as well as its label. The attribute <code>"type"</code> 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 <code>"type"</code> set to <code>"predefined"</code>): The attribute <code>"id"</code> is set to a fixed string value which determines the specific predefined behavior. The following predefined behaviors can be used: *** <code>"ingame-menu"</code>: Opens the ingame menu immediately when released. *** <code>"extra-menu"</code>: The extra menu button which toggles visibility of buttons with <code>"extra-menu"</code>, <code>"extra-menu-2"</code>, <code>"extra-menu-3"</code>, <code>"extra-menu-4"</code> and <code>"extra-menu-5"</code> visibilities. Also opens the ingame menu on long press. **** The attribute <code>"number"</code> specifies an integer between 1 and 5 to associate this button with the respective visibilities <code>"extra-menu"</code>, <code>"extra-menu-2"</code>, <code>"extra-menu-3"</code>, <code>"extra-menu-4"</code>, <code>"extra-menu-5"</code>. *** <code>"emoticon"</code>: Opens the emoticon selector (this does not work with binds). *** <code>"spectate"</code>: Opens the spectator menu (this does not work with binds). *** <code>"swap-action"</code>: Swaps the active action (fire and hook) for direct touch input and virtual joysticks. *** <code>"use-action"</code>: Uses the active action with the current aiming position. *** <code>"joystick-action"</code>: Virtual joystick which uses the active action. *** <code>"joystick-aim"</code>: Virtual joystick which only aims without using an action. *** <code>"joystick-fire"</code>: Virtual joystick which always uses fire. *** <code>"joystick-hook"</code>: Virtual joystick which always uses hook. ** Bind behavior (attribute <code>"type"</code> set to <code>"bind"</code>). Buttons with this behavior execute console commands like regular key binds. *** The attribute <code>"label"</code> specifies as a string the label of the button. *** The attribute <code>"label-type"</code> specifies as a string the type of the label of the button, i.e. how the attribute <code>"label"</code> is interpreted: **** <code>"plain"</code>: Label is used as is. **** <code>"localized"</code>: Label is localized. Only usable for the default buttons for which there are translations available. **** <code>"icon"</code>: Icon font is used for the label. Icons must be encoded in UTF-16 using <code>\uXXXX</code>, e.g. <code>\uf3ce</code> for the mobile phone icon which has unicode <code>f3ce</code>. Note that the icon must be available in the icon font that comes with DDNet, [https://fontawesome.com/search?o=r&m=free Font Awesome Free]. *** The attribute <code>"command"</code> specifies as a string the command to execute in the console like a bind when this button is used, e.g. <code>"+fire"</code> for a button that uses the fire action. ** Bind toggle behavior (attribute <code>type</code> set to <code>"bind-toggle"</code>). Buttons with this behavior cycle between executing one of two or more specified commands. *** The attribute <code>"commands"</code> 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 <code>"label"</code>, <code>"label-type"</code> and <code>"command"</code> which are defined the same as for the bind behavior described above. At least two command objects must be specified in the array. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The root object additionally has the following attributes: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * <code>"direct-touch-ingame"</code>: specifies the mode of direct touch input while ingame. Possible values: ** <code>"disabled"</code>: Direct touch input is not used while ingame. This means a virtual joystick is necessary. ** <code>"action"</code>: Direct touch input uses the active action (see above). ** <code>"aim"</code>: Direct touch input only changes the aiming position without using an action. This means separate buttons for using the actions are necessary. ** <code>"fire"</code>: Direct touch input always uses fire. ** <code>"hook"</code>: Direct touch input always uses hook. * <code>"direct-touch-spectate"</code>: specifies the mode of direct touch input while spectating. Possible values: ** <code>"disabled"</code>: Direct touch input is not used while spectating. This means a virtual joystick is necessary. ** <code>"aim"</code>: Direct touch input is used for spectating. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Ingame menu buttons == </div> [[File:Touch Controls Menu Bar.png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Screenshot of the additional buttons in the ingame menu when touch controls are enabled.</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> In addition to the separate on-screen touch controls, a second row is added to the main page of the ingame menu when <code>cl_touch_controls</code> is enabled for less frequently used functions which are otherwise not usable without a keyboard: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * Buttons to open the local and remote consoles. Opening the local console without the touch controls is useful because error messages would be shown there if the touch controls configuration could not be loaded. * Button to close the menu, which is more convenient than using the virtual back button if it's not always shown. * Checkbox for toggling the touch controls editor UI (see below). </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Ingame touch controls editor == </div> [[File:Touch Controls Menu Editor.png|thumb|<span lang="en" dir="ltr" class="mw-content-ltr">Screenshot of the ingame touch controls editor user interface.</span>]] <div lang="en" dir="ltr" class="mw-content-ltr"> The user interface to adjust the touch controls is rendered over the main screen of the ingame menu when enabled. For now, the touch controls editor is limited to basic configuration management functions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * Saving the configuration to the <code>touch_controls.json</code> file in the config directory. * Discarding the current changes by reloading the <code>touch_controls.json</code> file from the config directory. * Restoring the default configuration by reloading the <code>touch_controls.json</code> file from the data directory. * Displaying whether there are unsaved changes. * Importing and exporting the configuration from and to the clipboard. This is the only way to edit the configuration on newer Android versions, as editing files within apps' storage is not possible anymore. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Furthermore, the global touch controls settings can be adjusted in this UI: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * The direct touch input modes while ingame and spectating (see Touch button configuration format) can be adjusted using dropdown menus. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> While the touch controls editor is active, all touch buttons are shown regardless of their visibilities, to better support arranging the buttons. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> === Adjusting the controls === </div> <div lang="en" dir="ltr" class="mw-content-ltr"> # Export the touch configuration to the clipboard. # Save the clipboard to a file so you can more easily edit it. You should also do this to have a backup of your configuration! # Edit the configuration (see above for details about the format). # Copy the edited configuration to the clipboard and import it in the client again. If the configuration could not be loaded successfully, check the local console for error messages containing <code>touch_controls</code> and fix the configuration accordingly. Use online tools for JSON validation and formatting. # Save the changes in the client when you are done. You can also discard your changes or revert to the default if you messed up. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> A more convenient user interface to edit the touch controls directly in the client is planned. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Note: You can also edit the file <code>touch_controls.json</code> in the config directory directly instead of exporting/importing to/from the clipboard, but this is not supported on Android. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Examples == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Example for the overall structure of the touch configuration: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="json">{ "direct-touch-ingame": "action", "direct-touch-spectate": "aim", "touch-buttons": [ ... ] }</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Example button with <code>"bind"</code> behavior that echos a message in chat: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="json">{ "x": 500000, "y": 500000, "w": 100000, "h": 100000, "shape": "rect", "visibilities": [ ], "behavior": { "type": "bind", "label": "Example", "label-type": "plain", "command": "echo Hello world!" } }</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Example button with <code>"predefined"</code> behavior for a virtual joystick that uses the active action: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="json">{ "x": 755000, "y": 580000, "w": 225000, "h": 400000, "shape": "circle", "visibilities": [ "ingame" ], "behavior": { "type": "predefined", "id": "joystick-action" } }</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> Example button with <code>"bind-toggle"</code> behavior that switches between echoing three different messages in chat: </div> <div lang="en" dir="ltr" class="mw-content-ltr"> <syntaxhighlight lang="json">{ "x": 600000, "y": 200000, "w": 100000, "h": 100000, "shape": "rect", "visibilities": [ ], "behavior": { "type": "bind-toggle", "commands": [ { "label": "Echo 1", "label-type": "plain", "command": "echo 1" }, { "label": "Echo 2", "label-type": "plain", "command": "echo 2" }, { "label": "Echo 3", "label-type": "plain", "command": "echo 3" } ] } }</syntaxhighlight> </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Known issues == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * '''Problem on Android''': Pressing down 3 or more fingers at the same times causes all fingers to be released immediately. ** '''Solution''': This is caused by features of your phone that handle global gestures with multiple fingers. Open the Settings app and disable gesture features that involve 3 or more fingers (search for "3 fingers"). In particular, disable the "Swipe down with 3 fingers to take screenshot", "Touch and hold with 3 fingers to take screenshot" and "Swipe up with 3 fingers to enter Split View" features. * '''Problem on Android''': Rarely, touching in the top around 15% of the screen does not work at all or very inconsistently. ** '''Solution''': It is unclear what causes this. It should be fixed by restarting the app. Going back to the home screen may also fix it. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == Implementation details == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> These are details about the implementation of the touch controls intended for developers. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> The ingame touch controls are implemented in a separate client component <code>CTouchControls</code> in the files <code>src/game/client/components/touch_controls.cpp</code> and <code>src/game/client/components/touch_controls.h</code>. Whenever possible, binds are used directly as button behavior instead of using predefined behavior to reduce complexity. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> When adding your own button behavior in a forked client it is recommended to prefix names of new shape, visibility, behavior etc. with the name of your fork, e.g. <code>myfork.octagon</code> if you add a new shape for octogonal buttons, to prevent conflicts in future versions. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> To add touch support for other ingame client components like the emoticon wheel and spectator menu, use the <code>CUi::UpdateTouchState</code> function like for the emoticon wheel and spectator menu. Ensure that your component handles <code>KEY_ESCAPE</code> to close itself, which also corresponds to the Back-button on Android. Note that only one component may use the touch state in each frame, so it is not possible to hold an ingame touch button and use another component like the emoticon wheel at the same time with other fingers. Instead, the respective predefined touch button behavior (e.g. <code>CSpectateTouchButtonBehavior</code>) only activates the ingame component (e.g. the spectator menu) in its <code>OnDeactivate</code> function but does not deactivate it again. Activating the component in the <code>OnActivate</code> function already would cause the finger that activated the button to also affect the activated component. </div> <div lang="en" dir="ltr" class="mw-content-ltr"> == References == </div> <div lang="en" dir="ltr" class="mw-content-ltr"> * Default touch button configuration: https://github.com/ddnet/ddnet/blob/84b1c3c49c8d97a6911da34424d2023879ccdaf8/data/touch_controls.json * Pull Request adding Touch controls to engine and UI: https://github.com/ddnet/ddnet/pull/8621 * Pull Request adding Ingame touch controls: https://github.com/ddnet/ddnet/pull/8632 * Pull Request adding Emoticon and Spectate touch controls: https://github.com/ddnet/ddnet/pull/8801 </div>
Toggle limited content width