Gui movearound question

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

hakoninn
Just popping in
Just popping in
Posts: 2
Joined: Wed Jul 28, 2010 01:14

Gui movearound question

Postby hakoninn » Wed Jul 28, 2010 01:55

Hi and thanks for reading.

I am very new to programming (half a year or so max) and I really am still struggling with the basics and the underlying theory. I was hoping for a nudge in the right direction.
I'm trying my hardest to learn by doing although I have spent probably every night reading a book on VC++,game programing and scrillions of tutorials in the last month or 2. I just need to get something kinda working so i can play around with it so i can try out new things i read so they sticks with me.
So treat my like a newb! But know that I am trying hard.

I have everything up and running smooth with ogre3d and CEGUI and i have been able to create a beautiful start-up screen( 3 awesome buttons) for a very simple little "game" (mainly just going to be a few buttons with some answers or whatever in a text-box or 2. Adding different user controls along the way for practice.

Here is my question:
How do I go about moving from one "scene", "screen" to another. I really don't want to start using something that i will ultimately abandon and chose a different route so a some expert knowledge would be great.

Problem:
i want to click a "button" (already have the events handlers set up and the mighty quit button is working as it should) that removes the buttons on scene and displays lets say .. an imagebutton or 2 that load fast and nicely (not like when i tried this using windows forms and setVisible =false and true a month or so ago)

I really dont know where to start with this. Do people use a basic root-sheet window pointer and throw it around to different functions using references, removing and adding objects along the way?
Do people build a separate class to hold all the different scenes, objects and variables ?
Is there an awesome way to do this by using a different scenemanagers for each scene?
Do people retain the root pointers or make new ones for each scene and destroyscene them when you click a button only to make a new one with different child window-buttons ?
I am so lost!

All the tutorials i have been able to find have to do with adding an item to a scene and making it work in some random awesome way. What I am looking for is some good sized text on how actually people go about moving around the gui.

Sorry for the horribly chaotic post! I have way to many questions.

Any advice is appreciated.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Gui movearound question

Postby Kulik » Wed Jul 28, 2010 02:07

You could prepare both your "scenes" to 2 DefaultWindows (CEGUI::GUISheet) and then switch them via CEGUI::System::setGUISheet.

I personally created few layouts via CELayoutEditor and I "activate" and "deactivate" them by adding them and removing them from the root GUI Sheet. But my use-case is different. I need to support multiple active layouts. If you just need one active "scene", switching the root GUI sheet is probably more suitable.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Gui movearound question

Postby Jamarr » Wed Jul 28, 2010 17:47

You can achieve a similar effect without having to switch GUISheets by introducing a second layer. Instead of switching GUISheet, you can just add/remove your scenes root-window (still a DefaultWindow, with MousePassThrough enabled) to the GUISheet as needed; or, similarly, add all of your scenes as children up front and then show/hide the root-window for a scene as necessary. And as you pointed out, you could also create your own scene-manager that groups windows by scene and then shows/hides a set of windows based on the scene you want to show.

Personally, I would avoid the switching-GUISheet route as it prevents you from being able to show multiple scenes simultaneously (which you may want to do later), and is no easier to implement than using a single GUISheet, having windows grouped under child (DefaultWindow) windows, and show/hiding them as necessary. As far as creating your own-grouping mechanism, why re-invent the wheel? CEGUI already provides a mechanism to group windows via the window-hierarchy (add/remove child).
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

hakoninn
Just popping in
Just popping in
Posts: 2
Joined: Wed Jul 28, 2010 01:14

Re: Gui movearound question

Postby hakoninn » Thu Jul 29, 2010 15:32

Thanks a lot you 2. Got me started, been playing around with it, trying to figure it out and understand it better. Just what I was looking for


Return to “Help”

Who is online

Users browsing this forum: Bing [Bot] and 19 guests