Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keys

Status
Not open for further replies.

csripriya1

Programmer
May 13, 2003
35
US
Hi all,
I have a question not directly related to C++. I am writing a code in openGL using GLUT library. When I use the keyboard function,glutKeyboardFunc(keyboard) Keys like righ,left,up and down arrow keys don't provide input to this function. This is the function I used for this key board function.

void keyboard(unsigned char c, int x, int y)
{
cout<<&quot;Keyborad int&quot;<< int(c)<<endl;
if((int)c == GLUT_KEY_RIGHT)
g_fHumanX += 4;
else if((int)c == GLUT_KEY_LEFT)
g_fHumanX -= 4;
if (c == 27)
exit(0);
}

When I use any toher keys in the key board, it gives the corresponding integer values.But it does not give the integer values for the arrow keys.
When I use these keys in other application like word, these keys behave normally. I am surprised. Can anyone help me.

Thanks for your time and help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top