haXe on the iPhone with hxcpp, Flash 9 API to C++ for Mobile

haXe is an interesting programming language that allows abstracting the source from platform target.  It outputs for targets such as Actionscript and Javascript from haxe language source. But, haXe can also output to native code to run on Windows, Mac OSX, and Linux.

Well because of this it is possible to run haXe on the iPhone. The gamehaXe site has found a way to get haXe to compile to iPhone via hxcpp which creates a C++ output from haXe code very similar to Actionscript 3.

I am a bit late to the party but this is great news. It uses the NME library which will allows code to mostly be written to the Flash 9 API and create the C++ for XCode to compile and run on the iPhone and Touch. This creates a path to port Flash games to iPhone/Touch.

This project is one to watch and participate in.  Native compilation to the iPhone from haXe is a more simplified code to write in while providing lower level performance which is needed on mobile devices, as processors, cache and ram are much lower than desktop and below what is capable of running the Flash AVM2 currently.

If you have more interest in haXe there are some other great demos on as3/haXe at the game haXe site. Also, Tony at touchmypixel.com has posted some very useful information to help you get started with hxcpp.

The hxcpp project is a newer output target along with a java one but this could be interesting if actionscript like code and many libraries like Physaxe or AS3 libraries could be ported to haXe to output to the iPhone.

Tags: , , , , , , , , ,

  • http://dafishinsea.com David Wilhelm

    At first I was disappointed that haXe did not target the flash player 10 API, but on closer inspection of the API docs, it seems that it does ! Apparently, in the haXe docs ‘flash 9′ means ‘flash 9+’ or AVM2, which flash 9 was the first player version to use. Of course this isn’t relevant to the iPhone platform, where you’d be using some C library for 3D (OpenGL?) but I thought it’s worth pointing out.

  • Marcus

    Is it just me or is figuring out a way to get AS3 to C++ to run on the iPhone one of the first things Adobe should have worked on when it realized the Flash player wasn’t going to be on the device?

  • http://drawcode.com ryan

    @marcus, yes I think Adobe should have. There is probably a case to be made that AIR apps could be used to compile down to obj-c. Alchemy I think might be a start in this with LLVM but this new pathway to the iPhone is nice. I am using Unity3D iPhone and OpenGL directly as well as excellent engines for 2D like cocos2d-iphone (cloned in obj-c from python cocos2d), but it would be great to port over lots of flash content into the iphone even if it has to be compiled native and cross-compiled. Unity3D iPhone uses Mono and does this. I think the future has lots of cross-compiling and projects like Unladen Swallow with Python so you can write in productive fast languages but have the speed of gcc, that is the next area that will open it up.

  • http://www.globalserve.net/~dvafa Dave

    This is the funkiest/ coolest post I have seen! Yeah!
    i’m going to follow Director rss feeds..