Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
Graphics
»
How can I check if a Sprite has a texture loaded or not?
Print
Pages: [
1
]
Author
Topic: How can I check if a Sprite has a texture loaded or not? (Read 2468 times)
0 Members and 1 Guest are viewing this topic.
Chiggy_Playz
Newbie
Posts: 15
How can I check if a Sprite has a texture loaded or not?
«
on:
April 18, 2019, 08:23:06 pm »
I want to apply an if condition that if sprite does not have texture, then run.
Logged
FRex
Hero Member
Posts: 1848
Back to C++ gamedev with SFML in May 2023
Re: How can I check if a Sprite has a texture loaded or not?
«
Reply #1 on:
April 18, 2019, 09:11:59 pm »
Sprite has a get texture that returns a pointer which can be NULL if it was never set.
https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1Sprite.php#a1a76155146c8ff37c4eb5a306b4e9ebe
Logged
Back to C++ gamedev with SFML in May 2023
eXpl0it3r
SFML Team
Hero Member
Posts: 11030
Re: How can I check if a Sprite has a texture loaded or not?
«
Reply #2 on:
April 19, 2019, 09:37:12 am »
A sprite always has a texture. That the texture has been loaded should be guaranteed by your application flow and can be checked when loadFromFile is called.
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
»
How can I check if a Sprite has a texture loaded or not?
anything