Object Design
I''ve been reading some previous threads and I haven''t been able to find exactly what I''ve been looking for, so I hope someone can help me =)
Does anyone know of any documents, tutorials, etc on object design? I don''t mean model design using 3D Studio Max, Blender, etc..., but the design of objects in object oriented programming in respects to game development. Such as implementations of rendering, drawing, etc (Should all objects have their own Draw() method, possibly using inheritance for similar structures) or a universal Draw() method (where a Model Structure is passed to a singular method which takes care of drawing using the Model Structure data). The above was just an example really...
The way I have it right no (from end class to super class), is a Model class which is pretty standard (nothing really unique) that I use to create new objects from. This Model class inherits from an ASE loader class (to load ASE files exported from 3D Studio Max), which inherits from a ModelStruct which can contain multiple objects, textures, with their required vertices, normals, etc.
I''ve been thinking that this might not be the best object design (probably isn''t, I''m new at this) and I would like some help on object design. If anyone can give me some links, resources, etc...I would be most appreciative =)
Thanks in advance.
My current object design (using Delphi) is to have each module (video, input, menu, dialogs, etc) descended from a base module class. This base module class exposes three virtual functions: Initialize, Frame and Shutdown. Initialize is called once for each module after it is created. It is here that resources are allocated and/or loaded from file for that module. Shutdown is called immediately prior to destruction of the module. Frame is called once every frame. This handles things like rendering to the buffer, checking input, etc. This way, each module is completely self-contained if desired. I can easily just add a call to the menu module Frame method to display the menu over the top of my game screen if I wish.
well the point of OOP is to make everything selfcontained... so as far as the draw funtion.... created a virtual function with the parameters need to draw the object... pointer to the screen, where to draw it(if needed)... then using that as a starting point write the function in the object so it only has to deal with that kind of object... so you CCube only can draw cubes... CCone draws cones... all of this is based on the data in the class...
then create a golbal function that just calls the Draw function of each class in the list...
Great Milenko
then create a golbal function that just calls the Draw function of each class in the list...
Great Milenko
Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."
http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech
The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement