Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
What is sfml sprite default behavior with undefined texture rect
Print
Pages: [
1
]
Author
Topic: What is sfml sprite default behavior with undefined texture rect (Read 2949 times)
0 Members and 1 Guest are viewing this topic.
dogunbound
Newbie
Posts: 7
What is sfml sprite default behavior with undefined texture rect
«
on:
December 30, 2021, 05:51:04 am »
Here is the example code of what I am curious about:
sprite
=
sf
::
Sprite
(
*
assets
::
missingTexture
)
)
;
sprite.
getLocalBounds
(
)
;
sprite.getLocalBounds() should return a FloatRect with a width and height corresponding to the size of the missingTexture, correct?
Wiki doesn't explain something as specific as this, so I want some confirmation whether this is true or false.
Thank you.
Logged
eXpl0it3r
SFML Team
Hero Member
Posts: 11030
Re: What is sfml sprite default behavior with undefined texture rect
«
Reply #1 on:
December 30, 2021, 10:59:08 am »
As the sprite takes a texture by reference, the texture has to always exist.
If no texture rect is provided as constructor, the size of the texture is used. If the size is zero, the texture rect size will also be zero.
Logged
Official FAQ:
https://www.sfml-dev.org/faq.php
Official Discord Server:
https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog:
https://duerrenberger.dev/blog/
Print
Pages: [
1
]
SFML community forums
»
Help
»
Graphics
»
What is sfml sprite default behavior with undefined texture rect