/* File created by Template haxe -swf Gfx_Test.swf -swf-version 9 -swf-lib swf/sprite_png_lib.swf -cp src -main Main haxe -swf Gfx_Test.swf -swf-version 9 -swf-lib swf/sprite_png_lib.swf -cp src -swf-header 256:224:30 -main Main */ import flash.display.BitmapData; import flash.display.Bitmap; import flash.geom.Rectangle; import flash.geom.Point; import flash.utils.Timer; import haxe.Timer; import flash.events.Event; import Swf_Resources; import Gfx; /* class BackgroundBitmap extends Bitmap { public function new() { super(); } } */ class Main{ private var _offscreenBitmap:Bitmap; private var _offscreenBitmapData:BitmapData; private var _viewportBitmap:Bitmap; private var _viewportBitmapData:BitmapData; private var background_Bitmap:BackgroundBitmap; private var gfx: Gfx; public function new(){ // create a viewport with SNES console // resolution dimensions of 256 x 224 pixels gfx = new Gfx(256,224); } // function Render // used for composing the animation // Step 1. draw the background bitmap to the offscreen bitmap // Step 2. draw the offscreen bitmap to the viewport (user screen) public function Render() { //var gfx = new Gfx(); // create a background object (the background art) var background_Bitmap = new BackgroundBitmap(); // copy the background bitmap to the offscreen // compose all animation on the offscreen bitmap // and then drw it to the viewport (Flash on the browser) var srcRect = new Rectangle(0,0,256,192); var dstPt = new Point(0,0); gfx.Gfx_copyPixels_to_Offscreen( background_Bitmap.bitmapData, srcRect, dstPt ); // update the viewport gfx.Gfx_copy_Offscreen_to_Viewport(); } // END Render // main driver code public static function main(){ var screen = new Main(); screen.Render(); } }