Tag Archives: haxe

Air NativeProcess and bash file to compile haXe nme project

Last week I’ve made some test with haXe nme and box2d. The result is awesome : beautiful perf and a quick export on the target required! When I tried to run box2d from flash on a iPhone there was really bad performance : 10 dynamics objects – 5 fps. With haXe nme, more than 80 dynamics objects and 30 fps… that the power of native app. And for the fun I had an html5 box2d export, but not running smoothly.
At the moment, what I’m really missing is a powerful IDE for writing code and don’t use the console (even if it works great). FlashDevelop is the best one, but runs only on windows. Sadly, FDT supports haXe but not the nme. However it seems that JetBrains are working on a plugin for haXe and nme! But right now, I use Sublime Text 2 with the haXe plugin.

Anyway, I thought it would be cool to have a simple utilitarian app to create nmml files and compile projects with options (targets, mode, …). An Air application seemed to be an elegant way. Let’s go for a proof of concept on this last part :

The problem was how to run terminal command line with Air? The NativeProcess class provides command line integration and general launching capabilities. The NativeProcess class lets an AIR application execute native processes on the host operating system.
So it means that if I write a simple bash file, I’m able to run it with AIR!

Continue reading Air NativeProcess and bash file to compile haXe nme project

Rugby game, AS3 – CE – haXe versions

Two weeks ago at school we made a simple rugby game with graphics provided.
I take this opportunity to compare how I develop the game if I use different framewok :

– in AS3 with linked list and object pooling (refers to this previous tutorial). Obviously it is a little game, and we don’t need complex optimization, but that was a good implementation exercice. Moreover I’ve updated my class 😉

– with the Citrus Engine, managing Box2D. It was not easy to handle physics to have the same result that the basic AS3 version, and actually it is not the same (there is some inertia), but I really like how Box2d handle collision. We can manage before collision, the beginning and the ending. It is really more precise than a hitTestObject. Moreover we can separate art from physic body, and so change easily the “collision box”.

– last night, with lbineau we made a programming evening around haXe (and some beers 🙂 ). The idea was really simple : make the same game, using existing AS3 classes with haXe. I have already given a chance to haXe previously and saw how powerful it is. This time, I see how easy it is to use previous AS3 code. I didn’t rewrite my Opponent and Player class! And I used the fla to link graphics without any trouble! However I’m a bit disappointed : I used most of the time original AS3 objects instead of haXe primary objects. What I need right now is FDT5 with its full haXe support! Can’t wait for it… Oh! If you’re interesting by haXe, you should take a look on NME, it seems to be amazing.

The zip with the three versions.

Starting with haXe

I heard a lot about haXe recently, so I made ​​the leap. This is a short introduction with demo to the haXe language.

haXe is a multiplatform language. You can use it to target Flash, JavaScript, C++, Php, and soon C# and Java. What does it mean ? You write your program in haXe and you chose on which platform you will export it. It is compiled on its target platform : .swf .php .js …

“The idea behind haXe is to let the developer choose the best platform for a given job. In general, this is not easy to do, because every new platform comes with its own programming language. What haXe provides you with is:
– a standardized language with many good features
– a standard library (including Date, Xml, Math…) that works the same on all platforms
– platform-specific libraries : the full APIs for a given platform are accessible from haXe”

In this short tutorial, I will target on two platforms .swf and binaries file (cpp) with the same code!

Continue reading Starting with haXe