It's been in development for a long time - over a year, in fact - but a new major version of HaxePunk is now available on haxelib! It's the same 2D game engine you know and love with a new look, some reorganization, and a ton of improvements and new features. Here are some highlights:
Shaders
HaxePunk's Flash target and software rendering support have been removed, simplifying the code and allowing us to focus on hardware rendering features, such as custom shader support. Custom shaders can be applied to any individual graphic as well as entire Scenes.
In addition, the renderer is more robust and has been heavily optimized.
(Read more)
Signals
As an alternative to extending and overriding behavior, many parts of HaxePunk now support Signals, which let you bind one or more functions to be called whenever an event occurs. For example, Scenes have signals that fire before/after update, before/after rendering, on input, when the screen is resized, etc.
myScene.preUpdate.bind(myFunc);
Improved Input system
The Input system has been unified, making it easier to mix multiple input devices:
Input.define("start", [Key.ENTER]);
Mouse.define("start", MouseButton.LEFT);
trace(Input.check("start"));
These abstract inputs can also be used as Signals:
class MyScene extends Scene
{
public function new()
{
super();
onInputPressed.start.bind(onStart);
}
function onStart()
{
trace("You either pressed enter or clicked the mouse!");
}
}
(Read more)
Better BitmapText
BitmapText now supports rich text via XML markup:
BitmapText.defineFormatTag("red", {color: 0xff0000});
var txt = new BitmapText("Here's some <red>colored</red> text!", {
font: "fonts/azmoonfleet.64.fnt",
size: 14,
});
With these tags you can animate characters, render inline images, change fonts, and more.
Backend abstraction
HaxePunk now officially supports recent versions of both OpenFL and NME. Support for additional backends such as Kha is on the roadmap!
Conclusion
Note that, as a major version, HaxePunk includes many breaking changes - see the Migration Guide for tips on updating existing projects.
Thanks to all the contributors new and old who made HaxePunk 4.0 possible. We hope you enjoy it!