stupid question
What is the ascii code for the 4 keys:
-UP
-DOWN
-LEFT
-RIGHT
to move in the 3d world
tanks
dominique
ASCII codes are for char''s. you can define up, down, etc. like this:
#define key_up 0x26
#define key_down 0x28
#define key_right 0x27
#define key_left 0x25
#define ignite_software 1
#define key_up 0x26
#define key_down 0x28
#define key_right 0x27
#define key_left 0x25
#define ignite_software 1
[source]#define ignite_software 1[/source]
There are no ASCII values for those keys per se.
If using windows the virtual key codes are
VK_LEFT 25h
VK_UP 26h
VK_RIGHT 27h
VK_DOWN 28h
If using GLUT handlers the key codes are
GLUT_KEY_LEFT 100
GLUT_KEY_UP 101
GLUT_KEY_RIGHT 102
GLUT_KEY_DOWN 103
During in console I/O mode pressing the up arrow will place a 0 and a 72 in the key buffer. Down will leave 0 and 80, left 0 and 75 and right 0 and 77.
If using windows the virtual key codes are
VK_LEFT 25h
VK_UP 26h
VK_RIGHT 27h
VK_DOWN 28h
If using GLUT handlers the key codes are
GLUT_KEY_LEFT 100
GLUT_KEY_UP 101
GLUT_KEY_RIGHT 102
GLUT_KEY_DOWN 103
During in console I/O mode pressing the up arrow will place a 0 and a 72 in the key buffer. Down will leave 0 and 80, left 0 and 75 and right 0 and 77.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement