SFML community forums

Help => Graphics => Topic started by: Makuto on April 11, 2013, 02:53:48 pm

Title: Origin after sub rect
Post by: Makuto on April 11, 2013, 02:53:48 pm
If you sub-rect a sprite, is the origin relative to the image without the sub rect or just the sub rect image? (both 1.6 and 2.0)

EDIT: I tested on 2.0 and it is relative to the sub rect (thank heavens), what about 1.6?
Title: Re: Origin after sub rect
Post by: eXpl0it3r on April 11, 2013, 03:18:35 pm
Sorry I've no idea what you're talking about... :-\

A subrect on a texture has an absolute position on the image.
The sprites origin doesn't have anything to do with what you do, with the subrect, it just knows that it has to put the image you want to draw (x,y) much away from where you set the position of the sprite.

Also why are you interested in knowing what SFML 1.6 does, if you're already using SFML 2?
Title: Re: Origin after sub rect
Post by: Laurent on April 11, 2013, 03:22:04 pm
Of course it is relative to the sub-rect. The origin is relative to the local definition of the sprite, which knows nothing about what's outside the sub-rect. It's the same in SFML 1.6.
Title: Re: Origin after sub rect
Post by: FRex on April 11, 2013, 03:24:59 pm
Quote
Sorry I've no idea what you're talking about... :-\
Example:
Origin of 32x32 sprite relative to image and set to 32,32 with texture rect set to 32,32 64,64 will make sprite rotate around it's left corner. Relative to sprite(as it is) will make it rotate around it's lower right corner. Do you get it now?

P.S. I was going to answer but Laurent ninja'd me.. ;)
Title: Re: Origin after sub rect
Post by: Makuto on April 12, 2013, 01:08:15 am
Also why are you interested in knowing what SFML 1.6 does, if you're already using SFML 2?

SFML 1.6 is easier (for me) when I port to other platforms (like Windows). It also shows where my library has holes in abstracting the graphic/audio/input systems. I'm really liking SFML 2.0, so when it is released I'll probably slowly abandon 1.6

Thanks for the fast answers.


Title: Re: Origin after sub rect
Post by: OniLinkPlus on April 12, 2013, 01:51:02 am
Also why are you interested in knowing what SFML 1.6 does, if you're already using SFML 2?

SFML 1.6 is easier (for me) when I port to other platforms (like Windows). It also shows where my library has holes in abstracting the graphic/audio/input systems. I'm really liking SFML 2.0, so when it is released I'll probably slowly abandon 1.6

Thanks for the fast answers.
SFML2 is technically done. All that remains is for Laurent to finish updating the website. I highly recommend switching to SFML2 now, as SFML 1.6 and prior have some severe and fatal bugs (e.g. the ATi bug) that have been resolved in SFML2.
Title: Re: Origin after sub rect
Post by: Makuto on April 12, 2013, 02:39:45 am
Also why are you interested in knowing what SFML 1.6 does, if you're already using SFML 2?

SFML 1.6 is easier (for me) when I port to other platforms (like Windows). It also shows where my library has holes in abstracting the graphic/audio/input systems. I'm really liking SFML 2.0, so when it is released I'll probably slowly abandon 1.6

Thanks for the fast answers.
SFML2 is technically done. All that remains is for Laurent to finish updating the website. I highly recommend switching to SFML2 now, as SFML 1.6 and prior have some severe and fatal bugs (e.g. the ATi bug) that have been resolved in SFML2.
I use SFML 2.0 completely on my development machine, but I always release for Windows and Linux 32 bit using 1.6. The work to get 2.0 compiling for those platforms hasn't been too high on my massive list.