PDA

View Full Version : How to map the key board without using windows.h



Amol Joshi
11-06-2002, 07:46 PM
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

mikael_aronsson
11-06-2002, 11:50 PM
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

Amol Joshi
11-07-2002, 01:22 AM
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:
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

mikael_aronsson
11-07-2002, 02:57 AM
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

nexusone
11-07-2002, 05:00 AM
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:

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