The location of the
destination Surface is merely the x and y values, as the pixels are transferred without transformation.
You do not have to specify the source Surface , as it is assumed you wish to draw from the methods
object.
To draw to the display buffer, you first need to acquire its Surface object. This is performed using the
getScreen method of the Manager class instance.
mng.getScreen();
Once acquired, you can then access the Surface as you would any other, whether you are drawing to, or
from its pixels.
Here is an example utilizing the draw method:
import nme.Manager;
import nme.Surface;
import nme.Rect;
import nme.Point;
import nme.TTF;
class DrawSurface
{
static var mainObject : DrawSurface;
var running : Bool;
var mng : Manager;
var batSrf : Surface;
static function main()
{
mainObject = new DrawSurface();
}
public function new()
{
mng = new Manager( 200, 200, ???Surface Draw???, false, ???ico.gif??? );
batSrf = new Surface( ???bat.png??? );
batSrf.setKey( 0xFF, 0x00, 0xFF );
var x = 30;
var y = 30;
var dir = true;
running = true;
while (running)
{
mng.
Pages:
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005