Creating Sheets or Skin Sets?

rluck

29-08-2007 00:27:25

I can't find any documentation on creating either of these. It seems thats the EASIEST way to create a GUI using QuickGUI, but its impossible to find how its done.

edit: I understand creating sheets, but skin sets? I can't find a .material file w/ all the qgui images either?

kungfoomasta

29-08-2007 01:47:26

Sorry, I need to learn how to wiki and write down a lot of the fundamentals..

GUIManager::loadSkin("mySkin") will automatically search all Ogre resource paths and add all support images that begin with "mySkin". For example "mySkin.button1.png", "mySkin.button1.down.png", "mySkin.label.png", etc. (will NOT except ".mySkin.button.png", the filename must start with the skin name. --enforcing a naming standard, but you aren't forced to use SkinSet's if you don't want to :wink: )

After making the call to "loadSkin", you can just use the texture's normally. The setTexture function calls _setTexture, which will query all created SkinSets and properly use the embedded image. Note that setTexture also supports images not a part of any SkinSets, and also manually created textures (Ogre::Texture).

There is no use for materials anymore, QuickGUI only supports textures. (any image that Ogre can use to make a texture, or manually created texture like RenderToTexture and other procedural textures)

This means you should probably have your own methods for organization. For example, I made a folder called "qgui" and put all my qgui images in there. That isn't a requirement, since all qgui images in the resource path will be found, but it makes skins easier to locate, update, and manage in general.

Hope that helps. :)

rluck

29-08-2007 02:31:16

Sorry, I need to learn how to wiki and write down a lot of the fundamentals..

GUIManager::loadSkin("mySkin") will automatically search all Ogre resource paths and add all support images that begin with "mySkin". For example "mySkin.button1.png", "mySkin.button1.down.png", "mySkin.label.png", etc. (will NOT except ".mySkin.button.png", the filename must start with the skin name. --enforcing a naming standard, but you aren't forced to use SkinSet's if you don't want to :wink: )

After making the call to "loadSkin", you can just use the texture's normally. The setTexture function calls _setTexture, which will query all created SkinSets and properly use the embedded image. Note that setTexture also supports images not a part of any SkinSets, and also manually created textures (Ogre::Texture).

There is no use for materials anymore, QuickGUI only supports textures. (any image that Ogre can use to make a texture, or manually created texture like RenderToTexture and other procedural textures)

This means you should probably have your own methods for organization. For example, I made a folder called "qgui" and put all my qgui images in there. That isn't a requirement, since all qgui images in the resource path will be found, but it makes skins easier to locate, update, and manage in general.

Hope that helps. :)

Just the response I was looking for, thanks so much, I love the changes you've made since 0.9.5.

rluck

29-08-2007 18:29:18

Is there a way for me to get the name of a button, or other clickable element when its clicked on using event handlers? Also, if I create a button and I specify a texture it doesn't seem to have mouse overs.

edit: correction, no mouse overs are working, not even using the default skinset. Is it because the button doesn't have any events tied to it?
edit2: button now has events, still isn't working...

edit3: Problem solved.

kungfoomasta

29-08-2007 22:39:47

Glad you solved the problem! :lol:

All event handlers are passed EventArgs, but in a lot of cases, especially mouse related ones, you are actually passed a MouseEventArgs reference. MouseEventArgs inherit from WidgetEventArgs, and this class contains a pointer to the Widget involved in the event. Briefly thinking about events, I think all events are tied to a Widget, meaning I don't really need a distinction between EventArgs and WidgetEventArgs. . .

Either way, you can cast it to WidgetEventArgs or MouseEventArgs and obtain a pointer to the widget involved, and from that get its name. I believe the demo has an example of casting the args to get the widget. If not, I can post one up later. (I'm at work) If you want to be confident that you can correctly cast, there is an EventArgs::Type field, and you can check it. In this case, if the Type is not of type EventArgs, you know it will contain a reference to the widget, and can cast safely.

It could be the case that setting a button's texture doesn't update the over and down textures. I also need to make functions to be able to set these textures. I'll check it tonight.

rluck

30-08-2007 00:16:54

The issue was actually just creating a button outside of a window. I have run into another issue though. I've created a class to create sheets for QuickGUI, and creating the FIRST object works fine, however when I attempt to create a second one it crashes, can you think of any reason it'd be doing that? The sheets have different names...do I need to specify a texture if I'm creating a sheet from scratch more than once?

edit: solved again, named one element the same as another.