Questions tagged [libgdx]

'libGDX' is an open-source cross-platform Java game development framework based on OpenGL (ES) that works on Windows, Linux, Mac OS X, Android, iOS and WebGL enabled browsers.

The libGDX project is a cross-platform (Windows, Mac OS X, Linux, Android, BlackBerry, HTML5, and iOS) game development library written in Java with some JNI code. It abstracts away the differences between the different platforms and enables easier development of OpenGL-based games on them.

'libGDX' is an open-source effort, started by Mario Zechner in late 2009/early 2010. In its original form it was an attempt at a rapid prototyping library which avoids the slow development cycle usually encountered when creating pure Android applications. The goal was to be able to work mostly on the desktop, and only deploy to the emulator/a device when absolutely necessary.

'libGDX' now is a multi-backend, cross-platform game development library which is not only targeting Android, but it can also be considered a viable framework for desktop applications (stand-alone, applets, and Web Start).

It includes a wrapper to work directly with (2D physics). And one for (3D physics).

Please note that there's a rich community on the official forum, and an official wiki.

The current stable version is 1.11.0, which was released in May 2022.

12609 questions
20
votes
3 answers

How to display text with two-color background?

I need to create an app for android, where the 2-color text will be displayed on the 2-color background. See picture on the left. Then, the line should be moved with animation and result image should be like on the picture on the right. I have the…
LA_
  • 19,823
  • 58
  • 172
  • 308
20
votes
6 answers

Unresolved reference: junit

I'm writing game using Kotlin and LibGDX framework. I'm new to testing. I have passed some basic tutorial how to create simple test. And how to configure gradle. I just clicked on class and choose create test. But, when i try to build project i get…
icarumbas
  • 1,777
  • 3
  • 17
  • 30
20
votes
4 answers

Scale a Bitmapfont in LibGDX

How can I scale a Bitmapfont object in LibGDX? It seems the method setScale is no longer available.
Pedro Romano Barbosa
  • 587
  • 3
  • 11
  • 29
20
votes
2 answers

How to set portrait mode with libGDX?

I've created a game, and it is OK in desktop mode, but when i launch it on my S3, it goes in landscape mode, how can i change it? Thank you in advance
DomeWTF
  • 2,342
  • 4
  • 33
  • 46
20
votes
1 answer

How to resize a sprite in Libgdx?

I have a problem with the method sprite.setSize(float x, float y) in Libgdx. It does not affect the size or the dimensions of the sprite. They remains fixed whatever I pass to the setSize() method. here is my code: public class GameScreen implements…
Wazani
  • 911
  • 1
  • 13
  • 28
20
votes
2 answers

How to set the application icon for a libGDX desktop application?

I am trying to setup an application icon from the -desktop specific class with: package org.osgameseed.games.animalflip; import com.badlogic.gdx.Files; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import…
João Pinto
  • 5,521
  • 5
  • 21
  • 35
20
votes
3 answers

Libgdx: Is there an easy way to center text on each axis on a button?

I have been trying to figure out a way to center text on a button, but can't find an easy, multi-purpose way to. I can do it, but it will only work for a certain string, not for any string. i would like to know if there is a way to center any string…
Sean Heiss
  • 780
  • 2
  • 9
  • 25
20
votes
4 answers

How to rotate an image actor in libgdx by the middle point?

If I understand correctly, LibGDX is rotating an image with the use of the addActions method: this.addAction( parallel(rotateBy(360, 0.5f), moveTo(320, 100, 0.5f))); The thing is, it is being rotated by the point=(0,0) of the image. Here's my…
Peter Poliwoda
  • 563
  • 2
  • 7
  • 19
19
votes
2 answers

Get cursor position in LIBGDX

How to get cursor position in libgdx and apply it to sprite? Like this? I want my sprite to have the direction pointed wherever my cursor is in the screen.I search libgdx examples but i cant find any examples related to that.
CodeAndWave
  • 1,586
  • 3
  • 23
  • 33
19
votes
3 answers

LibGdx - Transition between Screens

I'm trying to change the animation between Libgdx Screens. I want to write my custom animation (fade in, fade out, etc). Can someone give me a clue? I can't seem to find the implementation of the transition in the Libgdx code.
ruff1991
  • 803
  • 3
  • 9
  • 16
18
votes
9 answers

Could not find com.android.tools.build:gradle:2.2.2

A friend of mine copy pasted a libgdx project folder on his pc and sent the project to me(through google drive). We are both using Android Studio. I downloaded and imported the project and it is working properly on the emulator. However it is not…
WVrock
  • 1,725
  • 3
  • 22
  • 30
18
votes
3 answers

Error at building model of new Gradle project for libgdx

I installed Gradle in eclipse and want to import a libgdx Gradle project. But when i click on "Build Model" button, i have an error at about 50% of the loading bar. Here is the problem : > Plug-in: org.springsource.ide.eclipse.gradle.core Severity :…
Mieus
  • 306
  • 1
  • 3
  • 7
18
votes
2 answers

Using a SQLite database in Libgdx

I'm new in Libgdx and I'm getting trouble on using a database on my game. I searched for a tutorial on how to make SQLite work on both Android and Desktop applications using Libgdx but I didn't found a easy one. The last time I used a database in…
Cristiano Santos
  • 2,157
  • 2
  • 35
  • 53
18
votes
1 answer

Libgdx How to get a list of files in a directory?

So I am trying to get a list of files in a directory with a file handle.list() method but it returns an empty list even though there are files in the directory. What seems strange to me is that it does work on the device but it does not work on the…
Leonso Medina Lopez
  • 777
  • 1
  • 10
  • 21
18
votes
1 answer

Libgdx app.exit() on Android not closing application

In my Android app developed with libGDX I use Gdx.app.exit() when the user tries to exit the game. This closes the game, but when the user restarts the app all the Textures are scrambled (beyond the point of using the app). I noticed that if I force…
ruff1991
  • 803
  • 3
  • 9
  • 16