Archived

This topic is now archived and is closed to further replies.

asaari

VK_Huh?

Recommended Posts

asaari    122
Ok, I know this is going to sound like a very stupid question from a very stupid person... Im currently in the process of writing a 3D engine in OpenGL, and ive been using windows message,/VK_LEFT, VK_UP, etc. for movement just until I get the basic graphics engine in place, anyhow I decided to start using WASD, insted, so I switched the couple lines of code, and I get a compile time error saying VK_W, etc., is an undeclared identifier! Am I missing something? =(

Share this post


Link to post
Share on other sites
freshya    122
For standard keys, use the standard characer

''W''
''A''
''S''
''D''

The problem arises when you want to use things like tilde (~), cos there ain''t a VK for it! I''ll give you a hint though, it''s (numerical value) 192 on my keyboard... not sure about anyone else''s =)

Share this post


Link to post
Share on other sites
WarMage    122
Exactly right, you can''t pass messages with VK_? constants because they don''t exist for normal keystrokes. This obviously becomes a REAL CHORE when trying to write internationalized code. If I had to, I would probably write or acquire a lib for Unicode 3.0, and use these as my key constants...

---------
-WarMage
...wheeeeeee! I have to pee now.

Share this post


Link to post
Share on other sites
Mike    141
you could just use the WM_CHAR message and compate the WPARAM to the character (i.e. wParam == 'a').

Or you could use the hexidecimal values and define your own VK_ constants as follows:

VK_W = 0x57h
VK_A = 0x41h
VK_S = 0x53h
VK_D = 0x44h

As the one guy said earlier, the hex values corrispond to the letter's ascii value. in the WM_KEYDOWN message wParam == 'W' will work.

Edited by - mike on August 1, 2001 1:51:14 PM

Share this post


Link to post
Share on other sites