Development/zh: Difference between revisions
Created page with "截至目前,处于一下原因,我们强烈建议使用Linux环境在DDNet中开发: * 大多数DDNet贡献者实际上使用Linux来贡献。 * 更容易的软件包管理,您可以轻松地安装所有需要的库并开始贡献。 * 本文还没有Windows版本,主要关注Linux。" |
No edit summary Tags: Mobile edit Mobile web edit |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 62: | Line 62: | ||
以下是一些通用信息: | 以下是一些通用信息: | ||
*目前,源代码是使用C++17标准编译的,但您会看到代码的许多部分更像C,因为只有大多数新代码使用C++17。 | *目前,源代码是使用C++17标准编译的,但您会看到代码的许多部分更像C,因为只有大多数新代码使用C++17。 | ||
*<code>std: | *<code>std::string</code>很少使用,字符数组加<code>system.h</code>方法才是常态。 | ||
*大多数输入输出代码、格式化和Print都是使用<code>system.h</code>提供的方法完成的。 | *大多数输入输出代码、格式化和Print都是使用<code>system.h</code>提供的方法完成的。 | ||
Line 73: | Line 73: | ||
<span id="The_src/base_directory"></span> | <span id="The_src/base_directory"></span> | ||
=== src/base | === src/base 目录 === | ||
由于DDNet是一个跨平台游戏,需要一个抽象层来简化开发,因此该目录包含许多有用的函数来处理这一问题。 | 由于DDNet是一个跨平台游戏,需要一个抽象层来简化开发,因此该目录包含许多有用的函数来处理这一问题。 | ||
Line 79: | Line 79: | ||
<span id="The_src/engine_directory"></span> | <span id="The_src/engine_directory"></span> | ||
=== src/engine | === src/engine 目录 === | ||
游戏引擎就在这里,它处理大多数与游戏无关的东西,比如图形、声音、网络等。 | 游戏引擎就在这里,它处理大多数与游戏无关的东西,比如图形、声音、网络等。 | ||
Line 91: | Line 91: | ||
<span id="Server_side"></span> | <span id="Server_side"></span> | ||
==== 服务器 ==== | ==== 服务器端 ==== | ||
<div class="mw-translate-fuzzy"> | |||
这个游戏使用自己的[https://en.wikipedia.org/wiki/Entity_component_system 实体组件系统],所有其他实体派生到的主类是<code>CEntity</code>,位于<code>src/game/server/Entity.h</code>中。 | 这个游戏使用自己的[https://en.wikipedia.org/wiki/Entity_component_system 实体组件系统],所有其他实体派生到的主类是<code>CEntity</code>,位于<code>src/game/server/Entity.h</code>中。 | ||
</div> | |||
这些实体由位于此处的游戏世界管理<code>src/game/server/gameworld.h</code> | 这些实体由位于此处的游戏世界管理<code>src/game/server/gameworld.h</code> | ||
Line 166: | Line 168: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
Must be prefixed by <code>C</code> (for legacy reasons this is ignored for structs in some places, such as in graphics code) or <code>I</code> for interfaces. | Must be prefixed by <code>C</code> (for legacy reasons this is ignored for structs in some places, such as in graphics code) or <code>I</code> for interfaces. New <code>struct</code>s should be prefixed by <code>S</code>. | ||
</div> | </div> | ||
Line 228: | Line 230: | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
* <code>m</code> for member variables: <code>m_MyVariable</code>. | * <code>m</code> for member variables: <code>m_MyVariable</code>. | ||
* <code>s</code> for static variables: <code>s_MyStaticVariable</code>. | * <code>s</code> for static variables: <code>s_MyStaticVariable</code>, <code>ms_MyStaticMemberVariable</code>. | ||
* <code>g</code> for global variables with external linkage: <code>gs_MyGlobalStaticVar</code>. | * <code>g</code> for global variables with external linkage: <code>gs_MyGlobalStaticVar</code>. | ||
</div> | </div> | ||
Line 240: | Line 242: | ||
* <code>p</code> for pointers: <code>pMyPointer</code>, <code>m_pCharacter</code>, <code>ppMyPointerToPointer</code>. | * <code>p</code> for pointers: <code>pMyPointer</code>, <code>m_pCharacter</code>, <code>ppMyPointerToPointer</code>. | ||
* <code>a</code> for arrays: <code>aMyArray</code>, <code>aBuf</code>. | * <code>a</code> for arrays: <code>aMyArray</code>, <code>aBuf</code>. | ||
* <code>v</code> for <code>std::vector</code>s: <code>vMyVector</code>, <code>vpvMyVectorOfPointersToVectors</code>. | |||
* <code>fn</code> for functions: <code>pfnMyCallback</code>, <code>m_papfnMyPointerToArrayOfCallbacks</code>. | * <code>fn</code> for functions: <code>pfnMyCallback</code>, <code>m_papfnMyPointerToArrayOfCallbacks</code>. | ||
</div> | </div> |