Skip to content

Commit

Permalink
Merge pull request #227 from YoYoGames/develop.bart
Browse files Browse the repository at this point in the history
Clarifications to WebGL limitations, INI open & close behaviour, draw targets, reserved shader function names and others
  • Loading branch information
gurpreetsinghmatharoo authored Dec 20, 2024
2 parents e1a644b + 547168a commit 99a9617
Show file tree
Hide file tree
Showing 29 changed files with 570 additions and 247 deletions.
Original file line number Diff line number Diff line change
@@ -1,67 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>layer_shader</title>
<meta name="generator" content="Adobe RoboHelp 2020"/>
<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"/>
<meta name="topic-comment" content="Page outlining the function layer_shader"/>
<meta name="rh-index-keywords" content="layer_shader"/>
<meta name="search-keywords" content="layer_shader"/>
</head>
<body><!--<div class="body-scroll" style="top: 150px;">-->
<h1><span data-field="title" data-format="default">layer_shader</span></h1>
<p>This function assigns a shader resource to any given layer and the layer will then be rendered using that shader.</p>
<p>You supply either The handle of the layer or the name of the layer (as a string - this will have a performance impact) , along with the ID of the shader to use. The shader must have been created previously in the Asset Browser and the shader index (the name of the shader resource) is then passed to this function. If the layer assigned has instances added to it, then the shader will be applied to <i>all</i> the draw events that the instance uses - for example if the instance has a Draw GUI Begin event, then the shader will be applied automatically to it. The shader will also affect any other graphic elements drawn on that layer, like sprite assets, tile maps or particle systems.</p>
<p class="note"><span data-conref="../../../../../assets/snippets/Tag_note.hts"> </span> The function is <i>not</i> meant to be called in any draw events or step events, but rather only needs to be called at the start of the room in the <b>Room Creation Code</b> or in the <b>Create Event </b>/ <b>Room Start Event</b> of an instance.</p>
<p> </p>
<h4>Syntax:</h4>
<p class="code"><span data-field="title" data-format="default">layer_shader</span>(layer_id, shader)</p>
<table>
<tbody>
<tr>
<th>Argument</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>layer_id</td>
<td><span data-keyref="Type_String"><a href="../../../../../../GameMaker_Language/GML_Overview/Data_Types.htm" target="_blank">String</a></span> or <span data-keyref="Type_ID_Layer"><a href="../../../../../../GameMaker_Language/GML_Reference/Asset_Management/Rooms/General_Layer_Functions/layer_get_id.htm" target="_blank">Layer ID</a></span></td>
<td>The handle of the layer to target (or the layer name as a string)</td>
</tr>
<tr>
<td>shader</td>
<td><span data-keyref="Type_Asset_Shader"><a href="../../../../../../The_Asset_Editors/Shaders.htm" target="_blank">Shader Asset</a></span></td>
<td>The shader index to assign to the layer</td>
</tr>
</tbody>
</table>
<p> </p>
<h4>Returns:</h4>
<p class="code"><span data-keyref="Type_Void">N/A</span></p>
<p> </p>
<h4>Example:</h4>
<p class="code">var lay_id = layer_get_id(&quot;Instances&quot;);
<br/>
<span data-field="title" data-format="default">layer_shader</span>(lay_id, shd_Sepia); </p>
<p>The above code will assign the shader resource <span class="inline2">shd_Sepia</span> to the given layer for all drawing.</p>
<p> </p>
<p> </p>
<div class="footer">
<div class="buttons">
<div class="clear">
<div style="float:left">Back: <a data-xref="{title}" href="General_Layer_Functions.htm">General Layer Functions</a></div>
<div style="float:right">Next: <a data-xref="{title}" href="layer_get_script_begin.htm">layer_get_script_begin</a></div>
</div>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>layer_shader</title>
<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" />
<meta name="topic-comment" content="Page outlining the function layer_shader" />
<meta name="rh-index-keywords" content="layer_shader" />
<meta name="search-keywords" content="layer_shader" />
</head>
<body>
<!--<div class="body-scroll" style="top: 150px;">-->
<h1><span data-field="title" data-format="default">layer_shader</span></h1>
<p>This function assigns a shader asset to any given layer and the layer will then be rendered using that shader.</p>
<p>You supply either the handle of the layer or the name of the layer (as a string - this will have a performance impact) , along with the shader to use. The shader must have been created previously in the Asset Browser and the shader asset is then passed to this function. If the layer assigned has instances added to it, then the shader will be applied to <i>all</i> the draw events that the instance uses - for example if the instance has a Draw GUI Begin event, then the shader will be applied automatically to it. The shader will also affect any other graphic elements drawn on that layer, like sprite assets, tile maps or particle systems.</p>
<p class="note"><span data-conref="../../../../../assets/snippets/Tag_note.hts"> </span> The function is <i>not</i> meant to be called in any Draw events or Step events, but rather only needs to be called at the start of the room in the <b>Room Creation Code</b> or in the <b>Create Event </b>/ <b>Room Start Event</b> of an instance.</p>
<p> </p>
<h4>Syntax:</h4>
<p class="code"><span data-field="title" data-format="default">layer_shader</span>(layer_id, shader)</p>
<table>
<tbody>
<tr>
<th>Argument</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>layer_id</td>
<td><span data-keyref="Type_String"><a href="../../../../GML_Overview/Data_Types.htm" target="_blank">String</a></span> or <span data-keyref="Type_ID_Layer"><a href="layer_get_id.htm" target="_blank">Layer</a></span></td>
<td>The handle of the layer to target (or the layer name as a string)</td>
</tr>
<tr>
<td>shader</td>
<td><span data-keyref="Type_Asset_Shader"><a href="../../../../../The_Asset_Editors/Shaders.htm" target="_blank">Shader Asset</a></span></td>
<td>The shader to assign to the layer</td>
</tr>
</tbody>
</table>
<p> </p>
<h4>Returns:</h4>
<p class="code"><span data-keyref="Type_Void">N/A</span></p>
<p> </p>
<h4>Example:</h4>
<p class="code">var _lay_id = layer_get_id(&quot;Instances&quot;);<br />
<span data-field="title" data-format="default">layer_shader</span>(_lay_id, shd_sepia);
</p>
<p>The above code will assign the shader asset <span class="inline2">shd_sepia</span> to the given layer for all drawing.</p>
<p> </p>
<p> </p>
<div class="footer">
<div class="buttons">
<div class="clear">
<div style="float:left">Back: <a data-xref="{title}" href="General_Layer_Functions.htm">Layers</a></div>
<div style="float:right">Next: <a data-xref="{title}" href="layer_get_script_begin.htm">layer_get_script_begin</a></div>
</div>
<h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2023 All Rights Reserved</span></h5>
</div>
<!-- KEYWORDS
<h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2024 All Rights Reserved</span></h5>
</div>
<!-- KEYWORDS
layer_shader
--><!-- TAGS
-->
<!-- TAGS
layer_shader
--></body>
-->
</body>
</html>
Loading

0 comments on commit 99a9617

Please # to comment.