Sign in to follow this  

Front-end menu

This topic is 3545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Apparently no one has the courtesy to point me to the correct direction - other than Buckeye..

Thanks anyways for your laziness, people.

Share this post


Link to post
Share on other sites

This topic is 3545 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this