Why cursor position calculated by center.

magistr

23-12-2007 20:15:10

I have interresting effect.
I am move mouse to left top of the screen and have mouse position equal 1/2 of width and height of cursor image.
After I am view QuickGUIMouseCursor source and find this:

Point MouseCursor::getPosition()
{
return Point(mPixelPosition.x + (mPixelSize.width/2.0),mPixelPosition.y + (mPixelSize.height/2.0));
}


Why this it is necessary? It creates the many inconvenience.

magistr

23-12-2007 20:20:41

I think this is created for correct restriction of the mouse position.

But mouse coordinates is incorrect :-(...

kungfoomasta

23-12-2007 22:13:38

That is the correct way to get the position. The *position* of the cursor is always at the center of the image defining the cursor. Can you elaborate on your inconvenience?

magistr

23-12-2007 22:16:27

Ohoho...
But in all applications cursor point in 0,0.
Center Point is not correct.

kungfoomasta

23-12-2007 22:37:29

Are you using Windows platform? While I am not certain, I think you are incorrect. If you see the cursor images, the center of all the cursors is the center of the image. So it only makes sense to have the center of the cursor used to determine the cursors position. Picture the *resize* or *hourglass* cursor icons. The position of the cursor is always the center of the image.

You're going to have to give some more details if you feel otherwise. :wink: