Native Code Block [Jon]

Jon

  • *
  • Posts: 17533
A very magical and dangerous block that lets you embed a target platform's native code.

- Embed JavaScript for the HTML5 target using:

untyped __js__ ("blah blah blah");

- Embed C++ for the desktop and mobile targets. Will even have a variant that lets you add additional imports if you need to do those.

http://www.joshuagranick.com/blog/2012/09/14/adding-inline-cpp-to-haxe-code/

There's no point to embedding AS3 since HaXe's syntax is mostly the same and NME already implements the Flash API for us.

JensWinterstein

  • *
  • Posts: 433
Brilliant :) A minute before I saw this, I was to start a thread asking about howto add Obj-C code.
Get 100 Chambers for Android / iOS
Get Cubus Velox for Android / iOS or play it on Flash

- Portfolio

Future Freak

  • Posts: 413
So does this mean that we'd be able to easily use the google analytics SDK for iOs and Android?

JensWinterstein

  • *
  • Posts: 433
Any ETA on this? It's one of the last missing puzzle pieces for my game's conversion to 3.0.
This is also one of the features that sets Stencyl apart from GameMaker.

« Last Edit: October 11, 2012, 04:44:35 am by JensWinterstein »
Get 100 Chambers for Android / iOS
Get Cubus Velox for Android / iOS or play it on Flash

- Portfolio

Jon

  • *
  • Posts: 17533
You can already mimic it through what I said in the first post. I don't think you can embed Objective-C since that's not the exported language that Haxe converts to (it's C++) - you can only link in Objective-C via extensions.

JensWinterstein

  • *
  • Posts: 433
You can already mimic it through what I said in the first post. I don't think you can embed Objective-C since that's not the exported language that Haxe converts to (it's C++) - you can only link in Objective-C via extensions.

Thanks for clarifying. I hoped for a fancy "just throw it in"-block, but that's also fine.
Get 100 Chambers for Android / iOS
Get Cubus Velox for Android / iOS or play it on Flash

- Portfolio