Thread: menu

  1. #1
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67

    Lightbulb menu

    how would i go about to make a menu that u could browse through, like the ones that iclude start, options, and quit.
    thnx

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    I recommend construction paper and crayons.

  3. #3
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67
    Quote Originally Posted by sean_mackrory
    I recommend construction paper and crayons.
    i can't afford those jackass

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Maybe sell some blood?

    edit: Actually on second thoughts, you might need a little tape too. And have a responsible adult supervise you when you're using the scissors.

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    288
    draw in 2d mode?

    http://www.andypike.com/tutorials/directx8/011.asp

    thats for 2d HUDS but im sure you can figure out how to handle mousedown/over/up commands and turn it into a button.

  6. #6

    Join Date
    May 2005
    Posts
    1,042
    EDIT: I sent sean a PM but he didn't respond in any manner. It's sad when the moderators of the only www.cprogramming.com cannot be mature and lead the forums by setting a good example.


    If you want to use Windows API but are having trouble knowing how to do it, you can accomplish this in various ways.

    EDIT: If you send a private message to Bubba on these forums he coded an entire editor using MFC...I'm sure he could give you his resources. MFC is a set of classes that encapsulates the Windows API.

    The first is to just use visual basic. I know this is probably game programming related, but in many games there are actually two separate programs: a setup program and the game itself. The setup program is run to establish the graphics, sound, controller settings, which writes the result to a file. then when the game is executed it reads in the data.

    Another way, if you still want windows api but in-game, but are having trouble actually learning how to do it, is to let visual C++ generate a simple win32 application for you. In visual C++ 6 go to new->projects tab->win32 application->"a typical hello world application"

    Then if you want to do something like just add a menu option, go to the resource editor, click on the place you want the menu option to show up, fill in its caption and ID...rebuild your project (it will reload your resource.h file which keeps track of the stuff you add), then go to your wndproc and add the functionality you want.

    For example, I added the code for ID_OK
    EDIT: All of this code, except for the case of ID_OK, was automatically generated by visual C++ 6


    Code:
    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	int wmId, wmEvent;
    	PAINTSTRUCT ps;
    	HDC hdc;
    	TCHAR szHello[MAX_LOADSTRING];
    	LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
    
    	switch (message) 
    	{
    		case WM_COMMAND:
    			wmId    = LOWORD(wParam); 
    			wmEvent = HIWORD(wParam); 
    			// Parse the menu selections:
    			switch (wmId)
    			{
    				case IDM_ABOUT:
    				   DialogBox(hInst, (LPCTSTR)IDD_ABOUTBOX, hWnd, (DLGPROC)About);
    				   break;
    				case	ID_OK:
    					MessageBox(NULL,"poop","ERROR",MB_OK|MB_ICONEXCLAMATION);
    					break;
    				case IDM_EXIT:
    				   DestroyWindow(hWnd);
    				   break;
    				default:
    				   return DefWindowProc(hWnd, message, wParam, lParam);
    			}
    			break;
    		case WM_PAINT:
    			hdc = BeginPaint(hWnd, &ps);
    			// TODO: Add any drawing code here...
    			RECT rt;
    			GetClientRect(hWnd, &rt);
    			DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
    			EndPaint(hWnd, &ps);
    			break;
    		case WM_DESTROY:
    			PostQuitMessage(0);
    			break;
    		default:
    			return DefWindowProc(hWnd, message, wParam, lParam);
       }
       return 0;
    }
    If you are using OpenGL, the GLUT library contains some basic function for creating basic windows EDIT: and menus. If you do not want to use GLUT w/ OpenGL you can look into OpenUI (Open User Interface I believe it is a menu API). Otherwise you can make your own home-grown method for making menus (keep track of where the mouse cursor is on the screen in screen coorinates, whether or not the mouse button is down and what button it is over at any point in time).
    Last edited by BobMcGee123; 11-26-2005 at 06:18 PM.
    I'm not immature, I'm refined in the opposite direction.

  7. #7
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67
    thnx.

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    EDIT: I sent sean a PM but he didn't respond in any manner. It's sad when the moderators of the only www.cprogramming.com cannot be mature and lead the forums by setting a good example.
    In defense of the mods here I totally understand why he posted it like that. Read the rules on how to write good questions and you will understand. We tire of these blanket questions as if we are the all knowing Wizard of Oz and can magically know how to do everything in programming w/o knowing any specifics.

    This question is like: How do I make an in-game menu in DirectX?
    The answer: Well there are a billion ways to do this. Do some research and try and actually write some code.

    Good questions result in good answers. Stupid questions yield stupid answers.

    First. No code shown.
    Second. No attempt shown.
    Third. No specific problem presented.
    Fourth. No platform, IDE, compiler, presented.
    Fifth. No research has been done by the OP.

    Code:
    If (First && Second && Third && Fourth && Fifth)
    {
      StupidQuestion();
      ReadBoardGuidelines();
    }
    To the OP: Google. You'll get a million hits, a million sites with source for this very thing, and at the very least a tutorial explaining how to do it.


    A good question would have been:


    Attached is my attempt at creating a menu. However it does not work as planned and I need assistance. The problem is this................................(snip)


    This would yield much better responses.

  9. #9
    lv.42 Berserker Drake's Avatar
    Join Date
    Jun 2005
    Posts
    67
    Quote Originally Posted by
    Good questions result in good answers. Stupid questions yield stupid answers.

    First. No code shown.
    Second. No attempt shown.
    Third. No specific problem presented.
    Fourth. No platform, IDE, compiler, presented.
    Fifth. No research has been done by the OP.

    [code
    If (First && Second && Third && Fourth && Fifth)
    {
    StupidQuestion();
    ReadBoardGuidelines();
    }
    [/code]



    Attached is my attempt at creating a menu. However it does not work as planned and I need assistance. The problem is this................................(snip)


    This would yield much better responses.

    actually, i was trying to make a menu. I was using switches, and it is not a stupid question because i got a good reply from someone that actually did help unlike your comment.

  10. #10

    Join Date
    May 2005
    Posts
    1,042
    In defense of the mods here I totally understand why he posted it like that....
    I agree with what you posted bubba.

    What I disagree with (and what prompted me to write my response to make up for the fact that our own moderator was being a dick):

    What sean said was uncalled for, he didn't even say 'read the rules as to why this is a bad question'...it was unproductive criticism that came across as blind anger/frustration. If you're going to whip out the sarcasm at least let them know why you are being sarcastic (in this case, for asking a ........ty question, which it fundamentally was), especially if you're a mod.
    I'm not immature, I'm refined in the opposite direction.

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Agreed and understood.

    actually, i was trying to make a menu. I was using switches, and it is not a stupid question because i got a good reply from someone that actually did help unlike your comment.
    My comment helped this thread as much as your question did. See my point?

  12. #12
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Asking a smart question in the future will help a lot. See signature.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  13. #13

    Join Date
    May 2005
    Posts
    1,042
    I'm not immature, I'm refined in the opposite direction.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM