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

Author Topic: SetSubRect(sf::IntRect issue  (Read 1357 times)

0 Members and 2 Guests are viewing this topic.

God_Man

  • Newbie
  • *
  • Posts: 3
    • View Profile
SetSubRect(sf::IntRect issue
« on: May 04, 2012, 01:51:38 am »
Well let me say first,Hello

Great job with SFML I really like it.


My issue with SetSubRect is when I us my sprite sheet,and I set it for Blocks.SetSubRect(sf::IntRect(16,16,0,0));

The sprite sheet is 4 images left to right.With the code above is accurately shows just a portion of the image,but when I try to have it move to another porition of the image "moving right on the sprit sheet"
Blocks.SetSubRect(sf::IntRect(33,16,0,0));
It shows both the previous and new porition of the image.

What Im trying to do is have the square image animate,1,game tic,2,game tic,3,game tic,4,game tic.
so
1,2,3,4 loop 1,2,3,4.

Iv'e tried several methods but they usually give the issue above^^

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SetSubRect(sf::IntRect issue
« Reply #1 on: May 04, 2012, 07:59:20 am »
Why are left/top coordinates greater than right/bottom?

And the second rect is twice as large as the first one, so... the produced result is expected.
Laurent Gomila - SFML developer

God_Man

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: SetSubRect(sf::IntRect issue
« Reply #2 on: May 04, 2012, 10:33:46 am »
I might have misunderstod the code, so the first number is left,second top,third right and last bottom.

so how would I set mine to achieve the desired results?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SetSubRect(sf::IntRect issue
« Reply #3 on: May 04, 2012, 11:06:38 am »
Right coordinate is supposed to be greater than left... (same for top/bottom).
Laurent Gomila - SFML developer