Page 1 of 1

Gui movearound question

Posted: Wed Jul 28, 2010 01:55
by hakoninn
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.

Re: Gui movearound question

Posted: Wed Jul 28, 2010 02:07
by Kulik
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.

Re: Gui movearound question

Posted: Wed Jul 28, 2010 17:47
by Jamarr
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).

Re: Gui movearound question

Posted: Thu Jul 29, 2010 15:32
by hakoninn
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