libgdx | Desktop/Android/HTML5/iOS Java game development framework | Game Engine library

 by   libgdx Java Version: 1.11.0 License: Apache-2.0

kandi X-RAY | libgdx Summary

kandi X-RAY | libgdx Summary

libgdx is a Java library typically used in Telecommunications, Media, Media, Entertainment, Gaming, Game Engine applications. libgdx has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.

As we use Gradle, there's no need to download libGDX itself – this can all be done by your favorite build tool. We also offer a setup tool, which automatically creates a project for you and downloads everything necessary. See our website for instructions on how to get started with this or read our wiki. We also provide javadocs online. The javadocs are bundled with every libGDX distribution for consumption in your favorite IDE.

            kandi-support Support

              libgdx has a highly active ecosystem.
              It has 21591 star(s) with 6411 fork(s). There are 1178 watchers for this library.
              It had no major release in the last 12 months.
              There are 206 open issues and 3405 have been closed. On average issues are closed in 81 days. There are 70 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of libgdx is 1.11.0

            kandi-Quality Quality

              libgdx has 0 bugs and 0 code smells.

            kandi-Security Security

              libgdx has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              libgdx code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              libgdx is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              libgdx releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              libgdx saves you 643162 person hours of effort in developing the same functionality from scratch.
              It has 307119 lines of code, 45294 functions and 2465 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed libgdx and discovered the below as its top functions. This is intended to give you an instant insight into libgdx implemented functionality, and help decide if they suit your requirements.
            • Merge two runs of runs .
            • This method is used to set the visibility of the UI view .
            • Initializes the FreeType library .
            • Formats a message with given pattern and arguments .
            • Get the local axis A .
            • called by uiceleration .
            • Called when a playback player has finished .
            • Returns true if the loop is looped .
            • Is the collision connected?
            • Sets the linear offset .
            Get all kandi verified functions for this library.

            libgdx Key Features

            No Key Features are available at this moment for libgdx.

            libgdx Examples and Code Snippets

            What does "Gdx" class do in libgdx?
            Lines of Code : 13dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            public class Gdx {
                public static Application app;
                public static Graphics graphics;
                public static Audio audio;
                public static Input input;
                public static Files files;
                public static Net net;
                public static GL20 gl;
            loop in GAMS for scenario generation in excel
            Lines of Code : 30dot img2License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            set i      / i1*i3 /
                j      / j1*j4 /
                sheets / Sheet1*Sheet3 /;
            parameter data(i,j);
            file fx; put fx;
            * To make this example self contained, first prepare some data (using same mechanics as the reading)
            * Create rand
            copy iconCopy
            /** Environment class holding references to the {@link Application}, {@link Graphics}, {@link Audio}, {@link Files} and
             * {@link Input} instances. The references are held in public static fields which allows static access to all sub syste
            Display a GoogleMap as Fragment inside of a libgdx Game
            Javadot img4Lines of Code : 24dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            public interface MapsInterface {
                void openMaps();
             public class AndroidLauncher extends AndroidApplication implements MapsInterface{
                MyGdxGame gdx;
                AndroidApplicationConfiguration cfg;
            Write XML string directly to XML file with VBScript
            Lines of Code : 62dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            Option Explicit
            Function fnRepl(sM, nP, sS)
              fnRepl = gdX(sM)
            End Function
            Function mkDic(aK, aV)
              Dim tmp : Set tmp = CreateObject("Scripting.Dictionary")
              Dim i
              For i = 0 To UBound(aK)
                  tmp(aK(i)) = aV(i)
              Set mkDic =

            Community Discussions


            How can I use the Android String Translation in a LibGDX Project?
            Asked 2022-Mar-23 at 23:10

            I'm trying to use the Android String Resources for an LibGDX Project.

            Unfortunately, I can only access the getString()-Method and the R class from the android package.

            What can I do to access them from also the core package?

            Or is it even better to use another solution for translation files?



            Answered 2022-Mar-23 at 23:10

            Three different paths you can take:

            1. Merge your core module code into the android module and simply don't use core. The downside with doing this is you will lose the ability to easily test on your desktop (it's faster to compile a desktop build for rapidly testing code changes), and you lose the ability to port to other platforms like desktop and iOS.

            2. Use libGDX's localization classes to manage your strings in different languages, instead of Android resources. There are instructions on how to use it here. This is the easiest solution, and it keeps it cross-platform.

            3. Maybe you could write some kind of Gradle task that extracts your String IDs from the generated R class each time you build your Android module, and makes copies of them available in a Java class in your core module, and uses them to retrieve Strings from the XML through some kind of interface. This is the super difficult solution.



            Noob question using legacy LWJGL with canvas
            Asked 2022-Mar-23 at 00:25

            Just installed libGDX & android studio yesterday. My boss wants to use libGDX & javaFX (for UI) together in a project.

            My assumptions: It sounds like I can do that by using a canvas. LWJGL3 does not support a canvas backend. So i need to use the legacy LWJGL2

            My question: How in an existing project do I add legacy support and the libraries?

            My current compile is failing with: error: package com.badlogic.gdx.backends.lwjgl does not exist import com.badlogic.gdx.backends.lwjgl.LwjglAWTCanvas



            Answered 2022-Mar-23 at 00:25

            There are instructions here for migrating from lwjgl2 to lwjgl3, so you can follow them in reverse.

            Basically, change your module's dependency from com.badlogicgames.gdx:gdx-backend-lwjgl3 to com.badlogicgames.gdx:gdx-backend-lwjgl and change your launcher class to use LwjglApplication instead of Lwjgl3Application. The associated application configuration class works a bit differently, too. It uses public fields instead of setter methods.



            How to separate ads View from Game View?
            Asked 2022-Jan-30 at 14:01

            Currently I have a game in libgdx that show ads on top of the game layout. However, as you can notice, it hides part of the top of the screen, where the score is shown.

            Question: How can I make the ads show ABOVE the game view/screen, so it doesnt overlap/hides anything from the game? I want the screens to be as shown in the next picture.

            Current code:



            Answered 2022-Jan-24 at 13:01

            To avoid this overlapping effect using a RelativeLayout you can create an Ad Container (eg: a RelativeLayout Container) to be on the top of the screen by using the RelativeLayout.ALIGN_PARENT_TOP rule and add the GameView below of the Ad Container using the RelativeLayout.BELOW rule. Finally add your AdView as a child of the above Ad Container.

            Below is an example of how you can do the above structure:



            Removing the proxy and host from Netbeans
            Asked 2022-Jan-12 at 09:52

            I know this questions is not related to programming but I can't find the root problem of my proxy/host.

            Ok, let me explain, I am in China, so I have to make use of a VPN. The software is called SSTap and because of that reason I called the host in the same way.

            For the project I am trying to make I am using LibGDX and gradle ofc.

            After not being able to settle a proxy I removed it, as shown in the picture it is selected as "no proxy" and there are no proxy settings, and down in the output I am getting the warning.

            Is there another place to totally remove the host?

            I am using "Product Version: Apache NetBeans IDE 12.3"

            Thanks in advance I will write down more questions

            ReEdit part:

            Sorry I thought it was loaded

            The warning is: Warning: Failed to parse host SSTap

            The way I configure the host/proxy was in a pop-up window that have not appeared anymore and I am unable to find it after setting the host again, the only way that I know to see the host is by Tools -> Options -> General Tab, the picture is not complete but that is the path to get there

            I am having difficulties to load the picture, I am in China and I am using a VPN, so it is quite hard to visualize it, since I created the account yesterday I am unable to post pictures and instead they are added by links automatically


            enter image description here

            enter image description here



            Answered 2022-Jan-12 at 09:52

            I went into my file found in C:\Users\User. gradle inside looks like this:



            Event handling in libgdx not working as expected
            Asked 2022-Jan-11 at 06:29

            I've been learning about libgdx recently. In the process of following the instructions on their libgdx wiki I ran into some problems.

            Specifically in the GameScreen class at the 99th line I changed the code inside so that it goes back to the previous screen (MainMenuScreen class) and yes you see when the mouse is pressed it worked (I mean go back to the screen before ) but a very very short time after, the screen AUTOMATICALLY switches to the GameScreen class (like I click the mouse once but it makes me 1 more redundant task). I guess when I click on the GameScreen screen it did the code in the if statement on line 99 to go to MainMenuScreen screen. In that screen at line 32 I guess it was true after I got to this screen because when I change the key is listened then it works fine (only converts once). I was intending to try implementing InputProcessor on each screen class but now I'm avoiding it for some reason. Can someone give me some advice recommend.Thank you

            Here is the source code for the MainMenuScreen class.



            Answered 2022-Jan-11 at 06:29

            Your analysis of the problem seems correct to me. The method Gdx.input.isTouched() will immediately return true, if the screen is still being touched after you changed to the main menu.

            Also you the solution that you already tried seems correct:

            I was intending to try implementing InputProcessor on each screen class

            When using an InputProcessor you will get one event (the method call to touchDown or touchUp) when the screen is touched, and don't need to pull the touch event using the isTouched method.

            A problem when implementing InputProcessor with both classes probably is, that you can only set one to be the input processor of the game using the method Gdx.input.setInputProcessor. (When setting the second input processor, the first one is removed).
            A solution to this problem is the InputMultiplexer. You can add this multiplexer as the input processor of the game (using Gdx.input.setInputProcessor(multiplexer)) and then add your input processors (the main menu and game objects) to this multiplexer: multiplexer.addProcessor(mainMenu) or ((InputMultiplexer) Gdx.input.getInputProcessor()).addProcessor(game).

            This way you can handle touch events instead of pulling the touched state in both of your classes.



            Libgdx Rendering Bitmap font to pixmap texture causes extremely slow rendering
            Asked 2021-Dec-09 at 16:16

            I'm using libgdx scene2d to render 2d actors. Some of these actors originally included scene2d Label actors for rendering static text. The Labels work fine but drawing ~20 of them on the screen at once drops the frame rate by 10-15 frames, resulting in noticeably poor rendering while dragging.

            I'm attempting to avoid the Labels by pre-drawing the text to textures, and rendering the textures as scene2d Image actors. I'm creating the texture using the code below:



            Answered 2021-Dec-09 at 16:16

            I have not tested this, but I think you can enable culling for the whole Stage by setting its root view to use a cullingArea matching the world width and height of the viewport. I would do this in resize after updating the Stage Viewport just in case the update affects the world width and height of the viewport.



            LibGDX / OpenGL Stencil Buffer masking not working
            Asked 2021-Dec-01 at 12:31

            I'm using LibGDX to render 2d fog-of-war type functionality. This involves drawing a dark rectangle over the entire map with transparent holes in it where you can see the map below. I'm attempting to use OpenGl stencil buffer to create the circular masks, but I can't seem to get the logic correct.

            The code below correctly draws the dark rectangle (the fog) but the circular masks are not being stenciled. i.e. the entire map is dark.



            Answered 2021-Nov-29 at 17:54

            One way you can achieve a fog-of-war effect is by keeping a Framebuffer that you write transparent pixels to, and then draw that buffer ontop of your game view:

            The steps are more or less:

            1. Draw game

            2. Update fog-of-war buffer

            3. Draw fog-of-war ontop of the game



            Scala with LibGDX outputs error when creating Animation
            Asked 2021-Nov-28 at 15:39

            I am starting programming with Scala and I decided to make a really simple game using libgdx. I have created this class:



            Answered 2021-Nov-28 at 15:39

            Yes, Scala compiler is quite confused here, because the constructor want a gdx array, not a Java array (look at the documentation). A possible workaround could be in using var arg syntax:



            LibGDX cant find .tsx file
            Asked 2021-Oct-26 at 04:17

            Does anyone know why libGdx can't find the .tsx file? I have have tmx tsx and png in the assets folder under the core folder. In the tmx file, I have the source set to the file path for the tsx file. I made the tsx and tmx file with Tiled if that helps.

            Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: Maps in use\tileset_gutter.tsx (Internal)



            Answered 2021-Oct-26 at 04:17

            If you don't qualify the file reference then it assumes the root folder to be assets in the android project as works with everything.

            Howeover, you can get the FileHandle of files in the core project with Gdx.files.internal("data/... . (where data is a folder in core/assets which should be where yours are)

            You can switch between how TmxMapLoader resolves the files, to delegate the FileResolver of TmxMapLoader to this internal handler would be.

            new TmxMapHolder(new InternalFileHandleResolver()) which delegates to the internal storage location.




            Plugin with id 'org.wisepersist.gradle' not found
            Asked 2021-Sep-10 at 02:31

            I've been following along with the libGDX docs and I'm very new to Gradle and I almost know nothing about it and I ran into a problem that I couldn't fix. I tried fixing the not found problem by applying the plugin and adding classpath to it but it didn't work. Is there any way I can fix it? (Note: the problem is in html/build.gradle)

            OS: Win64
            IDE: Android Studio

            Errors: Caused by: org.gradle.api.plugins.UnknownPluginException: Plugin with id 'org.wisepersist.gradle.plugins.get.GwtSuperDev' not found. (This is when I added the plugin) Plugin with id 'org.wisepersist.gradle.plugins.get.GwtSuperDev' not found.




            Answered 2021-Sep-10 at 02:31

            I think you're using the plugin mentioned here

            So you must ensure you copy everything under the correct section like so

            Note all the blocks including the apply plugin should be copied


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install libgdx

            You can download it from GitHub, Maven.
            You can use libgdx like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the libgdx component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer For Gradle installation, please refer .


            As we use Gradle, there's no need to download libGDX itself – this can all be done by your favorite build tool. We also offer a setup tool, which automatically creates a project for you and downloads everything necessary. See our website for instructions on how to get started with this or read our wiki. We also provide javadocs online. The javadocs are bundled with every libGDX distribution for consumption in your favorite IDE.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone libgdx/libgdx

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link