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

Author Topic: setPosition to negative value  (Read 2630 times)

0 Members and 1 Guest are viewing this topic.

zoran404

  • Newbie
  • *
  • Posts: 41
    • View Profile
setPosition to negative value
« on: March 19, 2013, 02:54:47 pm »
I have a circleshape and I set it's position like this
curView.setTextureRect(IntRect(cursorX - cursorV, cursorY - cursorV, cursorV*2, cursorV*2));
cursorV is the the radius of curView

But if cursorX - cursorV or cursorY - cursorV results in negative then the circle dosen't display at all. (so I had to limit the result to zero)
How do I go around that?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: setPosition to negative value
« Reply #1 on: March 19, 2013, 04:00:57 pm »
And what did you expect to see, when using an area which is outside the source texture?
Laurent Gomila - SFML developer

zoran404

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: setPosition to negative value
« Reply #2 on: March 19, 2013, 05:11:44 pm »
(forgot to mention) This is how I set the position of the circle.
curView.setPosition(cursorX-cursorV, cursorY-cursorV);

So, if I make my texture curcorV larger to the top and left and add +curcorV to all my texture related calculations, but keep the above writen position setting will it then display the circle correctly?

zoran404

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: setPosition to negative value
« Reply #3 on: March 19, 2013, 05:23:26 pm »
Just tested that. And apperently position can't be negative either.

So how do you do that?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: setPosition to negative value
« Reply #4 on: March 19, 2013, 06:02:20 pm »
How do you do what? Please explain what you're trying to do, it's not clear at all.
Laurent Gomila - SFML developer

zoran404

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: setPosition to negative value
« Reply #5 on: March 19, 2013, 07:47:26 pm »
Nwm. I just discowered setOrigin...
« Last Edit: March 19, 2013, 08:02:56 pm by zoran404 »