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

Author Topic: Origin after sub rect  (Read 3128 times)

0 Members and 1 Guest are viewing this topic.

Makuto

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Au 79 Games
    • Email
Origin after sub rect
« 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?
« Last Edit: April 11, 2013, 03:10:03 pm by makuto »
Macoy Madson-Au 79 Games
Check out my work at http://augames.f11.us/
Most of my SFML-related code is here: https://github.com/makuto/personal/tree/master/gameDev/resources/base2.0
I try to KIS(S), do you?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Origin after sub rect
« Reply #1 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Origin after sub rect
« Reply #2 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.
Laurent Gomila - SFML developer

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Origin after sub rect
« Reply #3 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.. ;)
Back to C++ gamedev with SFML in May 2023

Makuto

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Au 79 Games
    • Email
Re: Origin after sub rect
« Reply #4 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.


Macoy Madson-Au 79 Games
Check out my work at http://augames.f11.us/
Most of my SFML-related code is here: https://github.com/makuto/personal/tree/master/gameDev/resources/base2.0
I try to KIS(S), do you?

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Re: Origin after sub rect
« Reply #5 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.
I use the latest build of SFML2

Makuto

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Au 79 Games
    • Email
Re: Origin after sub rect
« Reply #6 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.
Macoy Madson-Au 79 Games
Check out my work at http://augames.f11.us/
Most of my SFML-related code is here: https://github.com/makuto/personal/tree/master/gameDev/resources/base2.0
I try to KIS(S), do you?

 

anything