Archived

This topic is now archived and is closed to further replies.

razvan

How do you make the game menu?

Recommended Posts

Hi everybody. I very new to directx(I started learning it 2 weeks ago) but not new to game programming and I have already begun my first game (tetris clone). The problem is that I don''t really know how to make the menu (well i can do it but I''m not sure that it''s the right way to do it). I know that there must be more than one way to do it so I thought I showld ask on this forum to see how other programmers do it.

Share this post


Link to post
Share on other sites
Hey,

The way I''m currently doing mine is simply doing a state check. I create a game state variable then I use constants to define what it is. Such as GS_MAINMENU, GS_MAINGAME...etc

Then you simply render and update the appropriate items depending on the current game state.

Heres a small example


  

Update()
{

switch(gamestate)
{

case GS_MAINMENU:


// check if any of the main menu

// buttons are clicked.

if(newGameButton.IsClicked())
{
gamestate = GS_LOADING; // or GS_MAINGAME

}

return 0;
break;

case GS_MAINGAME:

// update main game objects here


return 0;
break;

}

}

Render()
{

switch(gamestate)
{

case GS_MAINMENU:

// Render buttons and the main menu background


return 0;
break;

case GS_MAINGAME:

// Render game objects and gui


return 0;
break;

}

}




Anyways, thats how I go about it basically.

Hope that helped.




"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I''m reaching up and reaching out. I''m reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one''s been. We''ll ride the spiral to the end and may just go where no one''s been." - Maynard James Keenan
[TheBlackJester ]
[Wildfire Studios ]

Share this post


Link to post
Share on other sites
are there any premade objects that can be used as button? or do you must do it yourself?
IE: render pics of button at x y, if someone clicks in that area then do -> etc... ?

Share this post


Link to post
Share on other sites