[SDL] Where SDL goes in your game

Lilith Calbridge lilith at dcccd.edu
Wed Nov 8 10:02:26 PST 2006


You're asking the same questions I've been asking myself without voicing
on any forums.  Being Old School C but knowing (and preferring) C++ I
have a certain bias towards not having a super class object.  This kind
of forces me to put a lot of objects in the global scope.  I've been
studying the "documentation" (essentially heavily commented demo source)
for the PopCap engine and it seems that they do have an App superclass. 
But then, that's at the heart of having an engine and pretty much the
way MFC apps are structured.

The problem I have is that I lose sight of the scope of any given
object, especially when you're dealing with an App object that's really
a derived class.  If anyone can provide perspective on this approach I'd
certainly appreciate it.  It could help me get over my reader's block.

Lilith

>>> On 11/8/2006 at 11:43 AM, in message
<loom.20061108T184136-335 at post.gmane.org>,
Armond <armond.sarkisian at gmail.com> wrote:
> 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
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org 
> http://www.libsdl.org/mailman/listinfo/sdl




More information about the SDL mailing list