- Want to code a thing
- Choose a runtime
- Choose a language
- Choose some libraries
- Start coding
- Library doesn't meet your requirements
- Start writing your own library
- Language gets in way of perfect library
- Start writing your own language
- Runtime is holding back language
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
| // compile with: | |
| // haxe -main Test -swf test.swf -lib hscript | |
| class Test extends flash.display.Sprite | |
| { | |
| static function main() flash.Lib.current.addChild(new Test()); | |
| function new() | |
| { | |
| super(); |
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
| $ mkdir haxe-droid && cd haxe-droid | |
| $ git clone https://github.com/vouillon/ocaml-android.git | |
| $ git clone https://github.com/HaxeFoundation/haxe.git | |
| $ http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86.tar.bz2 | |
| $ tar -vjxf android-ndk-r9b-darwin-x86.tar.bz2 && rm android-ndk-r9b-darwin-x86.tar.bz2 && mv android-ndk-r9b android-ndk | |
| $ wget http://caml.inria.fr/pub/distrib/ocaml-4.01/ocaml-4.01.0.tar.gz | |
| $ tar -xzf ocaml-4.01.0.tar.gz && rm ocaml-4.01.0.tar.gz && mv ocaml-4.01.0 ocaml-src |
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.Expr; | |
| class FTW | |
| { | |
| public static function build() | |
| { | |
| return haxe.macro.Context.getBuildFields().map(transformField); | |
| } | |
| static function transformField(field:Field) |
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.Expr; | |
| class Func | |
| { | |
| public static function each<T>(it:Iterable<T>, cb:T -> Void) | |
| { | |
| for (i in it) cb(i); | |
| } | |
| public static function every<T>(it:Iterable<T>, cb:T -> Bool):Bool |
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 neko.vm.Thread; | |
| import sys.io.Process; | |
| class ProcessHelper | |
| { | |
| static function main() | |
| { | |
| var process = run('haxe', ['--help'], | |
| function (line) Sys.println('stdout: $line'), | |
| function (line) Sys.println('stderr: $line'), |
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() | |
| { | |
| new Test().a().a().a().a().a().a().a().a().a().a().a().a().a().a().a().a().a().a().a().a().a() | |
| .a() // 0.460s | |
| .a() // 0.910s | |
| .a() // 1.860s | |
| .a() // 3.630s | |
| .a() // 7.350s |
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 | |
| { | |
| static function main() | |
| { | |
| var context = new MyContext(new View()); | |
| } | |
| } | |
| class MyContext extends mmvc.impl.Context | |
| { |
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 VerEx | |
| { | |
| public static function main() | |
| { | |
| var test = new VerEx() | |
| .startOfLine() | |
| .then("http") | |
| .maybe("s") | |
| .then("://") | |
| .maybe("www.") |
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 GameScene extends Scene { | |
| // ... | |
| public override function update() { | |
| // Keep camera.x centered on the player | |
| HXP.camera.x = player.x - HXP.halfWidth + 64; | |
| // Keep camera.y centered on the player, | |
| // unless it would show below the map. | |
| // In that case, keep to the bottom fo the map. |