Even the display buffer is represented in NME as a Surface . This means you can just as simply render
all of your text and animations to an object, and then render that object to the display buffer, if you so
wish. Or, you could choose to render the content of the back buffer to an area on a different surface.
Though, quite frankly, we couldn ??™ t imagine a time when this would be useful. Figure 19 - 2 represents the
relationship between each of the classes in NME and the Surface class.
Part III: Extending the Possibilities
538
The Surface class provides a number of functions relative to interacting with, or manipulating itself.
Functionality such as transforms, collision detection, and color keying, can be found here, though most
interaction with a Surface object will normally be handled from the Sprite , Manager , or one of the
font classes.
To use a Surface , you first need to provide it with an image, which can be a BMP, PNM (PPM/PGM/
PBM), XPM, LBM, PCX, GIF, JPEG, PNG, TGA, or TIFF format. This needs to be passed when you
instantiate the class as a path to the image file.
Pages:
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003