Jump to content
  • Advertisement
Sign in to follow this  
Pheaj

Sprites and Surfaces in SdlDotNet

This topic is 4622 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

Now I was just here at work thinking about something. I was wondering if you create 10 surfaces from a smallish image, then create say 400 sprites from that image does each sprite contain the image or do the sprite just point to the image the surface contains? If they just pointed then I could use the collision dectection supplied with sdldotnet and not have to do any checking myself. Thanks Drew

Share this post


Link to post
Share on other sites
Advertisement
If you have 400 sprites all using the same surface, you wouldn't have any troubles using the collision detection. The surface is just a way of displaying it while the collision detection deals with the location of the sprite.

This brings up passing reference types vs passing value types in C#. In SDL.NET, since surfaces are classes (you instantiate them), you are dealing with passing objects by reference. This means that 400 sprites can reference the same surface and use it to display on the screen at 400 different positions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!