How to import Tiled in Android ( no engine)?

i want import tiled map in my android project ( don’t use engine same Andengine,libgdx). How can i do it?

help me. please

You can find some Java source code for reading and rendering Tiled maps here:

http://doc.mapeditor.org/reference/support-for-tmx-maps/#java

Note though, that these libraries are out of date. They may work for you, but it is also likely that you will run into minor issues and missing functionality. You’d then have to either write your own map reader and renderer or adjust the code as necessary. See also the documentation of the TMX map format.

I used a modified version of http://chiselapp.com/user/devnewton/repository/libtiled-android/index. The code is not quite right for modern versions of Android, so needed some tweaking. Also there is no hex renderer so I’m writing my own.

I’ve been pondering whether to clean up my changes and do a PR back to the @bjorn repo, though it would have to include making the resources generic, as the Android and Swing ones don’t play well with each other.

Any help in making the libtiled-java shipping with Tiled more useful would be very appreciated. How would it work to make the resources more generic?

thanks verymuch

It would mean wrapping the Android Bitmap and AWT Image/BufferedImage references with a generic image interface.

Then probably creating an abstract factory to load these from streams and/or paths. Maybe with some generics thrown in to make it nicer to work with.

Then to implement bindings to another platform, you would (hopefully) just need to implement a new factory. Though this is just the basic idea…

Hmm, maybe it would be better to extract the image loading and rendering parts out of the library, and leave those to be implemented on the game engine side? We could show some example code to get people started instead.

I had a go at reworking it, and have the basics. Its not great.

There is a lot of coupling between the library and AWT. The MapObject code specifically uses AWT ellipse and some other stuff. The tile cutter does a bunch of AWT calls to implement transparency.

I’ve made all the references to Image generic, but its not a great way to do it. It would probably be better to separate out all the images and just hold an id reference to them in each Tile. The image management code in TileSet would be better somewhere else too.

Also any AWT specific code doesn’t compile in Android Studio :frowning:. Its probably the same for Android classes in other IDEs.

Right, sounds like taking the graphics stuff out rather than making it generic will be the easier and better way to go. There is no need for using some Ellipse class, the object just needs a ‘shape’ enumeration. The tile cutter could just be removed.

Of course, we do have the tmxviewer-java and other applications may find a use for the rendering parts, but they could be moved to a libtiled-swing library that depends on plain libtiled-java. Then, a libtiled-android (or maybe named after the Android base library it would use) could similarly be added.

Thanks for having a go at this, btw!

Hello. How to import AndroidTMX in android Studio?

Are you talking about Android-TMX-Loader? If so, please read their documentation and if you’re having trouble, try contacting its author. This library has not been updated in 4 years so it’s unlikely you’ll find help here.

Or maybe you need to ask people who know Android Studio.

The new Game Engine mode in Mintoris Basic Pro supports Tiled maps. Simple and rapid app development for Android.

Mintoris Basic Pro