Front-end menu

Started by
9 comments, last by Madi 16 years ago
Hi I am trying to create a front-end game menu so the user can select to either start a new game, go back to the game or exit the game. But how is this done? I have a couple of examples (The Tower), but when trying to implement this to my own game, it doesn't seem to work. Any help, examples and/or source codes would be useful. I am using Visual Studio C++ 2005 and DirectX 9 (July 2005) SDK. Thanks in advance and happy Easter.
Advertisement
sorry, I meant the DirectX 9 SDK (July 2007) not 2005.

Thanks.
Quote:how is this done?


There's a lot wrapped up in that question.

Are you interested in the GUI interface, creating on-screen buttons, or the logic behind starting the game vs. returning to it?

Happy Easter to you, too.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

The logic is pretty much there, so I am currently on a games programming course at Uni, but I was actually thinking of the GUI and the creation of buttons, switching from state to state.

As said, I've got an idea of how this is to be implemented, but it seems like a headache to look through thousands of code, and you just know that this won't work with the version/style of code I've chosen for my game.

Thanks in advance.
A relatively simple method might be to create textures for the buttons in each state you want to display - up, down, disabled. Position and display the textures using a sprite. You may want to create a ButtonSprite class to handle the graphics.

In your window procedure, process the WM_LBUTTONDOWN and WM_LBUTTONUP messages and set a flag.

On each frame update, if the button is down, check the mouse location against the rectangles of each button sprite. If you create a button class, you can add a method to the class such as bool IsClicked(int mousex, int mousey).

If the mouse click is over a button sprite, change the texture appropriately and take the appropriate menu action. Once again, an IsClicked method can make the texture change.

When the mouse button is up, reset the button texture. IsClicked could handle that also.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Thanks.

Is there somewhere an article/tutorial on how to create these?

I must notify that my game isn't a Win32 application. Don't know if this has anything to do with it.
I don't personally know of a particular tutorial or example of setting up sprites as buttons. Others here may.

With regard to not being a Win32 app, just substitute the appropriate equivalent of OnMouseButtonDown() or MouseUp() for the windows' messages.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Quote:Original post by Madi
Thanks.

I must notify that my game isn't a Win32 application. Don't know if this has anything to do with it.


But then how do u manage to use DX?
Are u using an emulator on mac/linux?
And Visual Studio 2005 for that matter?
"I'd rather know one thing, no matter how ordinary, than discourse endlessly on great issues." -- Galileo
I think I may have mistyped. What I meant was that the project was created in Visual Studio 2005 as an empty command prompt application, but it's still Win32.

So regarding my post stating that it isn't Win32 - it is actually quite wrong.

But back to the main question; isn't there anyone who knows where to get access to some kind of help or guidance towards solving this simplistic problem?

Any help would be much appreciated. Thanks.

This topic is closed to new replies.

Advertisement