GUI state machine

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

madeinsoviets
Just popping in
Just popping in
Posts: 13
Joined: Sat Feb 27, 2010 09:16

GUI state machine

Postby madeinsoviets » Mon Mar 01, 2010 11:34

I have another (this time much more) noobish question...)
We have an option to define GUI sheet through the layout editor - are there any ways to define whole state machine of GUI through the facilities of CEGUI?
For example we have an XML with predefined actions - if this button pressed - we setting this sheet if another - another sheed...

Image

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: GUI state machine

Postby CrazyEddie » Mon Mar 01, 2010 17:01

Hi,

At the present time there is no way to specify automatic transitions from one sheet to another; it always requires user code of some kind :)

There are some things you could try though to get an automated sheet switching system in place with a minimum of code and some property support (which should expose it to the editor). The basic recipe would be something like this:

1) In the looknfeel for your button type, add a PropertyDefinition that will hold the name of the target sheet (called "TargetSheet" in this example)
2) Subscribe a handler to the global event set for "PushButton/Clicked"
3) In the handler code, check to see if the "TargetSheet" property exists, if so read the value.
4) If the target sheet is not empty and not == to the current sheet, set it as the new sheet.
5) ???
6) Profit!

I think that's a really simple way to provide automated sheet switching based on button clicks, with a minimal amount of code (i.e. about 6 lines or so).

HTH

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 9 guests