Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 12 Jul 2012
Offline Last Active Jul 20 2012 08:33 PM

Topics I've Started

SDL.Net Questions

17 July 2012 - 06:28 PM

I have a couple noobish questions about SDL.Net. The first is this:

Every SDL or SdlDotNet tutorial I have seen has used a defined Surface as the main screen. For example
[source lang="csharp"]private static Surface videoscreen;videoscreen = SetVideoMode(800, 600, 16, false, false, false, true);videoscreen.Fill(Color.Black);videoscreen.Blit(sprite);videoscreen.Update();[/source]
However, while trying to build a game with SdlDotNet I noticed that I can simply use Video.Screen for any action I normally would have preformed on the Surface screen. For example:
[source lang="csharp"]Video.SetVideoMode(800, 600, 16, false, false, false, true);Video.Screen.Fill(Color.Black);Video.Screen.Blit(sprite);Video.Screen.Update();[/source]
Is there a reason why everyone still uses a defined Surface? I'm assuming there is some sort of performance or stability issue that I haven't encountered within the scope of my little game, but I would like to know in case I might run into trouble later on.

My next question is about freeing unused surfaces. I understand that it is good practice to free any surfaces that are no longer in use while the program is running to free up memory space, but is it necessary to free all surfaces when the program closes? Can Windows (or other OSs) tell that the program associated with that memory space is no longer running and allow other programs to use it? If the program using SDL crashes what happens with the allocated memory?