Loading Images


Class Diagrams for the Application

Figure 6-2 shows the class diagrams for the ImagesTests application. The class names, public methods, and constants are shown.

ImagesTests creates a JFrame and the JPanel where the images are drawn, and it starts a Swing timer to update its images every 0.1 second.

ImagesTests employs an ImagesLoader object to load the images named in a configuration file (imsInfo.txt in the Images/ subdirectory). ImagesLoader will be used in several subsequent chapters to load images and animations into my games.

The visual effects methods, such as blurring, are grouped together in ImagesSFXs. Animations represented by sequences of images (e.g., numbers, cars, kaboom, cats, and figure) are controlled by ImagesPlayer objects. A sequence may be shown repeatedly, stopped, and restarted.

A completed animation sequence can call sequenceEnded( ) in an object implementing the ImagesPlayerWatcher interface. ImagesTests implements ImagesPlayerWatcher and is used as a callback by the numbers sequence.



Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net