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

Author Topic: Copying sf::Sprite(s) -> sf::Image  (Read 1261 times)

0 Members and 1 Guest are viewing this topic.

Kaphonaits

  • Newbie
  • *
  • Posts: 21
    • View Profile
Copying sf::Sprite(s) -> sf::Image
« on: July 23, 2013, 12:06:34 am »
I have a 2d array of sf::Sprites.  Is there a way for me to copy all of them to one sf::Image / similar type and then draw the single image/type they were copied to?

Thanks a bunch.
The keyboard is mightier than the sword.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Copying sf::Sprite(s) -> sf::Image
« Reply #1 on: July 23, 2013, 02:36:38 am »
I hope you're using SFML 2, otherwise you should switch asap! ;)

With SFML 2, you can draw your sprites onto a sf::RenderTexture and then use that texture to draw. Keep in mind though, that it's no problem for your GPU to draw a few sprites and if you draw the sprites to the render texture every game loop iteration, then you're wasting quite a bit of processing time, since you could've drawn them directly to the screen. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything