#define DIK_1 0x02
#define DIK_2 0x03
.............
#define DIK_9 0x0A
#define DIK_0 0x0B
#define DIK_MINUS 0x0C
#define DIK_EQUALS 0x0D
#define DIK_BACK 0x0E
#define DIK_TAB 0x0F
#define DIK_Q 0x10
#define DIK_W 0x11
#define DIK_E 0x12
.............
#define DIK_O 0x18
#define DIK_P 0x19
How in the hell are you going to detect these keys?
With a big switch, which takes care of everyone!?
This is the must stupid-code, I have ever seen MS write!
This forced me to use the WM_CHAR message instead, and avoid DInput.
Is their an easier way to use DInput, or has MS just done it again???
GOOD_PROGRAMMING != MICROSOFT
Why is DInput so wierd?
I was making a highscore-box for my game, where the user should type in his/her name.
But I couldn´t use Direct-Input, because the keys are fucked up, here an example:
<<>> The Big ? <<>>
You could also use WM_CHAR or WM_KEYDOWN. You don''t really need high performance input when getting a high score name.
quote: Original post by Buster
You could also use WM_CHAR or WM_KEYDOWN. You don't really need high performance input when getting a high score name.
Well I know
But I´m using DInput in the game for mouse and keyboard input. And now I was using DInput, I wanted it to take care of the menu too.
But this got too complicated, because of MSs strange code, so I had to use the WM_CHAR message instead.
My code also got very ugly, because the WndProc-function (the main window) had to gain acces to my game-class.
I had to declare it as "friend".
Also to have two input systems in a game is bad, it is easier and cleaner with just one!
Edited by - The big Question? on 5/5/00 7:07:45 PM
<<>> The Big ? <<>>
Why not just build an array of the DirectInput codes and what character they represent, where the code itself is the index? Once you know a code is a printable character, just use that code as the index into the array to get the character.
aig
aig
aig
quote: Original post by An Irritable Gent
Why not just build an array of the DirectInput codes and what character they represent, where the code itself is the index? Once you know a code is a printable character, just use that code as the index into the array to get the character.
Thanks this was a good idea. Why didn´t I think of it?
But still it would have been much easier if MSs had written
the code so you could do something like this:
if ((key >= DIK_0) && (key <= DIK_Z)){ // Key is print-able. buf[NexChar] = ''0'' +(key -DIK_0); NextChar++;}
<<>> The Big ? <<>>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement