jeremyfa / bind

Bind Objective-C/Swift and Java/JNI code to Haxe without writing glue code manually.
58 stars 4 forks source link

Is it possible to use bind with Lime/OpenFL ? #7

Closed flashultra closed 5 years ago

flashultra commented 5 years ago

For Android bind generate java class bind_App<name>.java and Support.java and also cpp linc_App<name>.cpp with linc xml. In Lime toolchains java files are read from directory \templates\android\template\app\src\main\java\ . I tried to copy generated java bind classes to this directory but can't compile , because the main class AppAndroidInterface cannot be find. I'm not sure how can combine haxe, java and cpp in Lime toolchain. I think bind compiles haxe first to cpp and after that call cpp from java

I'm looking for clean way to write extensions ( at the moment for Lime) and bind looks like at he righst solution.

jeremyfa commented 5 years ago

Hi,

It is certainly possible to use bind with Lime/OpenFL, but there is probably some work needed to do the setup.

bind is an utility to generate bindings and all intermediate code, but it cannot integrate generated files to your lime/openfl android project by itself.

I didn't use lime/openfl for a long time, but you will probably need to find a way to make openfl add the java classes to the android project. That's probably something you can do on the project.xml file of an openfl/lime project I guess, or by creating a lime/openfl extension. If I had to do this, I would probably create a script that runs bind, and that then generates a lime/openfl extension on the fly that integrates generated files by bind

You can find an example of how bind is used inside my framework ceramic engine

I use the --json arg on the bind command to get file content as String, then the script saves the files at the correct locations for my framework.

Note that AppAndroidInterface.java is just an example of bound java file. The idea here is that binding Something.java will generate bind_Something.java, 'Something.haxe', and both files (+Support.java) need to be added to the android project then.

flashultra commented 5 years ago

Thank you for your answer. I''ll check Bind.hx from ceramic engine.