[gameprogrammer] Re: C++ and OpenGL

  • From: Dheeraj Patni <dheeraj.patni@xxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Tue, 16 Nov 2010 09:27:17 +0530

if u want to do it in windows...
here we go...

unsigned char keys[256];   //declaire a global variable
GetKeyboardState( keys );  //do it once at starting the game loop

and use like this in any function...
if( (keys[VK_UP] & 0x80 ) || (keys['W'] & 0x80 ) )
{
        //move forward
}


On Tue, Nov 16, 2010 at 4:21 AM, Azeem Zaheer <azeem_841@xxxxxxxxxxx> wrote:

>  Hi everybody,
>
> I am working on a small 2D game in openGL.
> i have been trying for a few hours now, but i
> am unable to figure out a way to input a keystroke.
>
> 1)I want to do it without using GLUT.
> 2)i do not want the screen to get stuck until
>    a user presses a key.i want it to keep drawing
>   and looking for a key stroke in every loop, but
>   not to wait for it.
>
> Thanks in advance
> Azeem Zaheer
>
>


-- 
-Dheeraj Patni
I AM RICH (from heart)

Other related posts: