SFML community forums

Help => Window => Topic started by: pwnstar23 on January 11, 2013, 08:41:11 am

Title: How to get cordinate of top left pixel in client area of RenderWindow?
Post by: pwnstar23 on January 11, 2013, 08:41:11 am
I found that Mouse::getPosition() returns window space, you can subtract window.getPosition() but its off by the boarders of the window I think.  How to get this right?
Title: Re: How to get cordinate of top left pixel in client area of RenderWindow?
Post by: Laurent on January 11, 2013, 08:47:20 am
So you need Mouse::getPosition(window) (read the doc and tutorials please).
Title: Re: How to get cordinate of top left pixel in client area of RenderWindow?
Post by: pwnstar23 on January 11, 2013, 08:53:57 am
Yea thank you.  I was doing a search and found that.  Seems like it would be useful if you had a method on window class to get the client rect, for other programming problems. 
Title: Re: How to get cordinate of top left pixel in client area of RenderWindow?
Post by: Laurent on January 11, 2013, 09:09:16 am
Quote
for other programming problems
Such as...?

The client rect is useful only if you have desktop coordinates. The only function that returns desktop coordinates is Mouse::getPosition(), and it already has an overload to get client coordinates. So I don't think that such a function would be useful at all.