Front-end menu
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.
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.
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.
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.
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.
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.
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.
With regard to not being a Win32 app, just substitute the appropriate equivalent of OnMouseButtonDown() or MouseUp() for the windows' messages.
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?
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.
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
Popular Topics
Advertisement