Windows Menu or Own

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Windows Menu or Own

Post by cameron » July 7th, 2013, 7:42 pm

I was wondering if most games used windows api menus or if they made their own system?
Computer too slow? Consider running a VM on your toaster.

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: Windows Menu or Own

Post by LuisR14 » July 7th, 2013, 8:04 pm

i would say that most games use their own system, but you can use whichever method you prefer :P (and well using chili framework, windows api method wouldn't be easy to connect with it)
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Windows Menu or Own

Post by cameron » July 7th, 2013, 8:21 pm

Ok, I am working on my own system right now, I was just making sure it wasnt pointless.
Computer too slow? Consider running a VM on your toaster.

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Windows Menu or Own

Post by Asimov » July 10th, 2013, 6:01 pm

Hi cameron,

I got a windows menu working in my missile command, but then decided it is pointless having two menus and removed the windows menu.

Basically all you have to do is to set it up in winmain, and just pass the result to the game

I had my gamestates setup in game.h

Code: Select all

	enum GameState
{
	Menu,
	Level,
	Running,
	MenuPause,
	RunGame
};
Then I set up my menu

Code: Select all

LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    switch( msg )
    {
		case WM_CREATE:
			{
			    HMENU hMenubar = CreateMenu();
				HMENU hfile= CreateMenu();
				HMENU hOptions=CreateMenu();

				AppendMenu (hMenubar,MF_POPUP,(UINT_PTR)hfile,L"File");
				AppendMenu (hMenubar,MF_POPUP,ID_ABOUT,L"About");

				AppendMenu (hfile, MF_STRING, ID_START,L"Start");
				AppendMenu (hfile, MF_STRING, ID_FILE_EXIT,L"Exit");

				SetMenu(hWnd, hMenubar);
				break;
			}


And finally pass my menu to the game

Code: Select all

  while( msg.message != WM_QUIT )
    {
        if( PeekMessage( &msg,NULL,0,0,PM_REMOVE ) )
        {
            TranslateMessage( &msg );
            DispatchMessage( &msg );
        }
        else
		{
		//ShowCursor(false);

			if (start){theGame.Gamestate=RunGame;}	
			start=false;
			theGame.Go();
			
			
		}
    }
It worked, but then I thought it was a waste of time having two menus, and took it out LOL.
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Windows Menu or Own

Post by cameron » July 10th, 2013, 6:54 pm

I got my menu system working basically, I have a few different menu types: menu, menu link, menu back,and menu dropdown. Each of these links to a menuwindow class( it is not an actual window just a thing that holds all the menu classes for that time I guess you could say ). And each menu link and menu back links to a menuwindow. It works but I don't know if this is an efficient way of doing it.
Computer too slow? Consider running a VM on your toaster.

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Windows Menu or Own

Post by cameron » July 10th, 2013, 6:57 pm

All I really have to do is link a bunch of menus to windows in game.cpp and call do(); on the first menu link. BTW it uses vectors so I don't know if that will be a slowdown problem.
Computer too slow? Consider running a VM on your toaster.

Post Reply