How to map the key board without using windows.h

Hi Folks,
I am trying to map the key board (arrow and + - keys) for my application developed in OGL.
I want to do it without using “windows.h”
Please suggest me, how I should go about it…
Thanks,

Amol

Hi !

I am not sure what you want to do, if you want to be “platform independent”, then you are already possibly using GLUT/SDL or some other library and thoose have builtin platform independent keyboard management, if you don’t have this and you are making a Win32 application, then you already have to include windows.h to get anything done so why not use it ?

Or am I missing something here ?

Mikael

Hi Mikael,
thanks for replying…

Actually I an very new in OGL field…
I developed an application using GLUi, which is having functions for zoom in/out and pan.
I can use this with the help of mouse. But I want to control the same by using arrow keys and + - keys…
now can u guide me which function may solve my purpose ??
thanks once again

Amol

Originally posted by mikael_aronsson:
[b]Hi !

I am not sure what you want to do, if you want to be “platform independent”, then you are already possibly using GLUT/SDL or some other library and thoose have builtin platform independent keyboard management, if you don’t have this and you are making a Win32 application, then you already have to include windows.h to get anything done so why not use it ?

Or am I missing something here ?

Mikael[/b]

Hi !

I have never used GLUI, but if I remeber correct it is based on GLUT and in that can you should be able to use the keyboard callback function to snatch the keyboard keys, check the manual for GLUT for more info on the subject.

Mikael

You can use: glutSpecialFunc(Special_keys);

example usage:

void Special_keys(unsigned char key, int x, int y)
{
switch (key) {
case GLUT_KEY_DOWN:
paddle_state = 2;
paddle_direction = 1;
break;
case GLUT_KEY_UP:
paddle_state = 2;
paddle_direction = -1;
break;
case GLUT_KEY_RIGHT:
paddle_state = 2;
paddle_direction = -1;
break;
case GLUT_KEY_LEFT:
paddle_state = 2;
paddle_direction = -1;
break;
default:
break;
}

}

Originally posted by Amol Joshi:
[b]
Hi Mikael,
thanks for replying…

Actually I an very new in OGL field…
I developed an application using GLUi, which is having functions for zoom in/out and pan.
I can use this with the help of mouse. But I want to control the same by using arrow keys and + - keys…
now can u guide me which function may solve my purpose ??
thanks once again

Amol

[/b]