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
12
votes
2 answers

(Java LibGDX) How do I resize my textures in LibGDX?

I have been fooling around with LibGDX for a while now, and wanted to easily port my programs to different systems. I have a background texture, which I want to scale to the currently used resolution. The image is 1920x1080, how do I change it to…
user2445723
  • 123
  • 1
  • 1
  • 6
12
votes
3 answers

LibGDX is there an actor that is animated?

In LibGDX Is there an actor that is animated (takes an Animation) and when added to a Stage animates itself or do you have to implement your own Image class in and animate it yourself?
Lokiare
  • 1,238
  • 1
  • 15
  • 23
12
votes
1 answer

LibGDX and ScrollPane with multiple widgets

Trying to add multiple items to a scrollpane I quickly found that all "addActor" functions are Unsupported. So, I went with adding a table with all the items I wanted (this code misses a image that I still want to add) to make a scrollable credits…
efaj
  • 925
  • 1
  • 12
  • 23
12
votes
5 answers

Libgdx - How to draw filled rectangle in the right place in scene2d?

I am using scene2d. Here is my code: group.addActor(new Actor() { @Override public Actor hit(float arg0, float arg1) { return null; } @Override public void draw(SpriteBatch batch, float arg1) { batch.end(); …
Aleksandrs
  • 1,488
  • 1
  • 14
  • 34
12
votes
1 answer

How to handle input for an on-screen gui (for pause button) in Android?

I'm working on game made with libgdx that needs some GUI above my game screen. Something like FrameLayout in Android. I have GameScreen where everything is happening. What I want now is to add a "pause" button, highscore information etc. I've tried…
Veljko
  • 1,893
  • 6
  • 28
  • 58
12
votes
2 answers

LibGDX - Get Swipe Up or swipe right etc.?

touch area http://imageshack.us/a/img836/2909/swipe1.png In the green area the user can swipe up, right, down, left. How can I now get e.g. swipe Up? or swipe Down? or swipe right or swipe left? e.g. how to get a String -> input = getSwiped(); ->…
Johnny
  • 612
  • 3
  • 13
  • 32
12
votes
3 answers

LibGdx How to Scroll using OrthographicCamera?

I have been looking for 10 hours (literally) and I'm done, I need to ask. Thing is I'm learning How use LibGdx to program Java games. I'm doing a Horizontal Space Ship Game. So, my worst problem here is that I do not know how do scroll (I think…
MBRebaque
  • 359
  • 2
  • 5
  • 14
12
votes
2 answers

how to flip a pixmap to draw to a texture in libgdx?

So what I'm trying to do is to generate a background image for my game by drawing pixmaps to a texture. So far I can do that, but now I need to draw the pixmaps flipped in the X or Y axis to the texture. However I can't find anything to do so. The…
Leonso Medina Lopez
  • 777
  • 1
  • 10
  • 21
12
votes
1 answer

How to properly load textures using the libgdx assetmanager

Is this how one properly loads a texture into an AssetManager? Texture tex; AssetManager manager = new AssetManager(); manager.load("menu/bg.png",Texture.class); tex = manager.get("menu/bg.png",Texture.class); The texture fails to load with error…
J.Praveen Benjamin
  • 141
  • 1
  • 1
  • 7
11
votes
1 answer

OpenGL 2D polygonal shape drawing and manipulation?

I'm working on a 2D game project where I am expecting users to draw 2D polygons (closed path) such as: Possible Solutions: 1 - Draw by Points and Calculate Border Lines. 1 Problem - Calculation of Border Lines. 2 - Start with an ellipse and let the…
Max Abrahamsson
  • 1,460
  • 3
  • 17
  • 35
11
votes
1 answer

Using SQLite from libGDX on Android

Does anyone have any tips on storing data from libGDX on Android in SQLite. I am very familiar with the techniques used in the Android SDK but I don't have any idea how to call those Android database functions from libGDX. I know that calling the…
Alex_Hyzer_Kenoyer
  • 1,321
  • 4
  • 17
  • 23
11
votes
7 answers

Cocos2D OR libgdx for Android Game Development

I just want to know, that in the long run, using which of these engines will be better. Although I feel that using Cocos2D will be a better option, as it can also be used for iphone development, there's just 1 tutorial…
Saurabh Verma
  • 6,328
  • 12
  • 52
  • 84
11
votes
3 answers

How to draw Button class in libgdx

I know that libgdx has this Button class that seems so easy to use, but I wonder why the draw method is set protected? In that case, how should I draw the button? Scene2d Button
Fugogugo
  • 4,460
  • 10
  • 36
  • 50
11
votes
4 answers

How to move a sprite with the keyboard keys using libGDX?

i have just started using java and libgdx and have this code, very simply it prints a sprite onto the screen. This works perfectly, and i learnt a lot from it. package com.MarioGame; import com.badlogic.gdx.ApplicationListener; import…
dotty
  • 40,405
  • 66
  • 150
  • 195
11
votes
1 answer

How to synchronize Play Services Real Time Multiplayer

I am developing an online version of the popular game Pong using Libgdx. I've started using Google's Realtime Multiplayer service to send the game data between players, but I can't figure out how to resolve the synchronization problem I am…
Enpi
  • 281
  • 1
  • 9