Prev | Current Page 992 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


var mySprite : String = ???assets/charSprite.bmp???;
var srf = new Surface( mySprite );
The image is then stored in memory and can be accessed through the Surface object instance. When
you are finished with the image, you should call the method free , which relinquishes the memory
consumed by the image.
srf.free();
This is not necessary, however, when ending your application providing you remember to call the close
method of the Manager class, as all remaining Surface objects are cleared at this time.
Drawing a Surface to the Display
The Surface class provides a simple method called draw . This method is responsible for copying a
series of pixels from itself to a location on another Surface object, which can be either another image, or
the back buffer of the display.
var destination : Surface = mng.getScreen();
var pixels : Rect = new Rect( 0, 0, 100, 100 );
var location : Point = new Point( 0, 0 );
srf.draw( destination, pixels, location );
Manager
Sound
Music
Rect
Point
Timer
TTF
TTF
TTF
Surfaces
BitmapFont
TTF
Sprite
Non-Visible and
Helper Classes
contains
Figure 19-2
Chapter 19: Multimedia with Neko
539
The pixels value represents the coordinates of the pixels to draw to the destination Surface , which
include both the x and y location, as well as the width and height of the pixel area.


Pages:
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004