OpenGL Menu engine?

Member
Posts: 277
Joined: 2004.10
Post: #1
Does anybody know about a good main menu engine?
I'm not talking drop down menu's like at the top of the screen. I'm talking about the main menu of a game. You know "Play", "Instructions", "Help", "Quit" etc. etc.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #2
DIY (do it yourself) it's really not that hard..

Or wait until Leopard is released and use CoreAnimation

"When you dream, there are no rules..."
Quote this message in a reply
Member
Posts: 277
Joined: 2004.10
Post: #3
I'd be better off using some form of Basic like TNTBasic if I wanted to do it myself.

I was just seeing if there were any idev users who had used a good menu engine and would share their information.

*edit*
I work on multiple OS's, so I stay completely cross-platform.

Global warming is caused by hobos and mooses
Quote this message in a reply
Moderator
Posts: 373
Joined: 2006.08
Post: #4
yes, this is a relatively easy problem to solve, although I must say that it took me awhile to figure it out Smile
What I ended up doing was texture mapping a rectangle with the words that I needed like 'Start game', etc, and using the picking functions from OpenGl to detect is the user had clicked on the texture-mapped rectangle.
-wyrmmage

Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Quote this message in a reply
Member
Posts: 45
Joined: 2006.11
Post: #5
Actually it's even easier to just setup an orthographic projection matrix and map your mouse coordinates to this projection. You can even setup the projection to use pixels for gl coordinates.

Code:
gluOrtho2D(0, width, 0, height);

Then, just setup your menus as textured quads or whatever you like, and you can detect menu clicks simply by checking if the mouse coordinates are inside the menu region coordinates, something like:

Code:
if(mousex > menu_item[i].left && mousex < menu_item[i].right &&
   mousey > menu_item[i].bottom && mousey < menu_item[i].top)
{
  // menu item i was clicked
}

If you want something fancy, do something like:

Code:
double scaleAmt = 10.0 * sin(current_time());
glScalef(scaleAmt, scaleAmt, 1.0);
// draw menu item which is currently "moused over"

To get that wavy effect when you mouse over a menu item. As an alternative, you can just scale it by a constant amount when you mouse over the menu item, or maybe just have a different mouse over texture, or a combination of these ideas.

Other easy things people have done is add a small particle emitter at the mouse position (pixie dust for a wand pointer, etc..) or have a character point to or look at the menu you mouse over (or just look at the pointer).

Most of these tricks are pretty straightforward and relatively easy to implement and aren't too intrusive (except maybe the wobbly mouseovers). Hope this gives you ideas!

PS: if I might ask, what type of main menu did you envision? What kind of game is it? What is the theme? Players love it when you create a main menu that fits the game in a unique way. It is, after all, the first or second thing the player will see so it should draw them in.

JeroMiya
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL and menu bar on OS X A_SN_ 9 9,637 Feb 7, 2012 11:51 AM
Last Post: trailmix
  Can't get menu bars to work. XSTNX 0 2,394 Jun 26, 2009 09:08 AM
Last Post: XSTNX
  GLUT apple menu close application Rasterman 31 15,483 Aug 15, 2007 04:48 PM
Last Post: AnotherJake
  Remove the File Menu from app guvidu 2 3,436 Mar 23, 2007 12:43 PM
Last Post: PowerMacX
  Enabling the "quit" menu function in an SDL program ferum 2 4,192 Sep 10, 2006 02:35 PM
Last Post: PowerMacX