Skip to content

Commit

Permalink
Merge pull request #94 from YoYoGames/develop.gurpreet
Browse files Browse the repository at this point in the history
Develop.gurpreet
  • Loading branch information
gurpreetsinghmatharoo authored Feb 26, 2024
2 parents 479255d + 94ea140 commit 06c32fa
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>gpu_set_blendmode_ext_sepalpha</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 @@ -15,7 +15,7 @@
<body>
<!--<div class="body-scroll" style="top: 150px;">-->
<h1>gpu_set_blendmode_ext_sepalpha</h1>
<p>When <span data-keyref="GameMaker Name">GameMaker</span> goes to draw a pixel there is a source colour (the colour of the pixel we&#39;re going to draw) and a destination colour(the colour that&#39;s already in the pixel we&#39;re drawing to), so when determining the new colour of the pixel, the source and destination colours are calculated according to the chosen blend mode. Each component of the colours is stored as a floating point value between 0 and 1, and the new colour is calculated by multiply each component of the source colour by some factor and by multiplying each component of destination colour by some other factor and then adding the results together component by component.</p>
<p>When <span data-keyref="GameMaker Name">GameMaker</span> goes to draw a pixel there is a source colour (the colour of the pixel we&#39;re going to draw) and a destination colour(the colour that&#39;s already in the pixel we&#39;re drawing to), so when determining the new colour of the pixel, the source and destination colours are calculated according to the chosen blend mode. Each component of the colours is stored as a floating point value between 0 and 1, and the new colour is calculated by multiplying each component of the source colour by some factor and by multiplying each component of destination colour by some other factor and then adding the results together component by component.</p>
<p>This function permits you to set the different component parts that should be factored together to create a custom blend mode, selecting different parts of different blend mode factors for the RGB components and the Alpha component. So the &quot;src&quot; and &quot;dest&quot; argument will use the first 3 blend mode values (RGB) and the &quot;alphasrc&quot; and &quot;alphadest&quot; arguments will take the last part of the blend mode factor. For example, if you have the RGB source as <span class="inline">bm_zero</span>, then (0, 0, 0) will be used. If you then set the Alpha source as bm_one then (1) will be used, giving a final source blend mode of (0, 0, 0, 1).</p>
<p>The following chart shows the RGBA values for each blend mode, where (Rs, Gs, Bs, As) are considered the source values and (Rd, Gd, Bd, Ad) are the destination values. The eleven constants that are available for use can be either source or destination (or both) when used in this function.</p>
<table>
Expand Down Expand Up @@ -102,22 +102,22 @@ <h4>Syntax:</h4>
</tr>
<tr>
<td>src</td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor">Blend Mode Factor Constant</span></td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor"><a href="gpu_get_blendmode_ext.htm" target="_blank">Blend Mode Factor Constant</a></span></td>
<td>Source blend mode factor for RGB (see constants above).</td>
</tr>
<tr>
<td>dest</td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor">Blend Mode Factor Constant</span></td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor"><a href="gpu_get_blendmode_ext.htm" target="_blank">Blend Mode Factor Constant</a></span></td>
<td>Destination blend mode factor for RGB (see constants above)</td>
</tr>
<tr>
<td>alphasrc</td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor">Blend Mode Factor Constant</span></td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor"><a href="gpu_get_blendmode_ext.htm" target="_blank">Blend Mode Factor Constant</a></span></td>
<td>Source blend mode factor Alpha (see constants above).</td>
</tr>
<tr>
<td>alphadest</td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor">Blend Mode Factor Constant</span></td>
<td><span data-keyref="Type_Constant_Draw_Blend_Mode_Factor"><a href="gpu_get_blendmode_ext.htm" target="_blank">Blend Mode Factor Constant</a></span></td>
<td>Destination blend mode factor Alpha (see constants above)</td>
</tr>
</tbody>
Expand All @@ -142,7 +142,7 @@ <h4>Example:</h4>
<div style="float:right">Next: <a href="gpu_set_colourwriteenable.htm">gpu_set_colourwriteenable</a></div>
</div>
</div>
<h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2022 All Rights Reserved</span></h5>
<h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2023 All Rights Reserved</span></h5>
</div>
<!-- KEYWORDS
gpu_set_blendmode_ext_sepalpha
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ <h1>json_parse</h1>
<li>Trying to parse an invalid value (i.e.: not a string, or invalid JSON) will throw an exception error.</li>
<li><span class="inline2">null</span> values are parsed as <span class="inline2">undefined</span>.</li>
<li>This function only allows you to load JSON files with a maximum nesting limit of 128.</li>
<li>Any runtime values serialised by <span class="inline3_func"><a data-xref="{title}" href="json_stringify.htm">json_stringify</a></span> will be converted back to runtime values (e.g. <a href="../../../GML_Overview/Data_Types.htm">handles</a> and values like <span class="inline2">int64</span>, <span class="inline2">NaN</span> and <span class="inline2">infinity</span>), however this conversion can be disabled by passing <span class="inline2">true</span> into the optional <span><span class="inline2">inhibit_string_convert</span> argument, meaning these will remain as strings.</span></li>
<li>See <span class="inline3_func"><a data-xref="{title}" href="json_stringify.htm">json_stringify</a></span> for more information on how GameMaker interacts with the JSON format.</li>
</ul>
<div data-conref="../../../../assets/snippets/JSON_Filter_Function_Description.hts"> </div>
<p> </p>
<h4>Syntax:</h4>
<p class="code">json_parse(json, [filter_func])</p>
<p class="code">json_parse(json, [filter_func], [<span>inhibit_string_convert</span>])</p>
<table>
<tbody>
<tr>
Expand All @@ -46,6 +47,11 @@ <h4>Syntax:</h4>
<td><span data-keyref="Type_Function"><a href="../../../GML_Overview/Script_Functions.htm" target="_blank">Function</a></span></td>
<td><span data-conref="../../../../assets/snippets/Tag_optional.hts"> </span> Filter function that processes each item. Syntax: <span class="inline2">function(key, value) -&gt; new_value</span></td>
</tr>
<tr>
<td><span>inhibit_string_convert</span></td>
<td><span data-keyref="Type_Bool"><a href="../../../GML_Overview/Data_Types.htm" target="_blank">Boolean</a></span></td>
<td><span data-conref="../../../../assets/snippets/Tag_optional.hts"> </span> Set this to <span class="inline2">true</span> to disable converting strings into runtime references. Default value: <span class="inline2">false</span></td>
</tr>
</tbody>
</table>
<p> </p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ <h1><span data-field="title" data-format="default">json_stringify</span></h1>
<h3>Conversion Notes</h3>
<p>When using this function there are some important things to note:</p>
<ul class="colour">
<li>The function will <em>not </em> serialise the data inside assets, data structures and other runtime resources into JSON, and will simply store the internal handle reference for the resource (which is of little use as the index will change between runs of the game).
<li>The function will <strong>not</strong><em> </em>serialise the data contained <em>inside</em> assets, data structures and other runtime resources into JSON, and will simply store the internal handle reference for the resource (which is of little use as the index will change between runs of the game).
<ul>
<li>Upon <a href="json_parse.htm">parsing</a> the JSON, these will be converted back into runtime references so the resources can be used normally in functions. This includes any resource type that is represented as a <a href="../../../GML_Overview/Data_Types.htm">handle</a> (see the &quot;<strong>Handles</strong>&quot; section on the linked page).</li>
<li>Upon <a href="json_parse.htm">parsing</a> the JSON, these will be converted back into runtime references so the resources can be used normally in functions. This includes any resource type that is represented as a <a href="../../../GML_Overview/Data_Types.htm">handle</a> (see the &quot;<strong>Handles</strong>&quot; section on the linked page). This conversion can be disabled when parsing.</li>
<li>Keep in mind that this will not be useful between game sessions as asset and resource information may have changed, depending on the type of resource. Assets are saved using their names so these references maintain their links as long as the asset name does not change.</li>
<li>If you want to serialise data structures (specifically lists and maps), use the <span class="inline3_func"><a data-xref="{title}" href="json_encode.htm">json_encode</a></span> function.</li>
</ul>
Expand All @@ -35,8 +35,8 @@ <h3>Conversion Notes</h3>
For more information see the <a href="https://ecma-international.org/publications-and-standards/standards/ecma-404/">ECMA JSON Standard</a>.
</li>
<li>If the provided struct contains any circular references, such as references back to the main struct itself (forming an infinite loop) or references to structs within the main struct forming such infinite loops, such references will be converted to <span class="inline2">null</span> upon stringifying.</li>
<li>If you include an int64 in the values to convert to JSON, it will write it as an <i>int</i> if it is in the valid range for an int32, as a <i>double</i> if it can do so without losing precision, or, if neither of those cases is applicable, as a <i>string</i> with an identifier &quot;<span class="inline">@i64@</span>&quot; before it and &quot;<span class="inline">$i64$</span>&quot; after it. When you come to parse the JSON again <span data-keyref="GameMaker Name">GameMaker</span> will pick these identifiers up and re-convert the value back into an int64. This does mean that if the JSON is intended for a server or some other non-GameMaker target, these values will not be appropriate and so should be avoided.</li>
<li><a href="../../../GML_Overview/Data_Types.htm"><span class="inline2">infinity</span></a> and <a href="../../../GML_Overview/Data_Types.htm"><span class="inline2">NaN</span></a> will be written into the JSON as <span class="inline2">&quot;@@infinity$$&quot;</span> (<span class="inline2">&quot;@@-infinity$$&quot;</span> for negative) and <span class="inline2">&quot;@@nan$$&quot;</span> respectively. These values will be correctly loaded back into memory when the JSON is loaded with <span class="inline3_func"><a data-xref="{title}" href="json_parse.htm">json_parse</a></span>.</li>
<li>If you include an int64 in the values to convert to JSON, it will write it as an <i>int</i> if it is in the valid range for an int32, as a <i>double</i> if it can do so without losing precision, or, if neither of those cases is applicable, as a <i>string</i> with an identifier &quot;<span class="inline">@i64@</span>&quot; before it and &quot;<span class="inline">$i64$</span>&quot; after it. When you come to parse the JSON again <span data-keyref="GameMaker Name">GameMaker</span> will pick these identifiers up and re-convert the value back into an int64 (unless conversion is disabled). This does mean that if the JSON is intended for a server or some other non-GameMaker target, these values will not be appropriate and so should be avoided.</li>
<li><a href="../../../GML_Overview/Data_Types.htm"><span class="inline2">infinity</span></a> and <a href="../../../GML_Overview/Data_Types.htm"><span class="inline2">NaN</span></a> will be written into the JSON as <span class="inline2">&quot;@@infinity$$&quot;</span> (<span class="inline2">&quot;@@-infinity$$&quot;</span> for negative) and <span class="inline2">&quot;@@nan$$&quot;</span> respectively. These values will be correctly loaded back into memory when the JSON is loaded with <span class="inline3_func"><a data-xref="{title}" href="json_parse.htm">json_parse</a></span> (unless conversion is disabled).</li>
<li>If you include <a href="../../../GML_Overview/Data_Types.htm"><span class="inline2">undefined</span></a> in the struct, it will be encoded as <span class="inline2">null</span>, which will be read back as <span class="inline2">undefined</span> when <a href="json_parse.htm">parsing</a>.</li>
<li>Care should be taken when writing any returned JSON string to an <span class="inline">ini</span> file, as the <span class="inline">ini</span> specifications can cause issues when using quotes and escape characters. See the function <a href="../Ini_Files/ini_write_string.htm"><span class="inline">ini_write_string()</span></a> for more information.</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>load_csv</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 @@ -18,6 +18,7 @@
<h1>load_csv</h1>
<p>This function will load a CSV format file and convert it into a DS grid, returning the unique ID value for the grid created.</p>
<p>Your CSV file should follow the <a href="http://super-csv.github.io/super-csv/csv_specification.html" title="CSV specification">CSV specification</a>. If your CSV syntax is not correct, you will get unexpected results on loading the file.</p>
<p>This will load each cell as a <a href="../../../GML_Overview/Data_Types.htm">string</a>, even if it only contains numbers. Use the function <span class="inline3_func"><a href="../../Strings/real.htm">real</a></span> to convert a string into number.</p>
<p> </p>
<h4>Syntax:</h4>
<p class="code">load_csv(filename)</p>
Expand All @@ -30,14 +31,14 @@ <h4>Syntax:</h4>
</tr>
<tr>
<td>filename</td>
<td><span data-keyref="Type_String"><a href="../../../../../GameMaker_Language/GML_Overview/Data_Types.htm" target="_blank">String</a></span></td>
<td><span data-keyref="Type_String"><a href="../../../GML_Overview/Data_Types.htm" target="_blank">String</a></span></td>
<td>The name of the file to open (as a string)</td>
</tr>
</tbody>
</table>
<p> </p>
<h4>Returns:</h4>
<p class="code"><span data-keyref="Type_ID_DS_Grid"><a href="../../../../../GameMaker_Language/GML_Reference/Data_Structures/DS_Grids/ds_grid_create.htm" target="_blank">DS Grid ID</a></span></p>
<p class="code"><span data-keyref="Type_ID_DS_Grid"><a href="../../Data_Structures/DS_Grids/ds_grid_create.htm" target="_blank">DS Grid</a></span></p>
<p> </p>
<h4>Example:</h4>
<p class="code">file_grid = load_csv(&quot;spreadsheet.csv&quot;);<br />
Expand All @@ -49,7 +50,7 @@ <h4>Example:</h4>
{<br />
    for (var j = 0; j &lt; hh; j++;)<br />
    {<br />
        draw_text(xx, yy, string(file_grid[# i, j]));<br />
        draw_text(xx, yy, file_grid[# i, j]);<br />
        yy += 32;<br />
    }<br />
    yy = 32;<br />
Expand Down
Loading

0 comments on commit 06c32fa

Please sign in to comment.