Skip to main content

History: QuickGUI SkinSets

Source of version: 2 (current)

Copy to clipboard
            !What is a SkinSet, and how can I create and use one?
A SkinSet is a TextureAtlas, created from a bunch of Images, that form a Skin. SkinSets are created 
via ''SkinSetManager::loadSkin''. For example, ''loadSkin(“qgui”,"myResourceGroup");'' will iterate 
through all of Ogre’s resource locations looking for Image files beginning with “qgui”. 
(“qgui.button.png”, for example) SkinSets are automatically used whenever possible, there is no 
additional steps required from the user. Following the example using “qgui.button.png”, the following 
line of code would make use of the qgui SkinSet: __mButton->setTexture(“qgui.button.png”)__.

__The benefit of creating SkinSets is that it minimizes texture batching.__

__The current maximum size of SkinSet textures is 1024 by 1024.__

Also note that QuickGUI supports images that are not a part of any SkinSet, and you are not required to use them.

!How does the Skin naming convention work?
QuickGUI makes certain assumptions about Images, and how they are used in widgets. Widgets take their 
texture name and separate its extension, and use the base name for its functionality. Below are 
currently supported naming conventions:

Buttons:
{MONO()}Base + extension{MONO}
{MONO()}Base + “.over” + extension{MONO}
{MONO()}Base + “.down” + extension{MONO}

If you create a button with texture “qgui.button.png”, it will make assumptions and use 
“qgui.button.over.png” and “qgui.button.down.png”. If these textures do not exist, the button will not 
be drawn in that state. In the future, I will make sure to have functions to be able to set these 
textures, in case you do not want to follow the standard.

Windows:
{MONO()}Base + extension
 Base + “.titlebar” + extension
 Base + “.titlebar.button” + extension
 Base + “.titlebar.button.over” + extension
 Base + “.titlebar.button.down” + extension{MONO}

The list is actually quite long. Please refer to the qgui Skin images, as they match the assumptions 
made. Although this may seem like a restriction, it is actually helpful in creating GUI’s quickly, and 
forces a intuitive and descriptive filename for each image.

!How can I make use of the images within a Skin?
Lets say you have several buttons, and each have a different texture:

{MONO()}qgui.button.png 
 qgui.button.down.png 
 qgui.button.over.png 
 
 qgui.myCoolButton.png 
 qgui.myCoolButton.down.png 
 qgui.myCoolButton.over.png{MONO}
 
{CODE(wrap="1", colors="c++")} Button* b1 = mySheet->createButton(); // uses qgui.button.png 
 
 Button* b2 = mySheet->createButton(); // uses qgui.button.png 
 b2->setSkinComponent(".myCoolButton"); // uses qgui.myCoolButton.png{CODE} 

By using the "setSkinComponent" function you can tell Widgets to use a different texture within a SkinSet.