Skip to content

Commit

Permalink
Deploying to main from @ GamemakerChina/GameMaker-maunl-zh@a26c49b 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
LiarOnce committed Sep 20, 2023
1 parent fbbd0db commit 6999a71
Show file tree
Hide file tree
Showing 7,980 changed files with 30,370 additions and 17,082 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 3 additions & 3 deletions Additional_Information/Additional_Information.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Additional Information</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand All @@ -78,7 +78,7 @@


<!--<div class="body-scroll" style="top: 150px;">-->
<h1>附加信息</h1>
<h1><span data-field="title" data-format="default">Additional Information</span></h1>
<p>手册的这一部分包含了与编程和GameMaker语言工作方式相关的杂项文章。以下文章是作为配套文章设计的,旨在进一步扩展您对GameMaker工作方式的理解,以及如何从可用的不同语言功能中获得最大的好处:</p>
<ul class="colour">
<li><a href="Best_Practices_When_Programming.htm">编程时的最佳实践</a></li>
Expand All @@ -92,13 +92,13 @@ <h1>附加信息</h1>
<li><a href="Guide_To_Using_Shaders.htm">着色器使用指南</a></li>
<li><a href="Guide_To_Primitives_And_Vertex_Building.htm">图元和顶点构建指南</a></li>
<li><a href="Guide_To_Using_Blendmodes.htm">混合模式使用指南</a></li>
<li><a href="Project_Format.htm">Project Format</a></li>
<li><a href="Compatibility_Functions.htm">兼容性函数</a></li>
<li><a href="Compatibility_Scripts.htm">兼容脚本</a></li>
<li><a href="Obsolete_Functions.htm">过时函数</a></li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="footer">
<div class="buttons">
<div class="clear">
Expand Down
19 changes: 1 addition & 18 deletions Additional_Information/Best_Practices_When_Programming.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Best Practices When Programming</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down Expand Up @@ -126,23 +126,6 @@ <h1>编程时的最佳实践</h1>
}</span></p>
<p class="dropspot">还可以通过将所用变量设置为0来释放与数组相关的内存。因此,要从上面的代码示例中清除数组,你可以简单地使用:</p>
<p class="code">array = 0;</p>
<p class="dropspot">还要注意,数组是通过<strong>引用</strong>传递的,但对于旧版项目或开启写时复制时,进行更改时将复制整个内容(这种行为称为<strong>写时复制</strong>)。因此,如果你将一个数组传递给一个函数,你就是将一个<em>引用</em>传递给原始数组,从它中读取的任何值都将来自原始源。这很好也很快速,但是如果您需要修改任何数组值,数组本身会在写入时被复制,并且所做的任何更改<strong>都需要从函数中返回,否则它们将丢失</strong>。这要慢得多,并且消耗更多的内存,所以在函数中使用数组时要小心。</p>
<p class="dropspot">但是,您可以通过使用特殊的数组<a href="../GameMaker_Language/GML_Overview/Accessors.htm">访问器</a>&nbsp;<span class="inline">@</span>来避免这种写时复制行为,因为这提供了对底层数组的直接访问。例如:</p>
<p class="code">// Call a function, passing our array<br>
my_function(my_array);</p>
<p class="code">// The function looks like this:<br>
<br>
function my_function(_a)<br>
{<br>
&nbsp; &nbsp; // The array will be copied and the copy modified,<br>
&nbsp; &nbsp; // requiring you to use "return _a", later<br>
&nbsp; &nbsp; _a[0] = 100;<br>
<br>
&nbsp; &nbsp; // This will modify the ORIGINAL array directly and<br>
&nbsp; &nbsp; // does not require it to be returned<br>
&nbsp; &nbsp; _a[@ 0] = 100;<br>
}
</p>
<p class="dropspot">&nbsp;</p>
</div>
<p><a class="dropspot" data-rhwidget="DropSpot" data-target="drop-down3" href="#"><span data-open-text="true" data-skip-index="true">Data Structures</span><span data-close-text="true">Data Structures</span> 数据结构</a></p>
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Bitwise_Operators.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Bitwise Operators</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Compatibility_Functions.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Compatibility Functions</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Compatibility_Scripts.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Compatibility Scripts</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Error_Reporting.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Error Reporting</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Errors/Compiler_Errors.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Compiler Errors</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../../assets/css/default.css" type="text/css">
<script src="../../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Errors/Runner_Errors.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Runner Errors</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../../assets/css/default.css" type="text/css">
<script src="../../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Errors/Syntax_Errors.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Syntax Errors (Feather Messages)</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../../assets/css/default.css" type="text/css">
<script src="../../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
29 changes: 14 additions & 15 deletions Additional_Information/Guide_To_Primitives_And_Vertex_Building.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Guide To Primitives And Vertex Building</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand All @@ -78,13 +78,13 @@


<!--<div class="body-scroll" style="top: 150px;">-->
<h1>图元和顶点构建指南</h1>
<h1><span data-field="title" data-format="default">Guide To Primitives And Vertex Building</span></h1>
<p>本指南简要介绍了如何使用自定义<a href="../GameMaker_Language/GML_Reference/Drawing/Primitives/Primitives_And_Vertex_Formats.htm">顶点格式</a><strong>顶点缓冲区</strong>构建和使用<strong>图元</strong></p>
<p>一般来说,当您开始使用 3D、特效、复杂的绘制过程或着色器时,您不必太担心所使用的顶点格式,因为 <span data-keyref="GameMaker Name">GameMaker</span> 会自动设置并通过<a class="tooltip" title="顶点是一个多边形的单点的名称,它包含了定义它的位置、颜色和纹理的各种特征。在计算机图形学中,这通常指用于创建原语的三角形的一个角,而这些原语的组合构成了屏幕上的图形。">顶点 </a> 数据。 然而,有时需要创建您自己的顶点数据并对其进行格式化以适应,尤其是当您需要提高速度或希望传递额外信息时。 例如,标准顶点格式包括 x、y、z 3D 位置、颜色(带 alpha)和 UV 纹理坐标,如果您自己创建它,将类似于:</p>
<p>In general when you start working with 3D, special effects, complex drawing processes or shaders you don't need to worry too much about the vertex format being used, since <span data-keyref="GameMaker Name">GameMaker</span> will automatically set up and pass through the <a class="tooltip" title="顶点是一个多边形的单点的名称,它包含了定义它的位置、颜色和纹理的各种特征。在计算机图形学中,这通常指用于创建原语的三角形的一个角,而这些原语的组合构成了屏幕上的图形。">vertex</a> data for you. However, sometimes it is necessary to create your own vertex data and format it to suit, especially when you need to boost speed, or wish to pass in extra information. For example the standard vertex format includes an x, y, z 3D position, colour (with alpha), and UV texture coordinates, which, if you were creating it yourself, would look something like:</p>
<p class="code">vertex_format_begin();<br>
vertex_format_add_position_3d();<br>
vertex_format_add_colour();<br>
vertex_format_add_textcoord();<br>
vertex_format_add_texcoord();<br>
my_format = vertex_format_end();</p>
<p>然而,如果你只是使用(例如)着色器来操作顶点的位置,那么就不需要传递颜色或纹理数据了。在这种情况下,你将创建自己的格式如下:</p>
<p class="code">vertex_format_begin();<br>
Expand All @@ -99,8 +99,8 @@ <h1>图元和顶点构建指南</h1>
<li>Texture coordinate 纹理坐标</li>
</ul>
<p>通常情况下,您必须<em> 始终 </em>提供位置或3D位置作为格式的一部分,但其他所有都是可选的。</p>
<p>您应该注意,一旦创建了顶点格式,在构建<strong>图元</strong>时,<i>必须遵守</i>定义顶点属性的顺序。所以,如果你已经定义了一个顶点格式作为位置,颜色和纹理坐标,那么<b><i>必须</i>以相同的顺序将这些属性添加到原语中,否则你将得到一个错误</b>。还要注意,像任何其他动态资源一样,顶点格式需要内存,因此在不需要时应该使用函数<a href="../GameMaker_Language/GML_Reference/Drawing/Primitives/vertex_format_delete.htm"><span class="inline">vertex_format_delete()</span></a>删除顶点格式。</p>
<p>你构建的任何图元都保存在<b>顶点缓冲区</b>中。这必须事先创建,然后由用于构建图元的函数引用。顶点缓冲区可以根据需要多次重用以创建不同的图元,或者它可以“冻结”以在你的游戏或关卡期间保持特定的图元类型(这是最快的方法,所以如果你知道你所构建的图元不会改变,那么你应该总是使用这个选项)。</p>
<p>You should note that once you have created your vertex format, the order in which you have defined the vertex attributes&nbsp;<i>must be honoured</i> when building your <strong>primitives</strong>. So, if you have defined a vertex format as position, colour, and texture coordinate, then <b>you <i>must</i> add these attributes to the primitive in the same order otherwise you will get an error</b>. Also note that like any other dynamic resource, a vertex format requires memory and therefore should be removed when not needed using the function <span class="inline3_func"><a href="../GameMaker_Language/GML_Reference/Drawing/Primitives/vertex_format_delete.htm">vertex_format_delete</a></span>.</p>
<p>Any primitives that you build are held in a <b>vertex buffer</b>. This must be created beforehand and then referenced by the functions that are used to build your primitive. The vertex buffer can be reused as many times as necessary to create different primitives, or it can be "frozen" to maintain a specific primitive type for the duration of your game or level (which is the fastest approach, so if you know that a primitive you build will not change then you should always use this option).</p>
<p>下面的代码显示了构建单个三角形图元的示例:</p>
<p class="code">// CREATE EVENT<br>
v_buff = vertex_create_buffer();<br>
Expand All @@ -122,9 +122,9 @@ <h1>图元和顶点构建指南</h1>
vertex_submit(v_buff, pr_trianglelist, tex);<br>
shader_reset();
</p>
<p>在这里,我们首先在实例的创建事件中创建了我们的顶点缓冲区,然后我们开始定义组成我们的三角形图元的不同顶点,为我们想要使用的三个点中的每个点提供位置、颜色和纹理UV坐标。然后结束顶点定义,我们知道包含这个顶点数据的顶点缓冲区存储在变量"v_buff"中。</p>
<p class="note"><strong>注意</strong>:如果要不断更新缓冲区的内容,则会在给定顶点数据的情况下创建缓冲区,然后再次销毁 - 在绘制之后 - 所有这些都在同一步骤中进行。</p>
<p>然后我们使用着色器在绘制事件中绘制顶点缓冲区的内容。这是一个非常简单的例子,基本上就是<span data-keyref="GameMaker Name">GameMaker</span>内部工作的方式,例如:当你绘制一个精灵时,GameMaker创建一个顶点缓冲区,四个顶点创建两个三角形(构成一个正方形,也称为“quad”),并将这两个三角形与精灵图像纹理化。当我们绘制这个精灵时,我们提交了顶点缓冲区,它的内容被绘制到屏幕上。</p>
<p>Here we have first created our&nbsp;vertex buffer in the Create Event of the instance, then we begin the definition of the different vertices that make up our triangle primitive, giving the position, the colour, and the texture UV coordinate for each of the three points that we want to use. We then end the vertex definition, and we know that the vertex buffer with this vertex data is stored in the variable "v_buff".&nbsp;&nbsp;</p>
<p class="note"><span data-conref="../assets/snippets/Tag_note.hts"><span class="note">NOTE</span></span>&nbsp;If the contents of the buffer are going to be updated constantly, the buffer would be created, given the vertex data, and then be destroyed again - after it's been drawn -&nbsp;all in the same step.</p>
<p>We then draw the contents of the vertex buffer in the Draw Event using a shader. This is a very simple example, and is basically how <span data-keyref="GameMaker Name">GameMaker</span> works internally, ie: When you draw a sprite, <span data-keyref="GameMaker Name">GameMaker</span>&nbsp;creates a vertex buffer with four vertices creating two triangles (which make a square, also called a "quad"), and textures these two triangles with the sprite image. When we draw this sprite, we are submitting the vertex buffer and its contents are drawn to the screen.</p>
<p>你会注意到,当我们提交绘制的顶点缓冲区时,我们提供了一个图元类型。你使用的图元类型可以是一个点,一个行列表或条,或一个三角形列表或条(point,line list or strip,triangle list or strip),但是<i></i>允许使用三角扇形(triangle fans),因为大量移动硬件不接受这种图元类型。不要忘记为将要用来绘制它的图元类型正确地格式化你的顶点缓冲区。例如,将两个三角形图元绘制为一个三角形列表需要6个点,但作为一个三角扇(triangle strip)只需要4个点。你使用哪种类型是由你自己决定的,这取决于你想要画什么和你想要达到的效果。</p>
<p>以这种方式使用您自己的顶点缓冲区时要注意的最后一点是它如何影响发送到 GPU 的顶点批次。 创建顶点缓冲区时,您创建的是最低级别的图形数据,因此当您绘制时,<span data-keyref="GameMaker Name">GameMaker</span> 会将您的缓冲区直接发送到显卡。 因此,如果你想要更好的批处理,你必须自己解决并将你想要批处理的东西存储在同一个缓冲区中。</p>
<p>正如我们在上面已经提到的,顶点格式是通过同时使用以下 5 种属性类型构建的(通过适当的 <span class="inline">vertex_format_add_*</span> 函数添加):</p>
Expand Down Expand Up @@ -152,7 +152,7 @@ <h1>图元和顶点构建指南</h1>
<p class="code">vertex_format_begin();<br>
vertex_format_add_position_3d();<br>
vertex_format_add_colour();<br>
vertex_format_add_textcoord();<br>
vertex_format_add_texcoord();<br>
my_format = vertex_format_end();</p>
<p>现在,shader 属性是如何与顶点格式类型匹配的? 它只是基于变数命名原则:</p>
<ul class="colour">
Expand All @@ -166,7 +166,7 @@ <h1>图元和顶点构建指南</h1>
vertex_format_add_position_3d();<br>
vertex_format_add_colour();<br>
vertex_format_add_colour();<br>
vertex_format_add_textcoord();<br>
vertex_format_add_texcoord();<br>
my_format = vertex_format_end();</p>
<p>现在是相关的着色器属性:</p>
<p class="code">attribute vec3 in_Position;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// (x,y,z)<br>
Expand All @@ -178,9 +178,9 @@ <h1>图元和顶点构建指南</h1>
<p class="code">vertex_format_begin();<br>
vertex_format_add_position_3d();<br>
vertex_format_add_colour();<br>
vertex_format_add_textcoord();<br>
vertex_format_add_textcoord();<br>
vertex_format_add_textcoord();<br>
vertex_format_add_texcoord();<br>
vertex_format_add_texcoord();<br>
vertex_format_add_texcoord();<br>
my_format = vertex_format_end();</p>
<p>着色器代码应该是这样的:</p>
<p class="code">attribute vec3 in_Position;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// (x,y,z)<br>
Expand All @@ -195,7 +195,6 @@ <h1>图元和顶点构建指南</h1>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="footer">
<div class="buttons">
<div class="clear">
Expand Down
2 changes: 1 addition & 1 deletion Additional_Information/Guide_To_Using_Blendmodes.htm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Guide To Using Blendmodes</title>
<meta name="generator" content="Adobe RoboHelp 2020">
<meta name="generator" content="Adobe RoboHelp 2022">
<link rel="stylesheet" href="../assets/css/default.css" type="text/css">
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander">
Expand Down
Loading

0 comments on commit 6999a71

Please sign in to comment.