User Tools

Site Tools


gamedev:dragonscript:guitheme

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
gamedev:dragonscript:guitheme [2015/06/17 23:51] dragonlordgamedev:dragonscript:guitheme [2015/06/17 23:57] (current) – removed dragonlord
Line 1: Line 1:
-<WRAP youarehere> 
-[[:start|Start Page]] >> [[dragengine:modules:dragonscript:main|DragonScript Scripting Language]]  >> **Gui Themes** 
-</WRAP> 
- 
-====== Gui Themes ====== 
-The DragonScript module provides a Gui Toolkit based on the [[gamedev:canvassystem:introduction|canvas system]]. This is a non-mandatory implementation and can be easily replaced by a different toolkit or custom implementation. To help customize the toolkit visually and if required functionally [[http://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1Gui_1_1GuiThemes_1_1GuiTheme.html|gui themes]] are used. A gui theme defines a set of designer factories which produce designers able to design the visual aspects of certain [[http://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Widget.html|widgets]]. A button for example consists of the [[http://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Button.html|button widget]] defining the structure and functionality of the button and the [[http://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1Gui_1_1Designers_1_1ButtonDesigner.html|button designer]] which defines how the button is visualized on screen. Designers usually define the [[gamedev:canvassystem:canvascreators|canvas creators]] to use for a widget. For some widgets designers even create sub-widgets managing their canvas creators. Similar to canvas creators designers are created by designer factories, one for each designer type. In the case of a button this would be [[http://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/interfaceDragengine_1_1Gui_1_1Designers_1_1Factories_1_1ButtonDesignerFactory.html|button designer factories]]. This allows to define gui themes using XML files or programatically without having to know the actual designer implementation. Like canvas creators designers have a setParameter method allowing to set named parameters without needing to know the implementation. The [[http://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1Gui_1_1Designers_1_1Factories_1_1DesignerFactories.html|designer factories]] class stored lists of named designers for all kinds of widget types. You can simply add your own designer factories to this list if you like to customize the appearance of your GUI beyond using designer parameters. You can create gui themes using script code but it is simpler to use XML files. For this purpose a ready made [[http://dragengine.rptd.ch/docs/dragonscript/scriptapi/latest/classDragengine_1_1LoadSave_1_1LoadGuiTheme.html|load xml gui theme]] class exists supporting designer factories list and customizing designers using parameters. 
- 
-<code> 
-// create gui theme loader. this adds the default shipped designer factories for you 
-var LoadGuiTheme loadGuiTheme = LoadGuiTheme.new( gameConsole ) 
- 
-// if you like add custom designers 
-loadGuiTheme.getDesignerFactories().addButtonDesignerFactory( "FancyButton", FancyButtonDesignerFactory.new() ) 
- 
-// load gui theme from xml file. if it asks for a "FancyButton" designer it gets the one above. 
-var DefaultGuiTheme guiTheme = DefaultGuiTheme.new() 
-loadGuiTheme.loadFromFile( "/guithemes/fancy.guitheme.xml", guiTheme ) 
-</code> 
- 
-This is an example of the ready to use modern gui theme included in the DragonScript module. 
-<WRAP center box 600px> 
-{{ :dragengine:modules:dragonscript:guitheme.png |Moden gui theme example}} 
-<WRAP centeralign>Moden gui theme example.</WRAP> 
-</WRAP> 
  
gamedev/dragonscript/guitheme.1434585104.txt.gz · Last modified: 2015/06/17 23:51 by dragonlord