Open main menu

Difference between revisions of "GUI Themes/Specs"

36 bytes added ,  15:08, 25 October 2018
m
Text replacement - "</source>" to "</syntaxhighlight>"
(→‎Resolution-dependent keys and layouts: Fix more syntax highlighting)
m (Text replacement - "</source>" to "</syntaxhighlight>")
Line 112: Line 112:
     ...
     ...
</layout_info>
</layout_info>
</source>
</syntaxhighlight>


The best place to start writing a full theme description is taking a look at the already written themes in the <tt>gui/themes/</tt> directory of the source code repository, while consulting the following documentation for each specific key:
The best place to start writing a full theme description is taking a look at the already written themes in the <tt>gui/themes/</tt> directory of the source code repository, while consulting the following documentation for each specific key:
Line 135: Line 135:
/* Key will ONLY be loaded in resolutions with less than 400 height */
/* Key will ONLY be loaded in resolutions with less than 400 height */
<render_info resolution = 'y<400'>
<render_info resolution = 'y<400'>
</source>
</syntaxhighlight>


Note that the Theme Parser does not assert on repeated keys or values, it just replaces them accordingly. For instance, the following variable definition:
Note that the Theme Parser does not assert on repeated keys or values, it just replaces them accordingly. For instance, the following variable definition:
Line 142: Line 142:
<def var = 'TestVar' value = '100'/>
<def var = 'TestVar' value = '100'/>
<def var = 'TestVar' value = '200' resolution = 'y>399'/>
<def var = 'TestVar' value = '200' resolution = 'y>399'/>
</source>
</syntaxhighlight>


won't fail to parse. What will happen when loading the theme using a resolution with 400 height or mire is that <tt>TestVal</tt> first will be assigned the <tt>100</tt> value, and then it will be overwritten with the <tt>200</tt> value. On the other hand, when loading the theme using a resolution ''with less'' than 400 height, the <tt>ThemeVal</tt> will be assigned the <tt>100</tt> value and the second key will be plain ignored.
won't fail to parse. What will happen when loading the theme using a resolution with 400 height or mire is that <tt>TestVal</tt> first will be assigned the <tt>100</tt> value, and then it will be overwritten with the <tt>200</tt> value. On the other hand, when loading the theme using a resolution ''with less'' than 400 height, the <tt>ThemeVal</tt> will be assigned the <tt>100</tt> value and the second key will be plain ignored.
Line 151: Line 151:
<def var = 'TestVar' value = '100' resolution = 'y<400'/>
<def var = 'TestVar' value = '100' resolution = 'y<400'/>
<def var = 'TestVar' value = '200' resolution = 'y>399'/>
<def var = 'TestVar' value = '200' resolution = 'y>399'/>
</source>
</syntaxhighlight>


This way keys are only parsed on the resolution they are used in, but the result will be '''exactly the same''': Most of the time it's just cleaner to avoid using <tt>y<400</tt> resolution tags, and instead write a layout that works on all resolutions and overwrite parts of it with the <tt>y>399<tt> tag.
This way keys are only parsed on the resolution they are used in, but the result will be '''exactly the same''': Most of the time it's just cleaner to avoid using <tt>y<400</tt> resolution tags, and instead write a layout that works on all resolutions and overwrite parts of it with the <tt>y>399<tt> tag.
TrustedUser
2,147

edits