Jump to content
  • Advertisement
Sign in to follow this  
kingpinzs

Help making a game menu.

This topic is 5042 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

How do I get started making a game menu. I have the Image I want to use. I am using directdraw for the gfx and using genaric windows input for the mouse. can some one list the things that are needed to get started? What I have came up with is. 1)load the image 2) find were the mouse pointer is at -> Not sure how to do this. 3) if you click or not. 4) check to see if you are in button area -> Not sure how to do this. 5) if mouse is in the button arrea then do something Let me know what else that needs to be done. I looked at the article about making a gui. But I am not using classes yet.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by kingpinzs
1)load the image

Yep. You'll want to do that [smile]
Quote:

2) find were the mouse pointer is at -> Not sure how to do this.

You need to handle the WM_MOUSEMOVE message in your windows message handler.
Quote:

3) if you click or not.

Again you will want to handle a windows message, e.g. WM_LBUTTONDOWN.
Quote:

4) check to see if you are in button area -> Not sure how to do this.

Have a RECT that holds the screen boundaries of your menu entries and use
PtInRect to query which entry the cursor is hovering.
Quote:

5) if mouse is in the button arrea then do something

Exactly. [smile]
Quote:

Let me know what else that needs to be done.

I looked at the article about making a gui. But I am not using classes yet.

Your list pretty much sums up everything you'll need to get a menu working. You cn add things like changing the image/text colour of hovered entries, but that's just eye candy (though pretty standard).

You also don't need to use classes at all.

Good luck!
Pat.

Share this post


Link to post
Share on other sites
My games typically have a single rendering function for the game.

However, when I add menus to a game, I put in what I call a "Screen" system.

Example:

RenderScreen()
{
if(!playing)
{ //draw menu stuff
}
else
{
//render game screen
}
}

No need for classes there. Instead of a "playing" variable, I use a global GAMESTATE variable (ex. pause = 15, playing = 10, initialization = 0, menu = 5, player dead = 99) and adapt my functions from there.

-Greven

-Greven

Share this post


Link to post
Share on other sites


int posX, posY

LRESULT CALLBACK winProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_MOUSEMOVE:

posX = LOWORD(lParam);
posY = HIWORD(lParam);

return 0;

case WM_DESTROY:
case WM_CLOSE:
case WM_QUIT:

PostQuitMessage(0);

return 0;
}

return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!