Creating a Menu

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
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Creating a Menu

Post by only1skingle »

Hey
Hopefully someone can help me.

I'm trying to create a menu screen for my prototype game (just recently started using Irrlicht!)

All im after is a screen that has a background image, and two boxes placed in the centre, one above the other.

One box saying 'Start' and the second 'Exit'

then if exit was selected have it close the whole game program down (drop())
or if start selected (for now) just go into another screen with an exit box that would then close the game program down.

Does anyone have any code that would help me, or a link to a tutorial?

Thanks to anyone that can help

only1skingle
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Take a look at the Tutorial #5 "User Interface"
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Post by only1skingle »

cheers, will have a butchers now :)
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Post by only1skingle »

right, ive had a look at the tutorial. and the boxes and selecting them is there.

But how would i then close:

a) close the program entirelty from a button selection?

and

b) how would i open another screen? theres a new window in the tutorial, so would i do the same but make the window the screen size i desire? and get the program to close the 1st??

thanks again
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Give your dialogs one gui-element as parent (can be a window, but can also be a large statictext which is invisible). Then you can call setVisible for that parent element to show/hide a complete dialog.

And to close your application your application can add any bool value in your main-loop to quit. For example the usual main-loop in examples looks like this:

Code: Select all

while(device->run())
But you can also write:

Code: Select all

bool quitThisApp = false;
while(device->run() && !quitThisApp)
Then you just have to set "quitThisApp" to true and the main-loop while end.
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
only1skingle
Posts: 25
Joined: Mon Sep 27, 2010 6:51 pm
Location: United Kingdom

Post by only1skingle »

Thankyou very much!

I really appreciate the reply ^_^
Post Reply