gm-docs-parser 1.0.0

A collection of typings for GameMaker Studio 2 manual pages
Documentation
<?xml version="1.0" encoding="utf-8" ?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>

  <script type="text/javascript" language="JavaScript">
    //<![CDATA[
    function reDo() {
      if (innerWidth != origWidth || innerHeight != origHeight)
        location.reload();
    }
    if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
      origWidth = innerWidth;
      origHeight = innerHeight;
      onresize = reDo;
    }
    onerror = null;
  //]]>
  </script>
  <style type="text/css">/*<![CDATA[*/

    < !-- div.WebHelpPopupMenu {
      position: absolute;
      left: 0px;
      top: 0px;
      z-index: 4;
      visibility: hidden;
    }

    p.WebHelpNavBar {
      text-align: right;
    }

    -->
  
/*]]>*/</style>

  <script type="text/javascript">//<![CDATA[

    gRootRelPath = "../../..";
    gCommonRootRelPath = "../../..";
    gTopicId = "9.2.19.0_19";
  
//]]></script>

  <script type="text/javascript" src="../../../template/scripts/rh.min.js"></script>
  <script type="text/javascript" src="../../../template/scripts/common.min.js"></script>
  <script type="text/javascript" src="../../../template/scripts/topic.min.js"></script>
  <script type="text/javascript" src="../../../template/scripts/topicwidgets.min.js"></script>
<script type="text/javascript" src="../../../whxdata/projectsettings.js"></script>
  <link rel="stylesheet" type="text/css" href="../../../template/styles/topic.min.css"/>
  <link rel="stylesheet" type="text/css" href="../../../template/Charcoal_Grey/topicheader.css"/>
  <meta name="topic-status" content="Draft"/>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>gml_pragma</title>
  <meta name="generator" content="Adobe RoboHelp 2019"/>
  <link rel="stylesheet" href="../../../assets/css/default.css" type="text/css"/>
  <meta name="rh-authors" content="Mark Alexander"/>
  <meta name="topic-comment" content="Reference page for gml_pragma"/>
  <meta name="rh-index-keywords" content="gml_pragma"/>
  <meta name="search-keywords" content="gml_pragma"/>
</head>

<body>
  <div class="topic-header rh-hide" id="rh-topic-header" onclick="rh._.goToFullLayout()">
    <div class="logo">
    </div>
    <div class="nav">
      <div class="title" title="gml_pragma">
        <span>gml_pragma</span>
      </div>
      <div class="gotohome" title="Click here to see this page in full context">
        <span>Click here to see this page in full context</span>
      </div>
    </div>
  </div>
  <div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div>



  <!--<div class="body-scroll" style="top: 150px;">-->
  <h1>gml_pragma</h1>
  <p>The <tt>gml_pragma</tt> function affects how the given target compiles your code and should be called with the different commands to further optimise the final compilation of your project. These commands are effectively <i>pre-processed</i> before the
    game is compiled and so the function can be placed anywhere in your project and it will still be processed before the game is fully compiled. The available commands are as follows:</p>
  <ul class="colour">
    <li>&quot;<b>forceinline</b>&quot; - When the function is called with the &quot;forceinline&quot; pragma in a <b>script function</b>, the YYC will compile the project with the function inline, rather than referenced. This will give a further processing
      boost, but care must be taken when using it as it will also inflate the final executable file size, especially if the in-lined code is large and/or used in multiple different places, as well as greatly increase the compile time. Note that this pragma
      is <b>only valid when building using the YYC</b>.</li>
    <li>&quot;<b>global</b>&quot;, &quot;<b>[gml code]</b>&quot; - The &quot;global&quot; pragma permits you to call some GML code formatted as a string, at a <b>global</b> scope, at compile time, before the first room of the game executes. For example:<br/>
      <p class="code">gml_pragma(&quot;global&quot;, &quot;Init()&quot;);</p>
      This will call the script function &quot;Init&quot; before the first room of the game is run. Note that the GML supplied as the second argument <b>must be a compile time constant</b>, and also note that you cannot use this pragma to create instances
      or perform any operations that require a room (or anything in a room) to function.</li>
    <li>&quot;<b>PNGCrush</b>&quot; - The &quot;PNGCrush&quot; pragma will use the <a href="https://pmt.sourceforge.io/pngcrush/" target="_blank">PNGCrush</a> program on each texture created. Note that this can add significantly to the time that it takes
      to compile the game, so you don&#39;t want it on all the time, although it can make significant savings on final file size.</li>
    <li>&quot;<b>Texgroup.Scale</b>&quot;, &quot;<b>[TextureGroupName]</b>&quot;, &quot;<b>[Scale Divisor]</b>&quot; - The &quot;Texgroup.Scale&quot; will scale the given texture group on compile. You need to give an additional two arguments here: the &quot;[TexGroupName]&quot;,
      which is the name (a string) of the texture group to scale, and the &quot;[Scale Divisor]&quot; (also a string), which is the divisor you wish to use for the scaling, i.e:<br/>
      <p class="code">gml_pragma(&quot;Texgroup.Scale&quot;, &quot;level1&quot;, &quot;2&quot;);</p>
      This will half all the textures in the &quot;level1&quot; texture group.</li>
    <li>&quot;<b>UnityBuild</b>&quot;, &quot;<b>[enable/disable]</b>&quot; - If you call the function with this pragma and set the enable/disable argument to <tt>true</tt> then on compile it will collapse all the .cpp files in the project into a single file
      which it then uses to build everything, for example:<br/>
      <p class="code">gml_pragma(&quot;UnityBuild&quot;, &quot;true&quot;);</p>
      The benefit of doing a unity build is that builds are faster but the down side is that it does a <i>full</i> build each time so even if you change a single part of the code it will build everything again without using any cached files. This has
      been added specifically for the Xbox One export using the YYC although it can be called for other builds (<b>YYC only</b>). For more information on unity builds, please see <a href="http://buffered.io/posts/the-magic-of-unity-builds/" target="_blank">here</a>.</li>
  </ul>
  <p class="note"><b>NOTE</b>: The first argument to the <tt>gml_pragma</tt> function <b>must be a compile time string constant</b> and not a variable.</p>
  <p> </p>
  <h4>Syntax:</h4>
  <p class="code">gml_pragma(command, [optional...]);</p>
  <table>
    <tbody>
      <tr>
        <th>Argument</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>command</td>
        <td>A string with one of the commands listed below.</td>
      </tr>
      <tr>
        <td>[optional]</td>
        <td>Some of the available commands require an optional argument or arguments. These are explained below for each command.</td>
      </tr>
    </tbody>
  </table>
  <p> </p>
  <h4>Returns:</h4>
  <p class="code">N/A</p>
  <p> </p>
  <h4>Example:</h4>
  <p class="code">gml_pragma(&quot;forceinline&quot;);</p>
  <p>The above example code will force the script function where it is used to be in-lined on compile.</p>
  <p> </p>
  <p> </p>
  <p> </p>
  <div class="footer">
    <div class="buttons">
      <div class="clear">
        <div style="float:left">Back: <a href="OS_And_Compiler.htm">OS And Compiler</a></div>
        <div style="float:right">Next: <a href="parameter_count.htm">parameter_count</a></div>
      </div>
    </div>
    <h5>© Copyright YoYo Games Ltd. 2020 All Rights Reserved</h5>
  </div>
  <!-- KEYWORDS
gml_pragma
-->
  <!-- TAGS
gml_pragma
-->

</body></html>