Class inheritance map. Any suggestions?

Started by
2 comments, last by Icon__ 18 years, 11 months ago
Hi all. I'm trying to develop a more structured inhertiance tree for my graphics objects and I seem to be going round and round so I thought I'd try to map it out here and, hopefully, get some suggestions and thoughts as to the way some of you people have done this in the past. Currently I just have my sprite class(es) based on Cone's GFX SDL tutorials. I don't have a seperate class for surfaces and just use SDL_Surface*. I've recently decided to add cursor control to the engine and decided that the cursor can be treated as a sprite. But after looking at my sprite class(es) I decided that the functionality was far to much for a cursor, and I couldn't easily fit a cursor class around my current design, ergo. I think it is time for a re-think. I hope you can help with thoughts and ideas...okay here we go. My engine is Called SiSE so all class names start with SiSE if some of you wonder at the syntax. I'll start with the base class and work down:


                                  SiSEObject
                                 (Base Object)
                                      |
   ------------------------------------------------------
   |                        |                           |
SiSEFrames--1 or Many-->SiSESurface                SiSEBaseSprite
   |                                                    |
SiSEAnim                                     -----------------------
   ^                                         |                     |
   |---------------Has One---------------SiSECursor           SiSESprite
   ^                                                               |
   |                                                               |
   ----------------------------Has Many-----------------------------





Obviously this is a very high level view and doesn't show any methods but, hopefully, it gives you some idea of what I'm thinking of in my overall inheritence design for my graphical objects. Does it seem okay...any comments?
Gary.Goodbye, and thanks for all the fish.
Advertisement
1. Why do you prefix your classes with the name of your engine?
2. What is the point of inheriting all your classes from "Object" ? What methods are inherited from there?
3. My personal approach is that a Cursor has a sprite (so it can play different animations depending on the status).
4. What is the difference between Frames and Anim? What point does having a "frames" object serve? And in any case, wouldn't an Anim have Frames (instead of being)?
1. One name is as good as another. Also my engine provides quite a lot of functionality so I want to distinguish classes and objects provided by the engine from in game classes.

2. The idea of the base object was for object tracking/management. The base class was intended as a "glue" type object that could provide global functionality. Sounds like this might be a bad idea?

3. My Sprite class has some collision detection functionality and member variables that I feel are overkill for a cursor...like aabb sweep collision detection.

4. Point taken about the frames and animimation classes.

Anymore suggestion and comments?
Gary.Goodbye, and thanks for all the fish.
Regarding (1), I'd suggest to use namespace partitioning.
MSN: Icon__@hotmail.comhttp://www.softwarespecies.com

This topic is closed to new replies.

Advertisement