Make a game with libgdx offers a setup tool, which automatically creates a project và downloads everything necessary.

Bạn đang xem: Make a game with libgdx

Stable Release Nightly Version
Toggle Menu Getting Started Documentation Tools và Frameworks Contributing to lớn

Set Up a Dev Environment

Generate a Project

Importing và Running

A Simple Game

Open your commvà line tool, go to the tải về thư mục & run java -jar ./gdx-setup_lakiểm tra.jar

This will open the following setup that will allow you to lớn generate your project:


Note: Instead of the User Interface of the Setup Tool you can also use the command-line lớn create your project.

You are asked lớn provide the following parameters:

Name: the name of the application; lower case with minuses is usually a good idea, e.g. my-game Package: the Java package under which your code will reside, e.g. com.badngắn gọn xúc tích.mygame Game Class: the name of the main game Java class of your app, e.g. Mytrò chơi Destination: the thư mục where your ứng dụng will be created

Android SDK: the location of your Android SDK. With Android Studio, khổng lồ find out where it is, start Android Studio and click “Configure” -> “SDK Manager”. By mặc định it is in /Users/username/Library/Android/sdk


Sub Projects: is cross-platkhung. By mặc định, all the target platforms are included (Desktop; Android; iOS; HTML). There is no need to lớn change the mặc định value unless you are sure you will never compile for a specific target.

Note: iOS projects can only be compiled on macOS.

By clicking “Show Third Party Extensions” you can access the danh sách of community-made extensions.

Xem thêm: If You'Re Seeing This Message, That Means Javascript Has Been

When ready, clichồng “Generate”.

Note: You may get a message indicating that you have a more recent version of Android build tools or Android API than the recommended. This is not a blocking message và you may continue.

Project Layout

This will create a directory called mygame with the following layout:


What is Gradle? projects are Gradle projects, which makes managing dependencies & building considerably easier.

Gradle is a dependency management system and thus provides an easy way to pull in third-party libraries into your project, without having lớn manually download them. Instead, Gradle just needs you to lớn provide it with the names & versions of the libraries you want lớn include in your application. This is all done in the Gradle configuration files. Adding, removing & changing the version of a third-buổi tiệc nhỏ library is as easy as changing a few lines in that configuration file. The dependency management system will pull in the libraries you specified from a central repository (in our case Maven Central) and store them in a directory outside of your project. Find out more in our wiki.

In addition, Gradle is also a build system helping with building and packaging your application, without being tied to a specific IDE. This is especially useful if you use a build or continuous integration VPS, where IDEs aren’t readily available. Instead, the build VPS can gọi the build system, providing it with a build configuration so it knows how khổng lồ build your application for different platforms. If you want lớn know more about deploying your application, take a look here.