Skip to content

Commit

Permalink
updated drawTiles against NME SVN (API change and Flash support)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsassph committed Dec 16, 2011
1 parent 3ceb3b5 commit bb1765e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,3 +1,2 @@
bin/*
.DS_Store
complete.hxml
2 changes: 0 additions & 2 deletions src/BunnyMark.hx
Expand Up @@ -38,9 +38,7 @@ class BunnyMark extends Sprite
bg.setSize(stage.stageWidth + 100, stage.stageHeight + 100);
addChild(bg);

#if cpp
addChild (new TileTest ());
#end

fps = new FPS();
addChild(fps);
Expand Down
17 changes: 12 additions & 5 deletions src/TileTest.hx
Expand Up @@ -4,6 +4,7 @@ import nme.display.Bitmap;
import nme.display.BitmapData;
import nme.display.Graphics;
import nme.display.Sprite;
import nme.display.StageQuality;
import nme.display.Tilesheet;
import nme.display.BlendMode;
import nme.events.Event;
Expand Down Expand Up @@ -43,9 +44,15 @@ class TileTest extends Sprite
super ();

gravity = 0.5;
smooth = true;
incBunnies = 100;
#if flash
smooth = false;
numBunnies = 100;
Lib.current.stage.quality = StageQuality.LOW;
#else
smooth = true;
numBunnies = 500;
#end

bunnyAsset = Assets.getBitmapData("assets/wabbit_alpha.png");
pirate = new Bitmap(Assets.getBitmapData("assets/pirate.png"));
Expand Down Expand Up @@ -166,12 +173,12 @@ class TileTest extends Sprite
drawList[index + 5] = bunny.alpha;
}

graphics.drawTiles (tilesheet, drawList, smooth,
Graphics.TILE_SCALE | Graphics.TILE_ROTATION | Graphics.TILE_ALPHA);
tilesheet.drawTiles(graphics, drawList, smooth,
Tilesheet.TILE_SCALE | Tilesheet.TILE_ROTATION | Tilesheet.TILE_ALPHA);

var t = Lib.getTimer();
pirate.x = Std.int((Lib.stage.stageWidth - pirate.width) * (0.5 + 0.5 * Math.sin(t / 3000)));
pirate.y = Std.int(Lib.stage.stageHeight - pirate.height + 70 - 30 * Math.sin(t / 100));
pirate.x = Std.int((stage.stageWidth - pirate.width) * (0.5 + 0.5 * Math.sin(t / 3000)));
pirate.y = Std.int(stage.stageHeight - pirate.height + 70 - 30 * Math.sin(t / 100));
}


Expand Down

0 comments on commit bb1765e

Please sign in to comment.