Implementation of the Flyweight_Exercise() function as used in the Flyweight Pattern. More...
Go to the source code of this file.
Namespaces | |
| namespace | DesignPatternExamples_python | 
| The DesignPatternExamples_python package, containing 20 examples of design patterns, each in their own namespace.  | |
| namespace | DesignPatternExamples_python.flyweight | 
| namespace | DesignPatternExamples_python.flyweight.flyweight_exercise | 
Functions | |
| int | _Flyweight_GenerateBigResource (int numImages, int width, int height) | 
| Generate a big resource, in this case, a text master "image" of the specified height, containing the specified number of smaller images laid out horizontally, using the given width for each image.   | |
| None | _Flyweight_ClearDisplay (list[bytearray] display) | 
| Clear the "display" to a background image, erasing whatever was there before.   | |
| list[bytearray] | _Flyweight_GenerateDisplay (int width, int height) | 
| Generate a display area in which to render the big resource.   | |
| None | _Flyweight_ShowDisplay (list[bytearray] display) | 
| Render the display to the screen.   | |
| None | _Flyweight_MoveFlyweights (list[Flyweight_Class] flyweightInstances, int display_width, int display_height) | 
| Move the given flyweight instances within the display, bouncing them off the edges of the display.   | |
| None | _Flyweight_RenderFlyweights (list[Flyweight_Class] flyweightInstances, list[bytearray] displayArea) | 
| Render the image into the display, once for each flyweight instance.   | |
| float | GenerateVelocity () | 
| Generate a random velocity, which includes a speed and a direction.   | |
| list[Flyweight_Class] | _Flyweight_GenerateFlyweightClasses (int bigResourceId, int numFlyweights, int image_width, int image_height, int display_width, int display_height) | 
| Helper method to generate the specified number of flyweight class instances and associate those instances with individual contexts and a single big resource.   | |
| def | Flyweight_Exercise () | 
| Example of using the Flyweight Pattern.   | |
Implementation of the Flyweight_Exercise() function as used in the Flyweight Pattern.
Definition in file flyweight_exercise.py.