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
Binds
Block
Catch16
Category:Templates
Collision
Common Terminology
DDRace
Death
Deepfly
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
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
Troubleshooting
Tune zones
Vanilla
World
ZCatch
Language
aa - Afar
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
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
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)
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 Chinese
ht - Haitian Creole
hu - Hungarian
hu-formal - Hungarian (formal address)
hy - Armenian
hyw - Western Armenian
hz - Herero
ia - Interlingua
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
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
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
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)
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)
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
{{DISPLAYTITLE:Développement}}<languages /> Cet article a pour but de vous introduire au '''''développement''''' de DDNet. En tant que jeu open-source, il repose sur la générosité et le temps libre des contributeurs. <span id="Your_development_environment"></span> == Environnement de développement == Il est fortement recommandé de mettre en place un environnement Linux pour commencer à programmer dans DDNet pour les raisons suivantes (à ce jour) : * La plupart des contributeurs utilisent Linux; * La gestion des paquets est plus facile, vous pouvez facilement installer toutes les librairies requises; * Cet article n'a pas encore de version Windows et se concentre sur Linux. Tout d'abord, DDNet est codé en utilisant le langage de programmation C++. Vous devrez être assez familier avec ce langage, mais vous pouvez aussi en connaître les bases et en apprendre davantage en développant sur DDNet. Quelques ressources utiles pour apprendre le C++ : * [https://openclassrooms.com/fr/courses/1894236-apprenez-a-programmer-en-c openclassrooms.com] (bases, contient de la publicité, peut être limité en termes de pages par jour) * [https://openclassrooms.com/fr/courses/7137751-programmez-en-oriente-objet-avec-c openclassrooms.com] (programmation orientée objet, contient de la publicité, peut être limité en termes de pages par jour) * [https://cpp.developpez.com/cours/ developpez.com] (liste de tutoriels) *[https://fr.cppreference.com/w/ cppreference.com] (pour les utilisateurs avancés) Le code source de DDNet est géré à l'aide de [https://git-scm.com/ Git], un système de contrôle de version et un outil essentiel pour collaborer avec plusieurs développeurs. Si vous ne disposez pas encore de git dans votre distribution Linux, veillez à l'installer, par exemple dans la plupart des distributions basées sur Debian/Ubuntu : <code>sudo apt install git</code>. <span id="Getting_the_source_code"></span> == Obtenir le code source == Le code source se trouve sur [https://github.com/ddnet/ddnet Github], vous pouvez le récupérer en clonant le répertoire sans compte: <code>git clone --recursive https://github.com/ddnet/ddnet.git</code>. Cependant, vous devez avoir un compte pour proposer vos modifications à la communauté. Si vous n'êtes pas familier avec git/github, vous pouvez apprendre les bases ici : [https://docs.github.com/fr/get-started/quickstart/hello-world Hello World - Github] <span id="Installing_the_dependencies"></span> == Installer les dépendances == Sous Linux, vous pouvez installer les dépendances nécessaires en lisant le fichier README du répertoire github de DDNet: https://github.com/ddnet/ddnet#dependencies-on-linux--macos. Pour Arch Linux : <syntaxhighlight lang="bash"> sudo pacman -S --needed base-devel cmake curl ffmpeg freetype2 git glew glslang gmock libnotify libpng opusfile python rust sdl2 spirv-tools sqlite vulkan-headers vulkan-icd-loader wavpack x264 </syntaxhighlight> Pour Debian : <syntaxhighlight lang="bash"> sudo apt install build-essential cargo cmake git glslang-tools google-mock libavcodec-extra libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libcurl4-openssl-dev libfreetype6-dev libglew-dev libnotify-dev libogg-dev libopus-dev libopusfile-dev libpng-dev libsdl2-dev libsqlite3-dev libssl-dev libvulkan-dev libwavpack-dev libx264-dev python3 rustc spirv-tools </syntaxhighlight> <span id="Compiling_DDNet"></span> == Compiler DDNet == Nous utilisons [https://cmake.org/ CMake] pour gérer la compilation. Une fois que toutes les dépendances sont installés (incluant CMake), vous pouvez exécuter les commandes suivantes depuis le répertoire DDNet : <syntaxhighlight lang="bash"> mkdir build && cd build cmake .. make -j$(nproc) </syntaxhighlight> <span id="General_information"></span> == Informations générales == Voici quelques informations générales : *Actuellement, le code source est compilé avec le standard C++17, mais vous constaterez que de nombreuses parties du code sont plus proches du C puisque seul le nouveau code utilise des parties du standard C++17. *<code>std::string</code> est rarement utilisé, les tableaux de caractères et l'utilisation des méthodes <code>system.h</code> pour les manipuler sont la norme. *Tout ce qui est E/S, formatage et affichage est réalisés en utilisant les méthodes de <code>system.h</code>. <span id="The_source_code_layout"></span> == Disposition du code source == Maintenant que vous pouvez build DDNet, vous pouvez commencer à faire des modifications. <span id="The_src/base_directory"></span> === Répertoire src/base === Comme DDNet est un jeu multi-plateforme, une couche d'abstraction est nécessaire pour un développement plus aisé. Ce répertoire contient les fonctions utiles pour tout ce qui touche au système d'exploitation. <span id="The_src/engine_directory"></span> === Répertoire src/engine === Ici se trouve le moteur de jeu qui gère tout ce qui n'est pas lié à la jouabilité, à savoir les graphismes, le son, le réseau, etc. <span id="The_src/game_directory"></span> === Répertoire src/game === Tout le code lié au gameplay est ici, séparé entre le client et le serveur. <span id="Server_side"></span> ==== Serveur ==== Le jeu repose sur un ensemble de '''composants''' qui dérivent tous de la classe mère <code>CEntity</code> définie dans <code>src/game/server/entity.h</code>. Ces entités sont gérées par la classe <code>CGameWorld</code> définie dans <code>src/game/server/gameworld.h</code>. Quelques entités importantes: * [https://github.com/ddnet/ddnet/blob/master/src/game/server/entities/character.h CCharacter] qui représente un [[Special:MyLanguage/Common Terminology/fr#Tee|Tee]] vivant. Elle est instanciée quand un tee apparaît et supprimée quand il meurt. * [https://github.com/ddnet/ddnet/blob/master/src/game/server/player.h CPlayer] contient les informations non liées au [[Special:MyLanguage/Common Terminology/fr#Tee|Tee]] (pseudo, drapeau, etc.). <span id="Client_side"></span> ==== Client ==== Le client est lui aussi constitué de composants qui sont tous des classes dérivées de [https://github.com/ddnet/ddnet/blob/master/src/game/client/component.h CComponent] définie dans <code>src/game/client/component.h</code>. Ces composants peuvent implémenter les méthodes virtuelles <code>OnInit</code>, <code>OnMessage</code>, etc. pour fournir leurs fonctionnalités. <span id="Networking"></span> ==== Réseau ==== Le protocole réseau est généré par des scripts Python qui produisent du code C++. Par exemple, le fichier <code>datasrc/network.py</code> définit tous les paquets réseaux. <span id="Code_conventions"></span> == Convention de code == La discussion sur les conventions d'écriture se trouve ici: [https://github.com/ddnet/ddnet/issues/2945 ddnet#2945] Actuellement, ce qui suit s'applique : <span id="Indentation_style"></span> === Indentation === Le [https://fr.wikipedia.org/wiki/Style_d%27indentation#Style_Allman style d'Allman] est utilisé. <blockquote> Nommé d'après Eric Allman, ce style respecte un alignement strict des accolades ouvrantes et fermantes, comme dans l'exemple ci-dessous : </blockquote> <syntaxhighlight lang="cpp"> while(x == y) { Something(); SomethingElse(); } FinalThing(); </syntaxhighlight> <span id="Classes_and_Structs"></span> === Classes et structures === Toutes les classes et structures doivent être précédées par un <code>C</code> ou un <code>I</code> pour les interfaces. Pour des raisons historiques, certaines structures ne l'ont pas comme dans la partie graphique. Exemple: <syntaxhighlight lang="cpp"> class CCharacter : public CEntity { // ... } </syntaxhighlight> <span id="Enums_and_constants"></span> === Énumérations et constantes === Elles doivent être écrites en notation ''screaming snake case [https://fr.wikipedia.org/wiki/Snake_case]'' (''i.e.'' tout en majuscules avec un ''underscore'' <code>_</code> entre les mots). Par example: <code>MAX_PLAYERS</code> <syntaxhighlight lang="c++"> enum { FAKETUNE_FREEZE = 1, FAKETUNE_SOLO = 2, FAKETUNE_NOJUMP = 4, FAKETUNE_NOCOLL = 8, FAKETUNE_NOHOOK = 16, FAKETUNE_JETPACK = 32, FAKETUNE_NOHAMMER = 64, }; </syntaxhighlight> <span id="Variable_naming"></span> === Convention de nommage === * Le nom des variables doit contenir 3 parties : le qualificatif, le préfixe et le nom. * Les noms doivent commencer par une majuscule à moins qu'elle ne soit de longueur unitaire sans aucun qualificatif ou préfixe, par exemple les variables de boucle <code>i</code> et <code>j</code>. * Les noms des variables doivent être écrits en '''anglais''' et suivent la convention ''camel case [https://fr.wikipedia.org/wiki/Camel_case]'' (''i.e.'' majuscule à chaque mot). * Les variables peuvent avoir plus d'un qualificatif ou plus d'un préfixe. Ils sont disposés de la manière suivante: <code>[qualificatifs]_[préfixes][Nom]</code>. <span id="Qualifiers"></span> ==== Qualificatifs ==== * <code>m</code> pour les variables membres: <code>m_MyVariable</code> * <code>s</code> pour les variables statiques: <code>s_MyStaticVariable</code> * <code>g</code> pour les variables globales : <code>gs_MyGlobalStaticVar</code> <span id="Prefixes"></span> ==== Préfixes ==== * <code>p</code> pour les pointeurs : <code>pMyPointer</code>, <code>m_pCharacter</code>, <code>ppMyPointerToPointer</code> * <code>a</code> pour les tableaux : <code>aMyArray[MAX_PLAYERS]</code>, <code>aBuf</code> *<code>v</code> pour les <code>std::vector</code> : <code>vMyVector</code>, <code>vpvMyVectorOfPointersToVectors</code>. * <code>fn</code> pour les fonctions : <code>pfnMyCallback</code>, <code>m_papfnMyPointerToArrayOfCallbacks</code> <span id="Common_snippets"></span> == Exemples courants == Voici une liste d'extraits de code que vous pouvez voir fréquemment dans la base de code : <span id="Formatting_text"></span> === Formatage de texte === <syntaxhighlight lang="c++"> char aBuf[128]; str_format(aBuf, sizeof(aBuf), "number: %d", 2); </syntaxhighlight> Voir [https://cplusplus.com/reference/cstdio/printf/ printf documentation] pour une liste de tous les spécificateurs de format. === Itérer sur tous les joueurs === <syntaxhighlight lang="c++"> for(int i = 0; i < MAX_CLIENTS; i++) { // Server-side CPlayer *pPlayer = GameServer()->m_apPlayers[i]; } </syntaxhighlight> <span id="Printing_to_the_game_console"></span> === Afficher dans la console de jeu === <syntaxhighlight lang="c++"> Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "wikiprint", "Hello from the ddnet wiki!"); </syntaxhighlight> <span id="Debug_printing"></span> === Affichage de débogage === <syntaxhighlight lang="c++"> int i = 2; dbg_msg("wikiprint", "Hello from the ddnet wiki: %d", i) </syntaxhighlight> ===Traduction du texte dans le client=== <code>Localize</code> peut être utilisé dans le client du jeu pour obtenir la traduction d'un texte spécifique à partir du fichier de langue sélectionné par l'utilisateur. <syntaxhighlight lang="cpp"> DoButton(..., Localize("Connect"), ...); </syntaxhighlight> Le texte peut également contenir des spécificateurs de format. La chaîne traduite doit alors contenir les mêmes spécificateurs de format. <syntaxhighlight lang="cpp"> char aBuf[128]; str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers"), NumServers, TotalServers); </syntaxhighlight> Un script est utilisé pour chercher dans le code les appels à <code>Localize</code> et collecter les chaînes de caractères pour mettre à jour les fichiers de traduction. Pour cette raison, l'appel à <code>Localize</code> ne doit pas contenir d'autre code, sinon le script ne peut pas déterminer le texte correctement. <syntaxhighlight lang="cpp"> // Ne faites PAS ça : const char *pStr = Localize(Team == TEAM_RED ? "Red team" : "Blue team"); // Faites plutôt ceci : const char *pStr = Team == TEAM_RED ? Localize("Red team") : Localize("Blue team"); </syntaxhighlight> <span id="External_resources"></span> == Ressource externes == * [https://edgarluque.com/blog/ui-code-ddnet/ UI Code in DDraceNetwork] par [[Special:MyLanguage/User:Ryozuki|Ryozuki]] * [https://edgarluque.com/blog/intro-to-ddnet/ An intro to the DDraceNetwork game source code] par [[Special:MyLanguage/User:Ryozuki|Ryozuki]] * [https://edgarluque.com/blog/code-conventions-in-ddnet/ Code conventions in DDraceNetwork] par [[Special:MyLanguage/User:Ryozuki|Ryozuki]] * [https://edgarluque.com/blog/chat-command-ddracenetwork/ Implementing a chat command in DDraceNetwork] par [[Special:MyLanguage/User:Ryozuki|Ryozuki]] * [https://codedoc.ddnet.org/ Auto generated docs] * [https://ddnet.org/libtw2-doc/ Technical documentation of Teeworlds file formats and network protocol] * [https://heinrich5991.github.io/blog/blog/one-tick-unfreeze The Anatomy of a One Tick Unfreeze] * [https://www.youtube.com/playlist?list=PLhJkqAQmOh5LyYOfnMy4PJB6CSZltQyTc Teeworlds programming YouTube tutorial] par ChillerDragon *[https://chillerdragon.github.io/teeworlds-protocol/ Teeworlds 0.6/0.7 network protocol documentation] par [[User:ChillerDragon|ChillerDragon]] <span id="About_Tee_Skin_Rendering"></span> == À propos du rendu des Skin == Cette section explique comment effectuer l'affichage du skin d'un Tee. Valeurs rassemblées par Patiga Remerciements à Jupstar Segment Scaling: body: 100% feet: 150% eyes: 120% eye blink: 45% hand: 93.75% Positioning: 64/64 = 1 = width or height of the body segment body: 4/64 up feet: 10/64 down 7/64 left/right eyes: 0.125 up 0.05 left/right eye movement: dir = angle of eyes (view angle), right = 0 eyes: x: cos(dir) * 0.125 y: sin(dir) * 0.1 each eye (away from the other): x: abs(cos(dir)) * 0.01
Toggle limited content width