redrawing a symbol on keypress.

This is a discussion on redrawing a symbol on keypress. within the Windows Programming forums, part of the Platform Specific Boards category; I've got a function here that manipulates some variables depending on what key is pressed: my problem is that this ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    19

    redrawing a symbol on keypress.

    I've got a function here that manipulates some variables depending on what key is pressed: my problem is that this is called from a loop and the loop continues to run with this method if the user enters a key or not. I need a method that pauses the execution of the program until the user hits a valid key.
    Code:
    void controlPlayer()
    {
    	if ( GetAsyncKeyState ( VK_UP ) & SHRT_MAX )
    		--coY;
    	else if ( GetAsyncKeyState ( VK_DOWN ) & SHRT_MAX )
    		++coY;
    	else if ( GetAsyncKeyState ( VK_LEFT ) & SHRT_MAX )
    		--coX;
    	else if ( GetAsyncKeyState ( VK_RIGHT ) & SHRT_MAX )
    		++coX;
    
    }
    Last edited by rickyoswaldiow; 10-20-2006 at 09:57 AM.

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    I think most of us know what those headers do, so the comments are not needed there
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    19
    quite

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    19
    Ah, how do I delete it?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  3. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM
  4. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 04:27 AM
  5. <list>
    By Unregistered in forum C++ Programming
    Replies: 9
    Last Post: 02-24-2002, 03:07 PM

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