Waxe: Compiling with .Hxml

NOTE: I’m a beginner at Haxe and even more so at Waxe so please point out anything stupid I’m doing 🙂

I’ve been following CambiataBlog’s great tutorials on getting started with Waxe (A project which allows access to wxWidget’s GUI tools in haxe ), and have been trying to branch out a bit on my own. I’d recommend reading through the these tutorials before looking at this as some fixes are required in the waxe source before the code below will run in haxe 2.09.

I’m really keen to use waxe for some tools to help me and my designer mate make our games. To make these tools NME’s display list and ability to load multiple image file formats will be really useful. Currently, as Andreas Mokros pointed out in the Haxe google group, if you compile using NME a NMEStage is instantiated above your waxe content, hiding it all. I want to use both waxe and nme display elements in my applications so looked a bit more at the alternative way of compiling in Waxe’s samples. If you compile with haxe and including nme as a -lib in your .hxml, there is no NMEstage made by default.

Here are a few notes on how to set this up.
Here’s my compile.hxml:
I’ve been testing in neko as it’s a bit quicker to compile on my machine. But this works as well in the cpp target.

-cp src
-neko bin/neko/WaxeApp.n
-main Main
-lib waxe
-lib nme

And then compile with:

haxe compile.hxml

Next up my bare bones Main.hx file which will make a new empty 400×400 window called “WaxeApp”.


import wx.App;
import wx.Frame;
import wx.Panel;

class Main
	private var frame:Frame;

	function new()
		// Make the app frame
		frame = Frame.create(null, "WaxeApp" , null , { width:400 , height:400 } );
		// Show your frame
		frame.shown = true;

	// Entry
	public static function main()
		App.boot( function(){ new Main(); } );

Unlike the nme workflow covered in CabiataBlog’s tutorials which gets the window from the ApplicationMain, here we make a frame by calling Frame.create then supplying the parent of the window (in this case null), the window’s name, position(here null), and size.

frame = Frame.create(null, "WaxeApp" , null , { width:400 , height:400 } );

We then show this window with:

frame.shown = true;

You can make multiple windows using Frame.create and .show = true again for each new one. If you set a new window’s parent as another window when creating it, it will be closed along with it’s parent.

This code in place you should be able to compile an application which opens a blank window. Which we will be able to add waxe and nme elements to.

2 Responses to Waxe: Compiling with .Hxml

  1. Hi Nick! Great Article! 🙂

  2. Nick Holder says:

    Thanks Jonas! I was inspired by your blog 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: