Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: left and top of FloatRect, some explanation needed  (Read 4796 times)

0 Members and 2 Guests are viewing this topic.

Engineer

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
left and top of FloatRect, some explanation needed
« on: August 25, 2013, 09:59:40 pm »
Hello
I try to understand for ages what is the left and top coordinates of the floatrect, it is not explained very well in the API documentation what is it really.
If somebody could put the left and top coordinates of a rectangle it would help me (because I don't see on which corner the left coordinate is, is it on left high or left bottom? and what is EXACTLY top coordinate? Also if its a coordinate, can I access his X and Y components somehow? If yes, how ?)
Thanks a lot in advance. I'd like a picture. :)

Gobbles

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: left and top of FloatRect, some explanation needed
« Reply #1 on: August 25, 2013, 10:15:12 pm »
                            v -- this is the top
                             _______
this is the left ->     |            |
                            |            |
                            |            |
                            |_______|

The top is your Y coordinate, left is your x coordinate. Top and Left are used to signify the top left corner of the rectangle.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: left and top of FloatRect, some explanation needed
« Reply #2 on: August 25, 2013, 10:19:18 pm »
Here is another picture to help you out.  :)



Quote
Top and Left are used to signify the top left corner of the rectangle.

Not always true of you have a negative width or height  ;)
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Gobbles

  • Full Member
  • ***
  • Posts: 132
    • View Profile
    • Email
Re: left and top of FloatRect, some explanation needed
« Reply #3 on: August 25, 2013, 10:24:31 pm »
Well I was explaining it in the simplest of forms, no need to confuse him further if he doesn't know what the top and left are to begin with

Engineer

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: left and top of FloatRect, some explanation needed
« Reply #4 on: August 25, 2013, 10:28:31 pm »
Its ok I understood now. Thanks a lot. :)

Engineer

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: left and top of FloatRect, some explanation needed
« Reply #5 on: August 25, 2013, 11:26:33 pm »
By the way, the coordinate system point (0,0) is located at the LEFT TOP CORNER of the screen right ? if by example I try to set the position of a rectangle at (10,10) it will be 10 pixel lower in x and in y than the left top corner, right ?
And if I try to see if the rectangle has gone out of the screen, his coordinates will be NEGATIVE right ?
Thanks for your help.

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: left and top of FloatRect, some explanation needed
« Reply #6 on: August 25, 2013, 11:46:45 pm »
Yes, that sounds right to me.

(assuming you haven't changed the rectangle's origin)

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: left and top of FloatRect, some explanation needed
« Reply #7 on: August 26, 2013, 12:50:06 am »
By the way, the coordinate system point (0,0) is located at the LEFT TOP CORNER of the screen right ?

Yes, the top left corner or the screen and your window is 0x and 0y.

Quote
if by example I try to set the position of a rectangle at (10,10) it will be 10 pixel lower in x and in y than the left top corner, right ?

As long as you do not change the origin of the rectangle you are correct.

Quote
And if I try to see if the rectangle has gone out of the screen, his coordinates will be NEGATIVE right ?

Not necessarily, if you change the origin it could be different - but without changing the origin you can determine if the rectangle is out of the screen on the top/left if the top/left of the rectangle is < 0. For the bottom/right sides of the screen its the rectangle's top/left + the rectangle's height/width > the screen height/width.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor