Archived

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

SubUrban

directinput - release mode

Recommended Posts

SubUrban    122
Hi! I compiled my game in release mode and noticed a problem. My arrow keys and num keys stoped working. If I put my code on A-Z everything works fine. Anyone knows what I should look for to solve this? thanks!

Share this post


Link to post
Share on other sites
John Reynolds    122
This is a problem which is appearing quite frequently on these pages. Basically, you will be storing the input data in a ''char'' datatype instead of an ''unsigned char''. This means the most significant bit is being interpreted as a sign-bit, giving you the wrong value (a negative value) when it is set.

So, changing the variable/array the data is written to into an unsigned char will fix it.

Cheers,
John

Share this post


Link to post
Share on other sites
SubUrban    122
thanks!
I noticed there where something wrong since I got a compile warning, but I just changed the char to int..does it matter? is char 32bit? (I may just have been miss informed but I thought I should always try to use 32bits datatypes for (maybe a very minor) increase in speed)

Share this post


Link to post
Share on other sites