Jump to content
  • Advertisement
Sign in to follow this  
garyfletcher

Class inheritance map. Any suggestions?

This topic is 4902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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)?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!