[SDL] Where SDL goes in your game

Armond armond.sarkisian at gmail.com
Wed Nov 8 09:43:55 PST 2006


Hi everyone,

This is my first post in this forum and hoping to find some help. I started 
SDL a few months ago and all is well except I have a problem with the entire 
program's structure.
 
When we create an SDL-based app, where do you put all the SDL data as far as 
the entire program's structure is concerned. An example... suppose we have the 
following classes:
 
- GameObjects  ( super-class )
 
- Ball ( derived-class )
- Paddle ( derived-class )
 
As for efficiency, planning and game design, is it best to:
 
A) have a separate class specifically for all the SDL stuff ( surfaces, music, 
sound effects, etc. etc. )
B) integrate all the SDL stuff within the GameObjects, Ball and Paddle 
classes, in other words, all the SDL stuff is spread around . You have the 
Ball surface with the Ball class, the Paddle surface with the Paddle class and 
each respective surface with each respective class.
 
I have learned a great deal when it comes to SDL but my problem is structuring 
it with the rest of the program.
 
In an SDL program, ( speaking in 2D terms ), you have surfaces. Let's say you 
have an image you want to place onto the screen. Let's say this is an image of 
a Ball. Do you:
 
A) create a separate class to hold all your SDL data and place that surface 
(SDL_Surface* ball) into that class
B)
place the  surface (SDL_Surface* ball) object in the Ball class 
 
Any help would be appreciated. Thanks!
 
Regards,
 
Armond





More information about the SDL mailing list