FAQ: Things I made with Haxe

A wireframe Haxe icon on a familiar calm blue background

Recently someone pointed out that they never knew that GMEdit was made in Haxe, and that you often don't even know that something was made in Haxe. Which is a pretty good point - for instance, you might suspect that a lot of things that I do have some parts of them written in Haxe, but never exact.

So, as for my activities, I looked over the local projects and formed a semi-comprehensive list of which of my works to date were made in Haxe, and to what extent (excluding ones still under non-disclosure agreements, obviously).

Also includes an opening on why I like Haxe anyway.

Continue reading

Small Haxe questions & answers

Sometimes I have one or other semi-obscure Haxe question, find nothing via search, and think "I feel like I asked about this before somewhere". And sometimes it turns out that yes, I did, but it usually takes a while to find what project houses the solution code, or where did I ask it.

This post is a small dump of such questions, mostly eventually self-answered.

Continue reading

Introducing: POOL [of doom!]


Game's title screen

This week a One Script Games jam was held on GameMaker forums. In short, the rules are that the entire game must be done inside a single script (function), which is then called once per frame, and must make use of built-in functions to store and process all needed information.

While potentially a little quirky, this seemed like an interesting challenge, so I made a game for it.

The result is a mini-FPS that is a mix of Doom, Quake, and a particular cue sport.

You can download it right now or read the full post for technical details.

Continue reading

Haxe: C-style enum macros

I've recently stumbled upon this little macro by Justo Delgado. It takes an "enum abstract" and sets the values of it's constant-fields incrementally. This brings up an interesting point.

See, in C, you can leave out the values and have them assigned automatically (0, 1, 2, ...), set the values manually, or mix the two, having the values continue "upwards" from the last specified value. So, for example, if I have this,

enum class Op {
	Add = 0x90, Sub,
	Mul = 0xA0, Div, Mod,
};

Op::Div will be equal to 0xA1, which is convenient, and allows grouping enum constants together (in this case storing operator priority in the upper 4 bits).

Haxe doesn't have that "out of box", unfortunately - either you make an actual enum and have the values assigned automatically, or make an @:enum abstract and assign the values manually.

But, of course, that can be fixed with a macro.

Continue reading

Haxe: Shorthand expression matching

This is a small post about a small, useful macro for Haxe.

As you may (or may not) know, Haxe has fancy enums (which are actually algebraic data types). That's nice. And you can do all sorts of fancy value matching on them, which is also nice.

What is less nice, however, is that the only conventional way to extract enum arguments is to "match" it, and thus in some situations you can only do code like this,

var r = switch (expr) {
    case one(k): k;
    default: -1;
};

adding a couple lines of code in place of what feels like it could have been a single operator.

So I wrote a tiny macro which adds just that:

var r = ematch(expr, some(k), k, -1);
Continue reading