This file contains 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
@:jsRequire("remote") | |
extern class Remote { | |
static function require(module:String):Dynamic; | |
} | |
extern class BrowserWindow { | |
function new(); | |
} | |
@:jsRequire("browser-window") |
This file contains 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 { | |
static function main() { | |
var s = new Signature<Int->Void>(); | |
} | |
} |
This file contains 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
@:build(MyMacro.build()) | |
abstract MapItem(Array<Dynamic>) { | |
var itemId:Int; | |
var defId:String; | |
} | |
class Main { | |
static function main() { | |
var item = new MapItem(); | |
item.itemId = 10; |
This file contains 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.Context; | |
import haxe.macro.Expr; | |
import haxe.macro.Type; | |
using haxe.macro.Tools; | |
class LocaleMacro { | |
static function build():Array<Field> { | |
var fields = Context.getBuildFields(); | |
var newFields:Array<Field> = []; | |
for (field in fields) { |
This file contains 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 js.html.ArrayBuffer; | |
import js.html.DataView; | |
import DataTypes; | |
@:dce | |
@:build(DataMacro.build()) | |
abstract Data(DataView) { | |
var byte:Uint8; | |
var int:Int32; | |
var float:Float32; |
This file contains 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 { | |
static function main() { | |
Sdl.init(Sdl.INIT_EVERYTHING); | |
var win = Sdl.createWindow("Hello", 100, 100, 800, 600, Sdl.WINDOW_OPENGL); | |
var ren = Sdl.createRenderer(win, -1, Sdl.RENDERER_ACCELERATED); | |
var bmp = Sdl.loadBMP("test.bmp"); | |
var tex = Sdl.createTextureFromSurface(ren, bmp); | |
Sdl.freeSurface(bmp); | |
for (i in 0...3) { |
This file contains 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
#if macro | |
import haxe.macro.Context; | |
import haxe.macro.Expr; | |
import haxe.macro.Type; | |
using haxe.macro.Tools; | |
#end | |
abstract Choice<T>(T) from T { | |
public macro function match(self, match) { | |
switch (match.expr) { |
This file contains 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.Expr; | |
import haxe.Constraints.Function; | |
#if macro | |
import haxe.macro.Context; | |
import haxe.macro.Type; | |
using haxe.macro.Tools; | |
#end | |
class DI { |
This file contains 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
using Tools; | |
class Main { | |
static function main() { | |
var a = haxe.ds.Option.Some(42); | |
var s = a.extract(Some(v) => {value: v}); | |
trace(s); | |
} | |
} |
This file contains 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; | |
@:pythonImport("flask", "Flask") | |
extern class Flask { | |
function new(module:String); | |
function run():Void; | |
function route<T:Function>(path:String):T->T; | |
} | |
class Main { |