Jump to content
  • Advertisement
Sign in to follow this  
dev578

problem with getcursorpos

This topic is 5081 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

I have a fullscreen directx application and am trying to get the coordinates of the cursor. POINT point; GetCursorPos(&point); does not work. I would prefer not to use directinput just to get mouse coordinates. Any idea why getcursorpos does not work? Any help is appreciated. -Dev578

Share this post


Link to post
Share on other sites
Advertisement
In what way does it not work? What value does GetCursorPos() return, and what is your POINT structure filled with?

Share this post


Link to post
Share on other sites
Trying to figure that out myself. point.x and point.y are not integers, I try to print it out to the screen:

sprintf(&String,"point.x: %i point.y: %i",point.x,point.y);
e_font->DrawTextA(NULL,&String,1,&font_rect,DT_LEFT|DT_NOCLIP,0xFFFFFFFF);

and nothing happens. It is definately something though, because after the call to getcursorpos:

if (point.x)

returns true, meaning it equals something. Any ideas?

-Dev578

Share this post


Link to post
Share on other sites
Use the debugger. Find out what's being put in the struct. And find out what SetCursorPos() is returning.

Share this post


Link to post
Share on other sites
Quote:
Original post by dev578
sprintf(&String,"point.x: %i point.y: %i",point.x,point.y);


You should use %d for integers and %ld for longs (POINT uses longs). So try:


char String[256];
sprintf(String,"point.x: %ld point.y: %ld",point.x,point.y);

and see if you get any better output.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!