wm mouse move inaccurate?

Im currently developing a per pixel level collision detection function for a 2D game engine. The function accepts a xy coords and tests it against the sprite texture to detect collisions. The function works fine as Ive tested it against hardcoded values.
When I passed coords from wm mouse move into my function, the mouse coords seem to be off by a small amount depending on how far my cursor is away from the client rect origin. Both axis suffer from this inprecision although the y axis seems to be more inaccurate. At the bottom right corner of my client area, my mouse coords only go up to 793*566 although the window was created at 800*600. The offset in mouse coords is causing my app to acess the texture out of bounds and crash. Is there any way to improve the the accuracy of the wm mouse move msg?
Last edited on
Any ideas? Would using wm input be better?
At the bottom right corner of my client area, my mouse coords only go up to 793*566 although the window was created at 800*600


If you create a window at 800x600, that means the entire window takes up 800x600. That includes the title bar, menu bar, status, border, and anything else belonging to the window.

The actual client area will always be smaller than the window size, unless the window has absolutely zero decoration.
closed account (DSvMDjzh)
I recently made a program using mouse move:
1
2
3
4
5
case WM_MOUSEMOVE:
		//Gets mouse coordinates
		xPos = GET_X_LPARAM(lParam); 
		yPos = GET_Y_LPARAM(lParam);	
		return 0;

That was what i used to get the coordinates... mine is pretty accurate. I was using openGL so I had to convert to their coordinate system and I noticed there that the cursor sometimes is off because the client area is smaller than the monitor as such I had to adjust but other than that it was pretty good.
Last edited on
Thanks for the advice. The client area was indeed smaller then i expected. The problem goes away if i run the program in fullscreen mode
Topic archived. No new replies allowed.