Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ssibal

Changing sprite color [SDL]

This topic is 5173 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible with SDL to have one sprite (for example a shirt) and be able to dynamically change its color, instead of having to have 5 separate sprites for 5 separate colored shirts?

Share this post


Link to post
Share on other sites
Advertisement
I think it is possible. Look in SDL docs for a function that retrieves a pixel from the screen, and a function that draws a pixel on the screen, then modify then to enable drawing on any surface.

But wouldn''t having different surfaces for different colors work faster?

Share this post


Link to post
Share on other sites
I believe I did this once by creating 8 bit surfaces, and allowing the user to modify the pallet (or say 5 values on the pallet that signified the colors they could change), then convert the 8bit graphic to the truecolor surface dynamicaly.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!