Menu System

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Blynx
Posts: 16
Joined: Sat Apr 12, 2008 8:41 am

Menu System

Post by Blynx »

Hi, i'm new to Irrlicht, just started today and I have a basic understanding from playing around. I have a moveable camera moving in a room.

I want to make a menu system so you choose play or exit.

How am I able to do this?
SirSami
Posts: 20
Joined: Mon Mar 24, 2008 2:18 pm
Location: Finland

Post by SirSami »

Use the GUI system. Have you checked that user interface tutorial yet?
Blynx
Posts: 16
Joined: Sat Apr 12, 2008 8:41 am

Post by Blynx »

I have, but when I draw the GUI the game shows up underneath.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

There is no single right solution for this as it depends on your game. So just a few ideas...

If it does not matter that the game is still rendered below and you simply want to hide it, then add a large guielement (for example a window) which draws the background. And set the background color to non-tranparent (alpha = 255, it's probably that way by default). So you overdraw the background.

But as you know when you want to be in the game (after you pressed play) and when you want to be in the menu (for example after pressing ESC) you can save that information in some variable.

Lets say every time you are in the game you set the bool variable "InTheGame" to true. Then you can put an "if ( InTheGame )" around your rendercode for the game. For example around smgr->drawAll();. If that variable is not set the scene will now no longer be rendered.

In larger games this can get complexer, but the basic principle will stay the same.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Blynx
Posts: 16
Joined: Sat Apr 12, 2008 8:41 am

Post by Blynx »

Thanks.
radiant
Posts: 112
Joined: Fri Feb 22, 2008 8:04 pm
Location: Mexico

Post by radiant »

Hi, some time ago i had a problem with this, since it was only a test program i didnt gave i tmuch tough.... but it would be good to ask now that somebody else asked something related....

i was displaying a mesh... pretty much any mesh... and putting some gui on the screen... the problem was that while using a FPS camera if i had gui being rendered(gui_env->drawall();) even if there was nothing on screen... all hidden... i couldnot use movement arrows..... just mouse ot move the camera... and ... mouse events afect whats goin on in the scene whyle manipulating gui... even if u re not rendering the scene....

Is there a way to solve this problem??
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

radiant - not without seeing the corresponding sources.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

you were probably returning true in your onEvent function of your event receiver when you shouldn't have been, if you post the event receiver code we can probably spot the problem.
Image Image Image
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I had a similar problem when I switched from menu to the fps camera...
mouse movement (look around) worked, but the keys didn't !!! :shock:
after switching back to the menu I saw all my key strokes logged in an editbox I had placed in the menu !!!
So I also had to set the gui focus to another object when activating the camera... ;)

a gui element holds the focus even if it's invisible !!!
maybe a bug !?!?! :shock:

maybe you have a gui element in your menu that has the focus and handles the key strokes !?!?!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Post Reply