Skip to content

Instantly share code, notes, and snippets.

@tanis2000
Created October 2, 2015 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanis2000/95aacbfd29a1bbfadd9e to your computer and use it in GitHub Desktop.
Save tanis2000/95aacbfd29a1bbfadd9e to your computer and use it in GitHub Desktop.
Simple OpenFL example
package;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.Sprite;
import openfl.display.Graphics;
import openfl.display.CapsStyle;
import openfl.display.JointStyle;
import openfl.display.LineScaleMode;
import openfl.Assets;
class Main extends Sprite {
public function new () {
super ();
var bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));
addChild (bitmap);
bitmap.x = (stage.stageWidth - bitmap.width) / 2;
bitmap.y = (stage.stageHeight - bitmap.height) / 2;
this.graphics.lineStyle(10, 0xFF0000, 1, LineScaleMode.NORMAL, CapsStyle.NONE, JointStyle.ROUND, 10);
this.graphics.beginFill(0x00FF00, 1);
this.graphics.drawRect(0, 0, 500, 500);
this.graphics.endFill();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment