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
// In a build system, I like to pass typed compile-time constants to my code | |
// via compiler defines. For example, a host String and a port Int. The | |
// following macros provide functionality to either parse or eval a compiler | |
// define as Haxe code. Since they operate at compile time and inject the | |
// resulting expressions into your code, this retains all type features -- | |
// from type inference to type checking. | |
// | |
// Note that $type prints the type at compile time, while trace prints | |
// the value at runtime. Neko is called simply to demonstrate the latter. | |
import haxe.macro.Context; |
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
Scripting: | |
(1) Here is an example script (all one file): | |
#(init) input, sprite -- An "init" event (runs once) that initializes the "input" and "sprite" packages | |
Sprite.AddTrail(-1); -- This function is called from the sprite package (without sprite, it will crash) | |
#(init) controller -- Another "init" event that initializers the "controller" package (so that it can be used in update) | |
#(update) input, controller -- An "update" event that uses the "input" and "controller" packages | |
if (Input.Left()) | |
Controller.Move(-100.0); |
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; | |
using haxe.macro.ExprTools; | |
class Main | |
{ | |
inline static var QUOTED_FIELD_PREFIX = "@$__hx__"; | |
static function main() |
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
/** | |
* Simple wrapper for anonymous structures that are meant to be used as a | |
* keyed collection of objects of the same type (i.e. json object). | |
* | |
* Wraps Reflect calls with nice syntax and static typing without any | |
* runtime overhead. | |
*/ | |
abstract DynamicMap<V>(Dynamic<V>) from Dynamic<V> | |
{ | |
/** |
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
mkdir ~/source | |
# dependencies | |
sudo apt-get update | |
sudo apt-get install libgc-dev bzip2 git-core make gcc g++ gnuplot glade imagemagick libusb-dev python-usb python-lxml python-wxgtk2.8 speech-dispatcher libgnomecanvas2-dev m4 libsdl1.2-dev | |
# neko | |
git clone https://github.com/HaxeFoundation/neko.git ~/source/neko | |
cd ~/source/neko | |
make |
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
<?xml version="1.0" encoding="utf-8"?> | |
<project> | |
<!-- <meta /> | |
Use meta nodes to set metadata for your application. The description is ignored | |
on most targets, but is useful for packaging like Chrome Apps or Opera Widgets. | |
For compatibility with Android and webOS, the package name must include at least |