Sign in to follow this  

Sprites and Surfaces in SdlDotNet

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

This topic is 4340 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this