Copyright © 1995 Walt Davis
http://www.waltdavis.net
Introduction
Graphics Port
System
Individuals having little or no exposure
to this project should consider reading "BUTTERFLY
Theory."
Conversion of the windowing system to a singleton type object having multi-module linkage should be done. This can be achieved using a non-singleton class having a private default constructor and a friend function that performs the object's construction.
The current window framing functionality should be stripped from the windowing system singleton and a windows type class that is separate from the windowing system should be provided. This would allow developers to use a generic window object having no framing or to derive new window types having specific window framing. The window objects would be instantiated and then further initialized upon being passed to the windowing system singleton.
Incorporate into the windowing system singleton the graphics primitive buffer functionality. This entails a buffer of function pointers containing the addresses of the current set of graphics primitives being used; where, the current set of graphics primitives is determined by the coordinate system and window access being used.
The original plan to use the windowing system graphics primitives, as function calls within the Graphic Object Class primitives, was ignored. Instead, I chose to use the windowing system data structures and directly hardcode the graphics primitives. This results in significant speed hits.
In retrospect I am not sure if I would rather have developed my own container objects or used someone else’s. BOCL is definitely at the bottom of my list of choices. For future development I recommend trying a more professional library package such as "Tools.h++" by "ROGUE WAVE Software."
The Shape class should be fairly simple to implement. Add to the Graphic Object class a virtual function (YourTypePlease) that returns an identifier representing the type of graphic object, shape, scene, world, or whatever. Once this function has been added then any class derived from Graphic Object should redefine the function YourTypePlease so that
The scene class should be developed after completing the shape class. Simply derive a new class, called Scene, from the Graphic Array class. In the Scene class, redefine the virtual attachment functions so to check for the type of graphic object being attached. If the type of object is shape or scene, continue the attachment by calling the attachment functions inherited from Graphic Array. Like shape, Scene must also redefine the virtual function YourTypePlease.
Once the scene class has been developed and thoroughly tested, the world class can be implemented. Simply derive a new class, called World, from the Scene class and redefine the virtual function YourTypePlease. Because the function YourTypePlease will return something other than shape or scene, in this case world, there is no need to modify the virtual attachment functions.
Copyright © 1995 Walt Davis
http://www.waltdavis.net