HNHacker News
TopNewBestAskShowJobs

clemos

229 karma · joined August 24, 2011

submissionscomments
clemos··on Ask HN: Haxe or Unity? Why?
see http://waneck.github.io/wwx-unity3d-haxe/
clemos··on Ask HN: Haxe or Unity? Why?
You can do Unity with Haxe, but not the other way around, so clearly Haxe > Unity :p
clemos··on Flash is dead, long live OpenFL
We made a cross-platform (Flash, HTML5, Android, iOS) video player for TF1 (first French TV channel, considered the most viewed TV channel in Europe)
clemos··on Try Haxe
So ?
clemos··on Try Haxe
I put a lighter theme, and increased line spacing a bit
clemos··on Try Haxe
Also, IMHO the fact that Haxe looks familiar to people coming from Javascript, ActionScript, or Java is a plus.
clemos··on Try Haxe
Well at least it doesn't look like PHP...
clemos··on Try Haxe
Actually functions are private by default.

"static function main()" seems to work as an entrance point, though, which makes sense somehow...

clemos··on Try Haxe
It could be fun to have a CoffeeScript to Haxe converter, though.
clemos··on Try Haxe
Not usually, but I wanted the app to look a bit less "hardcore techie" than the rest of the Haxe evangelism material :)
clemos··on Try Haxe
NME is particularily good in building "Flash-like" applications, so mainly games.

I think Appcelerator is more adapted to applications that want to use native UIs elements (menus, buttons, layouts, etc).

Then you can still write an Appcelerator app using Haxe :) https://github.com/skial/haXe-titanium-desktop

I don't know how/if it's possible to mix both, for example embed a NME app inside an Appcelerator app (besides using UI.WebView and embed it as HTML...)

clemos··on Try Haxe
Given that a .swc is basically a zipped .swf, this currently depends on runtimes:

- Haxe/Flash supports embedding .swf libraries : http://haxe.org/manual/swc

- NME/C++ (Android, iOS, ...) has partial support for .swf libraries : http://www.joshuagranick.com/blog/2012/02/08/quick-notes-on-...

- NME/HTML5 doesn't seem to support .swf right now, but I think it's being worked out.

Then you have third party tools such as Flump or Flambe to help you: https://github.com/threerings/flump https://github.com/aduros/flambe

clemos··on Try Haxe
NME is a library for Haxe.

It basically provides an implementation of the Flash API for the C++ and Javascript targets, besides the SWF target that Haxe offers natively.

It also comes along with tools that allow this generated C++ code to be easily compiled and deployed to Android, iOS, Blackberry and WebOS devices.

So, if you write an app that targets Flash Player using Haxe, you can use NME to deploy to all these targets with no modification to your code.

clemos··on Try Haxe
http://try.haxe.org/#655c1

You can compile this example to both Flash and JS online.

If you install Haxe and NME (http://haxenme.org), you can also compile it to iOS, Android, WebOS, BlackBerry, as well as desktop Mac, Windows and Linux binaries.

And these are only the possibilites offered by NME, which is basically a Haxe-based Flash API implementation.

clemos··on Try Haxe
Ok, ok, I switched back to monospace...
clemos··on Try Haxe
It has very powerful type-inference, which usually makes it far more concise and expressive than Java or AS3...

It may still be a bit more verbose than Coffeescript or Python, but once your code is written you can theorically run it almost anywhere :)

clemos··on Try Haxe
http://haxe.org/ref/conditionals

Most standard classes and methods (String, Array, Hash, etc), and a lot of third party libraries are completely cross-platform, so you don't need conditional compilation.

Usually you use conditional compilation either for very low-level per-platform operations / optimizations, or to switch, say, between client code and server code, like here for instance:

https://github.com/clemos/try-haxe/blob/master/src/App.hx

clemos··on Try Haxe
... and the editor has autocompletion on dot :)
clemos··on Try Haxe
demos :

Flash API to SWF or JS (nme/jeash):

http://try.haxe.org/#655c1

http://try.haxe.org/#E4001

Flash with custom shaders (hxsl):

http://try.haxe.org/#93bE1

Flash + away3d:

http://try.haxe.org/#9F075