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



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, 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