[SDL] Where SDL goes in your game
matt
mattmatteh at earthlink.net
Wed Nov 8 15:14:47 PST 2006
i have only written one app that uses sdl. in that i keep the core
code separate from sdl. perhaps think about how would it be ported to
another system. the less dependent sdl calls or system specific calls
there are the easier it is to port. not that you would port from sdl
to something else but hopefully explains the organization.
matt
Armond 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