How to set texture for button manualy in latest SVN?


03-12-2007 23:33:20

I am download latest SVN and view that my project is does not work.

Any textures for GUI elements is not loaded. I think this is becouse new QuickGUI has skin system.

I am find files qgui.skinset, SkinSet.qgui.png
and I am view that this files contains all elements.

But I have 2 qustions:

1. How to set texture from single file such as my.button.png. Function setTexture is removed from button.
2. How to create qgui.skinset, SkinSet.qgui.png files manualy for my skin.


03-12-2007 23:42:51

setTexture was removed from all Widgets except Sheet and Image. I am forcing all widgets to be visually defined by a Skin.

1. You will need to create a Skin.
2. SkinSetManager::getSingleton().loadSkin("mySkin",IMAGE_TYPE_PNG);

loadSkin should create "mySkin.skinset" and "SkinSet.mySkin.png". After you have loaded your skin, call



03-12-2007 23:55:54

Hm. But how to set miscellaneouses images for 2 buttons.

My project have many buttons: 2 type of small buttons, 2 type of medium buttons.

In older version I am use setTexture function. In new version I have only 1 texture for all buttons.

My designer like to create experiment with game skin. On older version he only replace images and view new result, in new version he want to create new skin for test new button?

This is does not comfortable :-( and I think this is remove QuickGUI flexibility. IMHO.

This system is good, but without normal QuickGUI tools it take many problems.


04-12-2007 00:11:54

I explained in another thread the reason for removing the setTexture functionality. Think about Complex widgets. For something as simple as a button, its easy to maintain the setTexture feature. There is only one Render Component, and it changes between 3 textures. Now take a complex widget, for example, the Console widget:

Console widget Render Components:
1. Base
1a. Base Border
2a. TextBox Border
3a. List items
3b. Horizontal ScrollBar
3ba. HScrollBar slider
3bb. HScrollBar buttons left/right
3c. Vertical ScrollBar
3ca. VScrollBar slider
3cb. VScrollBar buttons, up/down

How is it possible for "setText" to change the appearance of all components according to user defined images? I have listed about 13 different textures. Won't it look odd to have only Base texture changed?


The console widget is the first of many complex widgets.. its not possible to use setTexture and have a simple, easy to use system.

Regarding multiple buttons, you have brought up a very valid and important point. Currently you will have to define a Skin for every button image. I will also address this when the SkinSet Editor is made, allowing users to define SkinComponents. Right now you'll have to make "skin1" and "skin2", each defining a button.

Another important point is that Buttons will have borders. The current qgui buttons were made before borders were created, the skin needs to be updated to better looking ones. It seems more natural to "skin" a widget, instead of mixing and matching textures.

Sorry for the loss of flexibility in this regard, but considering the future direction, the pros outweigh the cons.


04-12-2007 00:26:09

But skin files is very big.
New skin for my button must contains other controls or only button images.


04-12-2007 00:38:54

You can make a skin that only has 3 images in it, for your button. Right now the Size is hardcoded to 1024 x 1024, in the future this will also be customizable, so you can make a skin that is smaller.

To make your skin:

1. Create <skinName>.button.png, <skinName>.button.down.png, <skinName>.over.png
2. SkinSetManager::getSingleton().loadSkin(<skinName>,IMAGE_TYPE_PNG);
3. myButton->setSkin(<skinName>);

Please note I have not tried this myself, and I haven't yet brushed up on the creation of the *.skinset file. Apologies if this doesn't work as I would like. It's on the ever growing list of TODOs..

I would like to make it possible to have multiple widget definitions within a single SkinSet, but I don't see any easy way to accomplish this. I will have to think about it.

Thanks for being understanding.


04-12-2007 10:25:27

I tried to use it. This method works.

But there are some issues.
Files SkinSet.gameplay.png generated each time?
Why not create them once and then use it.


04-12-2007 10:26:52

O. If I am use last parametr in loadSkin function, skin created once.
I set resource grop. This is correct?
QuickGUI::SkinSetManager::getSingleton().loadSkin("gameplay",QuickGUI::SkinSet::IMAGE_TYPE_PNG, mResourceGroup);


04-12-2007 17:26:58

Yes I believe that is correct. I also investigated a bug, and can confirm the *.skinset file will only contain the names of found texture files.

The idea is to create *.skinset and SkinSet.*.png files if not existing, and re-use them in the future. This will be upgraded in the future, so that the SkinSet files can be created in the SkinSetEditor, and used in your application.


04-12-2007 17:52:53

Maybe need to create two functions loadSkin and createSkin?


04-12-2007 17:57:57

loadSkin() looks for *.skinset resource and parses it. If doesn't exist, creates it. In the future it will not create anything, mainly because the algorithm to automatically place images will never be as optimized as manual placement. This also goes with resizing the SkinSet file. You probably don't need 1024 x 1024 for your second button, so right now its a waste of space.

I'm glad you got it working, hopefully you will like it when I improve it! :)


14-12-2007 12:37:13

Currently QuickGUI does not check for exists quickgui SkinSet.
QuickGui update SkinSet for each run?


14-12-2007 18:58:22

I will double check this, but the intention is that it does check for existing skins, provided you make the call to "loadSkin".


14-12-2007 19:04:45

I am use following code:
String mResourceGroup = "quickgui";
if (std::find(groups.begin(), groups.end(), mResourceGroup) == groups.end())

QuickGUI::SkinSetManager::getSingleton().loadSkin("qgui",QuickGUI::SkinSet::IMAGE_TYPE_PNG, mResourceGroup);
QuickGUI::SkinSetManager::getSingleton().loadSkin("gameplay",QuickGUI::SkinSet::IMAGE_TYPE_PNG, mResourceGroup);

And if I run my project, files SkinSet.qgui.png, SkinSet.gameplay.png, gameplay.skinset, qgui.skinset is up dated (date on this files is date of latest run)


14-12-2007 19:13:17

I am view log and find this:
20:53:14: WARNING: Texture instance 'SkinSet.qgui.png' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.

message loged only for SkinSet.qgui.png, but program update and SkinSet.gameplay.png file

als I am find this:

21:10:19: Creating resource group skinqgui
21:10:19: Quickgui : Adding qgui.button.disabled.pngto skinqgui
21:10:19: Quickgui : Adding qgui.button.down.pngto skinqgui
21:10:19: Quickgui : Adding qgui.window.titlebar.button.over.pngto skinqgui
21:10:19: Quickgui : Adding qgui.window.titlebar.button.pngto skinqgui
21:10:19: Quickgui : Adding qgui.window.titlebar.pngto skinqgui
21:10:19: QuickGui ConfigScriptSerializer : saving to../../Media/System/QuickGui/qgui.skinset
21:10:19: ConfigScriptSerializer : done.
21:10:19: QuickGui ConfigScriptSerializer : saving to../../Media/System/QuickGui/gameplay.skinset

Quickgui is resave skin files...


14-12-2007 19:28:03

Yah it definately looks that way. I'll look into this and see what I can find.