TmxMapLoader without libgdx - java

I'm developing my own game without any frameworks and engines (except JBox2D cause I have very big troubles w/ physics). I need to load .tmx file into my game. The only ready-to-use option was LibGDX with his TmxMapLoader. I added dependency to project, ran and got quite expected crash:
Attempt to invoke interface method 'com.badlogic.gdx.files.FileHandle com.badlogic.gdx.Files.internal(java.lang.String)' on a null object reference at com.badlogic.gdx.assets.loaders.resolvers.InternalFileHandleResolver.resolve(InternalFileHandleResolver.java:26)
What I supposed to do to load .tmx from assets using TmxMapLoader?
Probably the best solution would be porting game to LibGDX but I have no time and desire to study documentation and rework that I already have.

If you don't want to use LibGDX framework and its file module, I'd suggest simply going through TMX-related code and convert it the way you want it. LibGDX is open-sourced, after all. FileHandle is just a wrapper over File on most platforms, it should be straightforward to replace (or include in your project and used with File constructor). Java provides its own XML readers, so if it comes to that, you'll be able to replace any XML-related LibGDX code as well.
I'm afraid the default loader implementation loads textures as well, so without running an actual LibGDX application, it will not work. However, if you don't mind including LibGDX jars, you could try extending this class and removing all texture-related code or replacing it with your custom image-loading code.

Related

Is it advisable to create a seperate class for JavaFX UI building if done entirely through objects rather than FXML

I'm figuring out whether or not to build my application based on FXML or plain Java. This is because we are not allowed to use the scene builder.
So my problem is whether or not to use one class to build the entire UI through various methods rather than using multiple FXML Files.
If the class option is the best way then should I implement 1 UI Stage per class or all in one
I've used only FXML upto now but when i tried integrating JFoenix i realized that there was no FXML Code given so this was an issue for me
I advice you to use JavaFX even when you have to hardcode it because even then your Code will be simpler. Creating an own UI is very complex and nothing for beginners. It needs a team of pro devs to create something like JavaFX. Then in JavaFX all methods you could dream of are included. So if I were you i would use JavaFX because it is a good and existing way to do it.

Use JFrame (or external equivelant) on Android

I'm working on a small 2D tile-based game prototype for Android in Java. Unfortunately, I don't understand Android nearly as well as straight Java, and JFrame-based methods are perfect for what I'm trying to do. I've already done some research, and the general consensus is that it's impossible... But JFrame is exactly what I need. Is there any way at all to use it, or at least an external library that recreates it's functionality?
In a word -- no, you can't use any Swing component related classes whatsoever with your Android application as they are structured and rendered completely differently. You can only use your model classes if they are well behaved, and you'll of course have to learn the Android library/platform.

NullPointerException with a class using Gdx.files.internal() during test (maven version)

I've been trying for a while to get some JUnit tests to work in a project using the Maven version of Libgdx, but did not manage to succeed.
In my project I have a class that handles the audio for my game. For now the class is quite simple, and does not do much more than looking for an audio file in a folder, and playing it. I use the Gdx.app.internal() to get the file that I need, and it workd perfectly fine when running the game.
Now when I write a test file, which is in the root/core/target/test-classes/.... folder, the Gdx.app.internal() immediately throws an exception. When using FileHandle.exists(), it returns true when running from the game, but false when I run it from tests.
My guess is that it might have to do with some dependencies that Libgdx needs, and when running the game normally all is set for you. Thus I tried looking up some other topics that discuss this, but did not manage to find much information about it.
So to summarize my question: Is it allowed to call for Gdx.files.internal() in a JUnit test case? If not, what is the best way to go about testing classes in your Libgdx project?

use .obj file from blender 2.62+, in java with Eclipse for Android openGL ES

I have looked near and far for a solution to this problem. There seems to be ways to do this using a older version of Blender. I do not want to use an earlier version of Blender, I want to use 2.62.0 and above.
Basically I want to use Blender to create objects to use in my Android applications. I will be using openGL ES in Java. The easier to implement this the better, I am not trying to re-invent the wheel here.
Blend2Java does not work for Blender 2.5+
Java.net seems to be down for maintenance so I cannot find any Java3D resources that will assist
Other 3D Graphics software is just not up to par with Blender and I feel that other software will encounter similar issues
I have also tried min3D and that did not work for me either
An asset pipeline might be nice but at this point I will load image by image if I have to
Could someone please give me some options that will work with blender 2.62 or a run down of the steps that need to be taken to accomplish this. I have decent experience with Java but it is getting to the point where I can no longer keep my sanity.
Last but not least ...
Thank you all here on Stack Overflow and I hope for some good posts as future reference
Are you just looking for an obj loader for android? There are several mentioned here:
Android OpenGL .OBJ file loader

How to video out java through DVI/HDMI?

For a project I have to create a music visualizer in java (I've decided on using www.processing.org to create the visuals) and then output it using DVI/HDMI to a spartan-6 board. I haven't been able to find much out there.
I'm fairly early in the project so I could change from processing if needed.
AFAIK, the type of screen or whether you use VGA, DVI or HDMI makes no difference to Java. You need to configure these devices in the OS and Java will use them.

Categories

Resources