B4A Library libGDX - Game Engine



One of the best game engines for Android is now available to B4A users. Unleash your creativity!

You can read a description of this library in this guide.

Download for B4A v10.60 and older (4 MB)
Download for B4A v10.70 and newer (4 MB)

Starting from version 1.13, the library is compiled with Java 8, and thus requires a recent version of B4A and Java 8+.
To install the library, copy the .jar file and the .xml file in your libraries folder.

This library is not compatible with the Debug mode. Ensure that you always compile in Release mode.

Download also the examples and templates.

You can reduce the weight of the library if you want to keep your APK file as small as possible. Read this post to learn how to create your Lite version.

Tutorials:
How to make games
Introduction to the libGDX library
PacDroid: from scratch to fun
Shaders

Take also a look at the Cloney Bird tutorial by andymc.

Plugins:
Box2DLights
SpecialFX

Versions:
 
Last edited by a moderator:

melonZgz

Active Member
Licensed User
Longtime User
Hello.
I have a problem with a tmx map with animated tiles.
Using the example provided "map_tIDE", but loading a tmx file (I don't have tide installed...) I see the animated tiles.
But if instead of doing renderer.render I render the layers one by one I don't see the animation:
B4X:
    Camera.Update
    renderer.SetCameraView(Camera)

    renderer.SpriteBatch.Begin
    renderer.renderTileLayer(layer)
    renderer.SpriteBatch.End
This way it renders the layer, but the tiles wich are supposed to have an animation are static in their first frame.
Thank you.
 

Informatix

Expert
Licensed User
Longtime User
Use Render2 instead of RenderTileLayer.
 

ldhyob

Member
Licensed User
Longtime User
Informatix, how do you do? LibGDX's B4A library is great! Thank you so much for sharing!

But in the use of found a question need to report to you:

AssetManager seems to be under the high android version can not run normally, such as the android 7.1.1, would collapse, don't know is what reason, please Informatix experts to help solve, thank you!
 

Informatix

Expert
Licensed User
Longtime User
My only mean to test libGDX with Android v7.1 is Genymotion and I see nothing unusual with AssetManager. Could you elaborate? Do you have this issue with the AssetManager demo? Does anyone else have the same problem?
 

ldhyob

Member
Licensed User
Longtime User
My only mean to test libGDX with Android v7.1 is Genymotion and I see nothing unusual with AssetManager. Could you elaborate? Do you have this issue with the AssetManager demo? Does anyone else have the same problem?
Could you please tell me that the version of libGDX library you tested is 1.12? I am using the demo project that you released on the AssetManager demonstration project installed on Android v7.1.1, and the result, a run, will exit after the splash screen.
 

ldhyob

Member
Licensed User
Longtime User
Yes it is 1.12.
There's no splash screen in the AssetManager demo.
I made a few modifications to the demo project, and found that the resource loading in LG_Create event was no problem after the test run, but it was found that there was a problem of reading resources in LG_Render event. I will show the relevant screenshots, please give an analysis to the teacher of Informatix.
 

Informatix

Expert
Licensed User
Longtime User
You put the image to load in the loading queue, but you don't load it with Update, so the result is normal.
 

wonder

Expert
Licensed User
Longtime User
Hi!!

There seems to be a problem with the Gesture Detector after device rotation.
The LongPress event doesn't register anymore...

For testing, I added this line to the template (attached):
B4X:
Sub GD_LongPress(X As Float, Y As Float) As Boolean
    Log(DateTime.Time(DateTime.Now) & " GD_LongPress")
    Return False
End Sub

Could you please have a look? Many thanks in advance.
 

Attachments

  • LibGDX_LongPress.zip
    6.5 KB · Views: 247

wonder

Expert
Licensed User
Longtime User
Hello again!

I don't want to duplicate my thread in the questions sub-forum, but I'd still like to ask it here...

With regards to the CatMullRomSpline class, I would like to access the "derivativeAt" method. Is it doable with reflection and/or inline JAVA?

https://libgdx.badlogicgames.com/ci/nightlies/docs/api/com/badlogic/gdx/math/CatmullRomSpline.html

I'm looking forward into implementing the solution for this problem:
https://stackoverflow.com/questions/32665262/libgdx-path-catmullromspline-constant-speed

SOLVED: https://www.b4x.com/android/forum/threads/reflection-and-template-argument.106102/#post-664183
 
Last edited:

Informatix

Expert
Licensed User
Longtime User

This bug is fixed in the new version. There was a bug with objects (the Timer thread in this case) not disposed when the device is rotated.
 

wonder

Expert
Licensed User
Longtime User
This bug is fixed in the new version. There was a bug with objects (the Timer thread in this case) not disposed when the device is rotated.
Thank you so much Fred!!! I'll try the latest version as soon as I can!
 

Spright

Active Member
While creating a game using B4A and Libgdx Library, we faced a serious issue: the app crashes on newer phones when
using the recent button to exit. This problem is consistent even in basic library demos.
The error message "Waiting for pause synchronization took too long; assuming deadlock and killing" appears when using the
recent button in the navigation bar to exit the app.

The last known version that worked without any problems was Android API 28, but on newer versions around API 33, it breaks down.
The back and home buttons remain unaffected. You can even use the recent button to return to the app without any issue, but not leave the app using it.


As we would love to continue developing this game on B4A, there is now a bounty for anyone who can fix this.
https://www.b4x.com/android/forum/threads/bounty-update-libgdx-add-on-for-b4a.159003/

This thread discusses the Libgdx library, with apparent additional problems reported on certain models.
https://www.b4x.com/android/forum/threads/crashing-resume.158975/
 

walterf25

Expert
Licensed User
Longtime User
See my response and fix on the Job forum thread.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…