This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test { | |
static function main() { | |
var a = new Priority(); | |
a.add(3, 2); | |
a.add(1, 1); | |
trace(a.a); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var w = Config.width; | |
var h = Config.height; | |
var space:NapeSpaceView = new NapeSpaceView(new Point<Float>(0, 600)); | |
space.debugLines = {size: 3, color: 0xFFFFFF}; | |
c.addChild(space); | |
space.createStaticRect(new Rect<Float>(50, h - 50, w - 100, 1)); | |
space.createStaticRect(new Rect<Float>(w - 50, 50, 1, h - 100)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import haxe.macro.TypeTools; | |
import haxe.macro.Expr; | |
import haxe.macro.Context; | |
import haxe.macro.Type; | |
class GenericBuildMacro { | |
static public function build():ComplexType { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ParentClass | |
* @author AxGord <[email protected]> | |
*/ | |
@:assets_path('assets') | |
class ParentClass implements HasAsset { | |
@:asset public static var MY_ASSET = 'myasset3.png'; | |
static function main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pony.time.Tween; | |
class TweenExample { | |
static function main() { | |
var obj = new Sprite(); | |
new Tween(20...100, '3s').onUpdate << function(v:Float) obj.y = v; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LinkDemo implements pony.magic.HasLink { | |
static var index:Int = 5; | |
static var visualIndex(link, never):String = Std.string(index + 1); | |
static function main() { | |
trace(visualIndex);//=>6 | |
index = 10; | |
trace(visualIndex);//=>11 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pixi.core.graphics.Graphics; | |
import pixi.core.sprites.Sprite; | |
import pixi.core.textures.Texture; | |
import pony.time.DeltaTime; | |
class Container extends Sprite { | |
private var _bunny:Sprite; | |
public function new(width:Float, height:Float) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static function streamToString() { | |
var streamInput = new Event1<Int>(); | |
var streamOutput:Signal1<Int> = streamInput; | |
var subStream = streamOutput.convert1( | |
function(e:Event1<String>, v:Int) e.dispatch(v == 2 ? 'two' : Std.string(v)) | |
); | |
subStream.add(function(s:String) trace(s)); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro public function add(th:Expr, f:Expr, ?priority:ExprOf<Int>):Expr { | |
if (priority == null) priority = macro 0; | |
return switch Context.typeExpr(f).t { | |
case TFun(args, ret): | |
switch ret { | |
case TAbstract(t, p): | |
var n = t.get().name; | |
if (n != 'Bool' && n != 'Void') | |
Context.fatalError('Wrong return type', Context.currentPos()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
import pony.events.Signal; | |
/** | |
* ... | |
* @author AxGord <[email protected]> | |
*/ | |
class SignalTest { | |
static function main() { |