Menu Switch Problem

This is a discussion on Menu Switch Problem within the Game Programming forums, part of the General Programming Boards category; Sorry but I have a last problem with skeet shoot. Can someone tell me how set a win32 switch case ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Location
    Slovakia
    Posts
    21

    Menu Switch Problem

    Sorry but I have a last problem with skeet shoot.

    Can someone tell me how set a win32 switch case for an on screen menu?

    I'm on test 21 out of 24.

    I have got as far as

    Code:
    void Endgame(){
    TCHAR buff[10];
    RECT rc;
         rc.left=x;
         rc.top=y;
         rc.right=a;
         rc.bottom=b+2;
         FillRect(hdc, &rc, (HBRUSH) BrushBlue);
         rc.left=h;
         rc.top=j;
         rc.right=k;
         rc.bottom=l+2;
         FillRect(hdc, &rc, (HBRUSH) BrushBlue);
    
    
        SelectObject(hdc, BrushGreen);
               Rectangle(hdc,0,200,575,475);
               TextOut(hdc, 350,0,TEXT("score="),6);
    TextOutA(hdc, 410,0,buff,wsprintf(buff,TEXT("%d"), score));
    TextOut(hdc, 350,20,TEXT("skeets="),6);
    TextOutA(hdc, 410,20,buff,wsprintf(buff,TEXT("%d"), skeet));
    TextOut(hdc, 150,160, TEXT(" Press 1 to play again"), 22);
    TextOut(hdc, 150,180, TEXT("Press 2 to quit"), 15);
    
    switch(reset){
    case 1:
    skeet = 0;
    score = 0;
    break;
    case 2:
    PostQuitMessage(0);
    break;
    }
    but I can't get the switch code to work. So that option 1 will restart a new game and option 2 will close the window.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    How do you get any user input into "reset"?

  3. #3
    Registered User
    Join Date
    Jan 2011
    Location
    Slovakia
    Posts
    21
    I got it sorted by adding a couple of extra cases to WM_KEYDOWN so that when the user presses 'Y' it sets score = 0; and skeet = 0; then redraws the background.

    Although I can't get a start menu on opening using WM_CREATE working yet (Test 23) but I might not use it as it is a cosmetic feature.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. switch problem
    By joshhud in forum C Programming
    Replies: 1
    Last Post: 11-08-2008, 11:35 AM
  2. Problem with Mouse Over Menu!!! HELP!!!
    By SweeLeen in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2006, 01:10 AM
  3. pop up menu problem
    By bigtamscot in forum Windows Programming
    Replies: 5
    Last Post: 06-10-2003, 01:46 AM
  4. yeah alil help for my switch problem
    By datainjector in forum C Programming
    Replies: 7
    Last Post: 07-23-2002, 07:20 PM
  5. Uh-oh! I am having a major switch problem!
    By goodn in forum C Programming
    Replies: 4
    Last Post: 11-01-2001, 03:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21