Win32 API - Space Invader

This is a discussion on Win32 API - Space Invader within the Game Programming forums, part of the General Programming Boards category; How do you go about creating games using the Windows API? I have been wanting to create a Space Invader ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    Win32 API - Space Invader

    How do you go about creating games using the Windows API? I have been wanting to create a Space Invader clone, but I can't figure out how to have multiple options. See I have a Game menu that contain the options New Game, View Credits, View High Scores, Exit. I can get View High Score to show, but none of the other. For each option do I create a function that handles a WM_PAINT msg?

    Code:
    new_game(int msg)
    {
       switch(msg)
          case WM_PAINT:
          BeingPaint
          EndPaint
    }
    
    view_scores(int msg)
    {
       switch(msg)
          case WM_PAINT:
          BeingPaint
          EndPaint
    }
    
    view_credits(int msg)
    {
       switch(msg)
          case WM_PAINT:
          BeingPaint
          EndPaint
    }
    Attached Files Attached Files
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I found out that GetDC will help me out with problem. Now how do I prevent the content of my window from being erased?
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  3. #3
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    You want to look into GDI at MSDN. To keep it from being "erased" you're going to want to use a backbuffer. Look into BitBlt, HDCs, etc.

    I've got some old code from my first Win32 game (which was using GDI). I'll see if I can find it and upload it here for you.

  4. #4
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Here's a link to the thread where I included the source. It's been awhile so I don't remember how well commented (if at all) it is. If you have any specific questions about the source email or PM me.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    Is using a backbuffer the same as using double buffering?
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  6. #6
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Yes. You do all your drawing to the backbuffer then blit the contents of the backbuffer to the primary buffer. The primary buffer is what's blitted to the screen.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WIN32 API and Linux... *shudder
    By parad0x13 in forum C++ Programming
    Replies: 4
    Last Post: 07-24-2008, 08:27 PM
  2. WIN32 API Controls used with Resource
    By parad0x13 in forum C++ Programming
    Replies: 0
    Last Post: 07-19-2008, 03:05 PM
  3. Win32 API or Win32 SDK?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 07-20-2005, 04:26 PM
  4. Classes and Win32 API, and another Question
    By philvaira in forum Windows Programming
    Replies: 10
    Last Post: 04-10-2004, 08:21 PM
  5. progress bars with Win32 API
    By bennyandthejets in forum C++ Programming
    Replies: 15
    Last Post: 09-10-2002, 05:25 AM

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