Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
View colissions
Print
Pages: [
1
]
Author
Topic: View colissions (Read 1307 times)
0 Members and 1 Guest are viewing this topic.
catalinnic
Newbie
Posts: 19
View colissions
«
on:
August 11, 2019, 12:28:20 pm »
I want to reduce the number of draw calls by verifying if the view is colliding with "Some object" sprite. Eg. I have 50 enemies and i want to draw only who are colliding with the camera.and I don't know how.
Logged
G.
Hero Member
Posts: 1593
Re: View colissions
«
Reply #1 on:
August 11, 2019, 04:18:41 pm »
Using sf::view getCenter and getSize, and if the view doesn't rotate, it's easy to compute an sf::FloatRect representing the view. (center ± size / 2, ...)
Then you can use
intersects
with the globalBounds of your sprites to check if they are colliding with the camera or not.
Logged
catalinnic
Newbie
Posts: 19
Re: View colissions
«
Reply #2 on:
August 11, 2019, 05:44:55 pm »
Thanks, a lot
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
View colissions