Jump to content
  • Advertisement


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



This topic is 6227 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do you use this function?? aghh! the SDK with VC++ is awefull and doesn''t give any example code snippets on how to use this. Basically what im trying to do is detect if the user presses BOTH arow keys. whether its, LEFT_RIGHT, or DOWN_LEFT, etc..you get the point. I tried just to se, if using GetAsyncKeyState would work by using the following code: else if (KEYDOWN(VK_DOWN)&&KEYDOWN(VK_RIGHT)) { direction_y=1; direction_x=0; } where KEYDOWN is a macro I defined to make things easier for me. Of course it didn''t work, and the SDK is awefull as explaining what need to do, so I tried this... else if (KEYBOARD_DOWN(VK_UP)&&KEYBOARD_DOWN(VK_RIGHT)) { direction_x=1; direction_y=-1; } and get this compiler error: CANNOT CONVERT PARAMETER 1 FROM ''CONST INT'' TO ''UNSIGNED CHAR'' I guess besides asking for a example, I would ask what kind of paameter is this thing expecting?? All I know is that it''s a pointer of type PBYTE and that''s it... Any help would be much apreciated and would keep me from going bald (from pulling all my hair out)..thanks!

Share this post

Link to post
Share on other sites
Guest Anonymous Poster

Why not just this:


direction_y = 1;
else if (KEYDOWN(VK_UP))
direction_y = -1;
direction_y = 0;

direction_x = -1;
direction_x = 1;
direction_x = 0;

There really is no reason you have to check both keys simultaneously.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!