Skip to main content
gamedev.net
🔒 Locked

Mouse Coordinates Off

Started by Antonym Apr 10, 2009 at 3:42 PM 3 replies 700+ views
Original Post
Antonym
Antonym
I render an object at (10,7.5) and then if I click the point where that object was rendered and check the mouse coordinates it tells me they are (10, 7.0) y is off by .5. Any reason why the mouse coordinates would be off? I use c++ and direct3d in case it's relevant.
Xsy
Xsy
Quote:
Original post by Antonym
I render an object at (10,7.5) and then if I click the point where that object was rendered and check the mouse coordinates it tells me they are (10, 7.0) y is off by .5. Any reason why the mouse coordinates would be off? I use c++ and direct3d in case it's relevant.


My first guess is that mouse coordinates work as Integer values , so your Y-value is rounded to an Integer.

Antonym
Antonym
Yeah I had thought of that too but this are converted coordinates from (640,480)(Sorry for forgetting to mention) even if it was off it would have been too little to be noticeable this on the other hand is a very noticeable offset.
Nairou
Nairou
Are you running in window mode or fullscreen? If its windowed mode, make sure your window is large enough to account for window borders, or scaling will occur and screen coordinates won't match. For example, if you're rendering to a 640x480 screen, and you create a 640x480 window, it won't be big enough as the window is measured from the outside and includes the window title and edges.
Antonym
Antonym
Oh that must be it though how can I change the window size without changing the render screen size? If I change the window size the render screen changes too.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.