Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I was wondering how one would go about duplicating the same sprite in SFML, instead of having to create new sprites every time I would want have another sprite of the same image. Just some basic thought process or pseudo-code is what I'm looking for.

Thanks.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Well,

The whole idea of SFML sprites is to share a heavyweight object (texture) between all lightweight(sprite) that requires it. That is already the arguably best way.

Of course, there is one alternative, you can reuse the same sprite by just sharing it across your entities, and each one sets a new tranform before re-rendering the sprite. Im not even sure if that is anyway better than the first method, but seems to be what you want.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.