Using starling and haxe
unzip the archive
unzip ./starling/bin/starling.swc
copy the obtained library.swf file somewhere in your project (renaming it starling.swf might be a good idea).
- create a path file named 'starling.patch' (http://haxe.org/manual/swc):
-starling.core.Starling.context -starling.core.Starling.juggler -starling.core.Starling.contentScaleFactor
- Now the little test:
// Test.hx
import starling.core.Starling;
import starling.display.Sprite;
import starling.text.TextField;
class Test extends Sprite {
public function new(){
super();
var textField = new TextField(400, 300, "Welcome to Starling!");
addChild(textField);
}
public static function main(){
var s = new Starling(Test, flash.Lib.current.stage);
s.start();
}
}
- And the compilation instructions:
haxe \
-main Test \
-swf-header 400:300:80:aeaeae \
-swf Test.swf \
-swf-version 11.3 \
-swf-lib starling.swf \
--macro "patchTypes('starling.patch')"
- Don't forget to download the latest standalone flash player and debugger, I experienced problems with the version I previously installed.
Test project: haxe-starling.tgz
And now, can a haxelib package add compilation parameters to haxe so the following would automatically add -swf-lib and --macro?
haxelib install starling haxe -lib starling ...
labe.me