New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example project #1
Comments
I still have to create a Gradle plugin: I will try to create it this week: jtransc/jtransc#36 Right now the supported way for building is maven. You can find information here: https://github.com/jtransc/jtransc/wiki/Available-Maven-Options There is a Note: right now, Javascript target fully works, but C++ target seems to be working, but doesn't display anything, just shows glClear. I'm going to try to fix that ASAP too. And yes. Java reflection works everywhere including Javascript. The default behaviour is to include reflection information for everything, but you can opt-out per class and per member. ( https://github.com/jtransc/jtransc/wiki/JTransc-Annotations#general |
Gradle plugin would certainly be appreciated, as LibGDX setup tool generates Gradle-based projects. Using Maven seems like a huge step backwards, so I can imagine people (including myself, to be honest) would be reluctant to switch from Gradle. JTransc (is that how you should write that?) seems like a great alternative to GWT and I'd like to include it in our alternative gdx-setup tool. It would be nice if you ran some benchmarks - I'm really curious about the performance. If Haxe/Lime turns out to be faster than Java, maybe we could let go of some official platforms in our new projects. How's the native APIs interface though - can you easily access native methods on Android, iOS and HTML5? What about Windows Phone? I know that people tried to use GWT platform to generate Windows Phone apps, but its WebGL implementation seems to be problematic. If Lime supports Windows Phone, this would potentially be the best way of creating Windows Phone apps with LibGDX. |
Great. I'm working on the gradle plugin already and then I will check the C++ black screen. Yep I usually write JTransc or just jtransc that is ok too. I didn't know about the gdx-setup alternative. I will check it! Regarding to performance: Regarding to native interoperability. You can add include and call C/Objective-C files: For native android or ios: you can also include Haxe code and use cooked haxe libraries. For example a facebook library for android and ios. Or use lime-provided JNI calls: You can also use JNA for desktop and node.js (not tested on mobile): https://github.com/jtransc/jtransc-examples/blob/master/ffi/src/main/java/BeepExample.java The idea is to support native calls just with annotations similar to JNA or how C# works. But it is still not the case. |
Looking great so far. I'm eager to check it out with my existing LibGDX projects. Let me know when you're done with the Gradle plugin and a (somewhat) stable version is uploaded, so I can include it in gdx-setup. |
I have already added gradle support: Still not checked the black screen part. Going to do that now. I do not have too much experience on gradle, so if you can provide feedback about it. It would be great. The approach I followed: A plugin: apply plugin: "jtransc"
buildscript { dependencies { classpath "com.jtransc:jtransc-gradle-plugin:0.2.5" } } The plugin requires applying "java" and "application" plugin. jtransc {
minimizedNames = true
} There are a couple of generic build tasks "JTransBuildTask" and "JTransBuildAndRunTask" for building and building and running. So you can do this (and necessary since JTransc support arbitrary targets that can be defined later): task windows(type: JTransBuildTask) {
target = "haxe:cpp"
outputFile = "program.exe"
minimizedNames = false
}
task runWindows(type: JTransBuildAndRunTask) {
target = "haxe:cpp"
outputFile = "program.exe"
minimizedNames = false
} I have defined some generic tasks: Then for running: What do you think about it? Good enough for you? Any feedback about this? |
I suggest refactoring I think there's a typo:
Other than that, I don't really have time to look through your plugin code, but the public API looks OK. Would be nice if you made a similar wiki page on this repository and basically excluded the tasks and fields that don't really affect LibGDX applications and are specific to JTransc in general. For example, I don't imagine LibGDX can be run using PHP. (Can it though?) As for Either you overlooked my question or I missed your answer - what about Windows Phone? Is it supported? |
Float.floatToIntBits was optimized wrong just when targetting C++ (and sadly C++ target is not being tested on travis so never noticed) #34 jtransc/gdx-backend-jtransc#1
Fixed black screen too on C++. Also, did the refactoring you said. This should work on the cuboc demo.
runXXX generate debug builds by default runHtml5 says that it has failed, but should generate Haxe C++ debug builds are slow as hell, and it is known. Release builds are much faster. I was able to generate cuboc for javascript, windows and android sucessfully with the gradle plugin. Please, test it and provide feedback, PRs are welcome too. |
I'll try including JTransc backend in gdx-setup ASAP and run our project templates. |
I suggest focusing on platforms that are somehow flawed or unavailable for LibGDX. Being able to compile your Java application to native code on desktop is a nice touch, but it also adds another layer of complexity - and all this for something that we already have. 2D games - at with LibGDX is arguably the best - are already blazing fast on desktop, so I'm not sure if a new platform is really needed there. Especially since you can use Kotlin (and so on) there without any problems. Anyway, I don't think Flash matters anymore, but being able to use different JVM languages and reflection, and yet still target JS/HTML5 seems amazing. On the other hand, from what I can see Android applications are already pretty easy to port to Tizen, so there's not much incentive there. To be honest, I would personally use JTransc only for WebGL and maybe the iOS platforms (because of the whole mess with RoboVM). Being able to create LibGDX applications for Windows Phone would certainly bring you a lot of users. I know it's most likely too late to switch Haxe framework now, but is there any possibility that JTransc could target additional platforms? |
As for the example project - I tried running it, but I keep on getting this error:
Should the jar be on Maven Central or should I add some other repository? That's kind of weird error, as Gradle seems to keep its own dependencies in another folder and does not rely on Maven cache. Are you sure you don't reference it directly somehow? (And yes, this error appears when trying to run other tasks as well.) Or maybe should I go through some setup before using JTransc? Anyway, Gradle script does not work in its current state because of this line: https://github.com/jtransc/gdx-backend-jtransc/blob/master/cuboc-demo/build.gradle#L24
Maybe I should have started with this - what exactly do I need to start using JTransc? Haxe, some Lime dependencies? A short tutorial with some links where to download what should be great. |
First part: We are still using flash. And we need it to be able to do some integrations with legacy code. It would be great if flash was dead, but that's not actually the case. Also there is Adobe AIR. Though Actionscript3 is pretty bad, not not the case if using haxe or a jvm language. Lime started to do some tests with angle for WP: https://github.com/openfl/lime/wiki/Windows#future There is also kha for haxe: http://kha.tech/ Now I want to focus on ensure things are working and optimizing. Second: Sh** I forgot that jtransc tries to get the RT from local maven repository (and the maven plugin ensures it download it). In gradle I should tell it to download it from mavenCentral and get rt and core jar paths. Do you know how to do that? I will try to test it on travis to avoid problems on clean machines. Since I have it installed on my local maven repository it worked for me. I will follow the gradle.properties indications. |
Try to fix gradle downloading and using jtransc-rt and jtransc-rt-core
It should be fixed already jtransc/jtransc@4ee667d . Tomorrow I will release 0.2.7 so you can test it again. |
I have released 0.2.7 version. That includes gradle fixes + #2 It will be available soon in central: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22gdx-backend-jtransc%22 Please, can you try Also note that right now jtransc requires haxe to be previously installed. In next versions I will try to download it if not installed. Please, let me know if you find any additional issues with gradle. Since just tested on my machine. Also not implemented the whole GDX stuff yet, so test other demos/games and report any issues. |
I have fixed lots of things. And I have created several gradle examples:
spine demo: |
Also I have created a git repository with binary examples: https://github.com/jtransc/jtransc-examples-binaries So you can see: |
It would be great if LibGDX was transpiled to Haxe/Kha and run on pretty much anything there is, but I understand that's a lot of work. I'll look into the examples today. |
The "problem" with kha is that it is platform agnostic, while libgdx depends on a opengl-like api to be available. And specific -> platform-agnostic is hard. The other approach is to emulate shaders and have a state-machine, like I'm going to try here: #3 That could work. Also having a pure-java parser for GLSL would allow me to target to flash or even to kha/directx. Maybe there is already a lighweight GLSL pure-java parser out there? BTW: |
I have installed Haxe. I'm trying to run the Cuboc example and I'm still getting some errors.
Most tasks print these warnings:
I did, however, managed to run the JS/HTML5 version with |
haxelib install hxcpp Another commands if required: haxelib run lime setup windows I will embed haxe in futuree versions |
(I'm not using Windows, |
OK, after installing the additional dependencies, the As a complete Haxe/Lime newbie, I'd appreciate a simple tutorial showing you how to set up your environment and how to compile your application to each platform. Do I need a Windows build slave to target Windows? Is Mac required to target iOS? How to run and test Android application? These kind of questions might seem obvious to you, but as a new user I honestly wouldn't even know where to start - a wiki page would be appreciated and would certainly help current LibGDX devs to use your backend. EDIT: Anyway, now that I think about it, every supported platform should come with a tutorial describing these things:
(* - examples might be incorrect or outdated.) It think you should answer these questions for Windows, Linux, Mac, Android, iOS, JS/HTML5 and Tizen. Code samples, links and screenshots are most welcome. |
I'm not setting icon correctly, so that's expected. PHP target is not intended to be used with gdx-backend, but plain console apps not using gdx-backend-jtransc. gdx-backend-jtransc uses lime. The same goes for flash. lime available targets: (
They all should work but flash one, that doesn't support opengl and will require a special treatment. Regarding to tutorial I'll add a wiki page. For now: You have to install haxe from http://haxe.org/ Haxe 3.2.1 should mostly do the work. Haxe has two relevant commands: So for setup to use with lime: you have to install haxe, and probably haxelib install hxcpp. Generally you would need to install lime too, but it is installed automatically because of this annotation: https://github.com/jtransc/gdx-backend-jtransc/blob/master/gdx-backend-jtransc/src/com/jtransc/media/limelibgdx/LimeApplication.java#L50 Lime itself require a small setup per platform (except, again, for javascript). It has to download the official platform SDK if not installed already and uses the C++ toolchain. Haxe is the one that transforms Haxe code into C++, but lime is in charge of compiling and linking that C++ code, and it does it using the proper C++ toolchain that you are required to have installed. Lime requires a That information from the xml is used to generate required project files on Android, iOS etc.
So yes, it is required to have a mac with xcode to compile mac/ios or a windows machine to compile the right stuff. Though probably you could use wine or something like that for windows. You could also generate a flash SWF, and then use Adobe AIR to generate a iOS application in a linux or window machine. But SWF is not supported with gdx-backend-jtransc right now. But we have tried with jtransc-media that supports flash target, and the adobe air approach works. But again it doesn't have the Gdx API, so no luck here. |
I think you should create GitHub issues for missing features. I went through some |
Sure. I have created this issue: Feel free to add issues for things you know that are missing. |
Running multiple LibGDX example projects would certainly be a start, although as far as automated tests go, it's hard to implement unit tests for graphical applications. Sometimes you need an actual human to see the subtle differences and graphical bugs on each platform. I suggest running these. As far as issues go, I'd probably have to go through the whole codebase to point each feature that seems to be missing and currently I don't feel comfortable enough with Haxe/Lime to judge your code. ;) I can only point out some simple (missing) features that I noticed - I can create a similar issue to the one you posted discussing |
What's the difference between I'm unable to run Tizen-related tasks. I installed Tizen SDK and run
Is there some additional setup? About the Android
Oh, well... (I know, I should have checked which version to target. I'm rerunning the task with 23 API set in manifest, but it still shouldn't take THAT long.) |
I keep on getting this error on Android, even though I changed the targeted version in
I think you're using a fixed Android API version somewhere. |
It would be great if you provided some documentation and an example project using Gradle. I'm curious if you can just include another backend to an existing LibGDX application and run it out of the box. A Gradle script/plugin with multiple prepared tasks (
runDesktop
,distDesktop
,runHtml
, etc.) would be nice.May I ask if Java reflection API is supported on every platform, including JavaScript/HTML5? This is necessary for multiple libraries and LibGDX functionalities to work properly.
The text was updated successfully, but these errors were encountered: