Assembly: DigitalRune.Game.UI (in DigitalRune.Game.UI.dll) Version: 1.1.0.0 (1.1.1.9392)
Syntax
| C# |
|---|
public class Theme |
| Visual Basic |
|---|
Public Class Theme |
| Visual C++ |
|---|
public ref class Theme |
Remarks
A Theme can be built at runtime, but usually a theme is defined in an XML files that is processed in the XNA Content Pipeline and loaded via the XNA ContentManager.
The XML file specifies mouse cursors (only used in Windows), fonts, a texture and styles. The texture is a texture atlas containing all images that are necessary to render the controls. The styles define property values and the visual appearance of UI controls.
XML Format: See the example themes to learn how the XML file is structured. Colors, rectangles and 4D vectors are specified using 4 float values separated with commas, semicolons and/or spaces, for example "100,200,300,400". (Colors are defined as "red,green,blue,alpha", rectangles are defined as "x,y,width,height", borders/margins/paddings are defined as "left,top,right,bottom".)
Processing and Loading: To load a theme add the XML file to an XNA Content Project. The content project needs to reference the following DigitalRune content pipeline assemblies: "DigitalRune.Mathematics.Content.Pipeline.dll" and DigitalRune.Game.UI.Content.Pipeline.dll". Once the assembly references are added, set the Content Importer and the Content Processor of the XML file to "UI Theme - DigitalRune". The theme and all related files are then automatically built together with the content project.
At runtime the theme can be loaded using the game's ContentManager.
| C# | |
|---|---|
Theme theme = Content.Load<Theme>("BlendBlue"); | |