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
/** | |
* 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 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
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
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
class Test { | |
static function main() { | |
var a = new SmartArray([1, 2, 3]); | |
for (e in a) { | |
trace(e); | |
if (e == 2) a.remove(1); | |
} | |
} | |
} | |
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.net.SocketClient; | |
import pony.net.SocketServer; | |
import pony.time.MainLoop; | |
class NekoSockets { | |
private static function main():Void { | |
MainLoop.init(); | |
var port = 12345; |
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.net.*; | |
import pony.net.rpc.*; | |
import pony.events.*; | |
import pony.time.MainLoop; | |
class RPCExample { | |
private static function main():Void { | |
MainLoop.init(); |
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.Constraints.Function; | |
/* | |
Result: | |
src/Main.hx:16: Function bench | |
src/Main.hx:76: 0.019 sec | |
src/Main.hx:19: Signal bench | |
src/Main.hx:76: 0.01 sec | |
*/ |
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 Main { | |
private static function main():Void { | |
trace(-1 > (5: UInt)); | |
} | |
} | |
abstract UInt(Int) from Int to Int { | |
@:op(A + B) private static inline function add(a:UInt, b:UInt):UInt { |