<li><aclass="backlink"title="Click to do a full-text search for this title"href="./GUI_Variables?action=fullsearch&value=linkto%3A%22GUI+Variables%22&context=180">GUI Variables</a></li>
<spanclass="anchor"id="line-1"></span><pclass="line862">The Quake 4 GUI system was designed to be driven mainly by the code. To do this, <strong>gui variables</strong> are often used so that when certain states change, the GUI automatically handles it and doesn't have to do any state determination on its own (since it's not really up to that task). <spanclass="anchor"id="line-2"></span><spanclass="anchor"id="line-3"></span><pclass="line862">The syntax for a GUI variable is <strong>gui::variablename</strong>. The most common use for this is to set the visibility or text of GUI elements. For example, you may want to include a lag icon in your HUD to tell the player that their connection is unstable. The code can tell the HUD when to display this icon by setting a boolean GUI variable to true or false, and the icon's visibility in the HUD can be set to the GUI variable accordingly: <spanclass="anchor"id="line-4"></span><spanclass="anchor"id="line-5"></span><pclass="line867"><spanclass="anchor"id="line-6"></span><pre> windowDef icon_lag
<spanclass="anchor"id="line-7"></span> {
<spanclass="anchor"id="line-8"></span> rect 0,0,100,100
<spanclass="anchor"id="line-12"></span></pre><spanclass="anchor"id="line-13"></span><spanclass="anchor"id="line-14"></span><pclass="line874">When the boolean GUI variable is true ( 1 ), the visibility of the lag icon will be automatically set to 1, and vice versa when the variable is false ( 0 ). <spanclass="anchor"id="line-15"></span><spanclass="anchor"id="line-16"></span><pclass="line874">There are instances, particularly in HUDs, when windowDefs can be used in a generic way to serve as message windows for the player: <spanclass="anchor"id="line-17"></span><spanclass="anchor"id="line-18"></span><pclass="line867"><spanclass="anchor"id="line-19"></span><pre> windowDef text_spectate
<spanclass="anchor"id="line-20"></span> {
<spanclass="anchor"id="line-21"></span> rect 0,0,640,20
<spanclass="anchor"id="line-22"></span> visible 1
<spanclass="anchor"id="line-23"></span> text "gui::spectatetext"
<spanclass="anchor"id="line-25"></span></pre><spanclass="anchor"id="line-26"></span><spanclass="anchor"id="line-27"></span><pclass="line874">In the example above, the text string would always be set in the code and displayed in that window. When the text string is empty, nothing will show up. <spanclass="anchor"id="line-28"></span><spanclass="anchor"id="line-29"></span><pclass="line874">GUI variables can also be set and checked just like desktop variables. For example, gui::inGame is often used by the mainmenu in an if-statement check to determine if the player is in-game and thus which menu items to show. <spanclass="anchor"id="line-30"></span><spanclass="anchor"id="bottom"></span></div><pid="pageinfo"class="info"lang="en"dir="ltr">GUI Variables (last edited 2005-11-02 22:51:05 by <spantitle="MattVainio @ 67.129.250.254[67.129.250.254]"><aclass="nonexistent"href="./MattVainio.html"title="MattVainio @ 67.129.250.254[67.129.250.254]">MattVainio</a></span>)</p>
<li><ahref="http://moinmoin.wikiwikiweb.de/">MoinMoin Powered</a></li><li><ahref="http://www.python.org/">Python Powered</a></li><li><ahref="http://validator.w3.org/check?uri=referer">Valid HTML 4.01</a></li>