- Libgdx Cross/platform Game Development Cookbook
- David Saltares Márquez Alberto Cejas Sánchez
- 417字
- 2021-04-02 20:33:43
Importing and running the Libgdx official demos
Libgdx comes with a few full games to serve as example projects. Developers are encouraged to check them out, try them, and read the source code. It is a fantastic way to learn how things are done the Libgdx way.
In this recipe, you will learn how to get and run the official demos.
Getting ready
You only need to make sure your development environment works. The process to get up and running is explained in the Setting up a cross-platform development environment at the beginning of this chapter.
How to do it…
There are eight official Libgdx demos. They are as follows:
- Pax Britannica: This is a one-button RTS available at https://github.com/libgdx/libgdx-demo-pax-britannica
- Metagun: This is a 2D platformer available at https://github.com/libgdx/libgdx-demo-metagun
- Super Jumper: This is a Doodle Jump clone available at https://github.com/libgdx/libgdx-demo-superjumper
- Invaders: This is a 2D Space Invaders clone available at https://github.com/libgdx/libgdx-demo-invaders
- Vector Pinball: This is a 2D pinball simulation using Box2D available at https://github.com/libgdx/libgdx-demo-vector-pinball
- Cuboc: This is a 2D platformer available at https://github.com/libgdx/libgdx-demo-cuboc
- The Plane That Couldn't Fly Good: This is a Flappy Bird clone available at https://github.com/badlogic/theplanethatcouldntflygood
- Very Angry Robots: This is a 2D shooter platformer available at https://github.com/libgdx/libgdx-demo-cuboc
We will work with Super Jumper, but the process is identical for any other project; just follow these steps:
- Clone the repository using Git. The URL is available in the project page. Super Jumper's Git repository URL is
git@github.com:libgdx/libgdx-demo-superjumper.gi
t. If you do not know how to clone a Git repository, read the Using source control on a Libgdx project with Git recipe. - Import the project from its folder into Eclipse following the instructions in the Setting up a cross-platform development environment recipe.
- Run each platform-specific project like any other Libgdx project.
Now, you can run Super Jumper, as shown in the following screenshot:

How it works…
All the Libgdx official demos use Gradle as a build system, so the process of importing them into an IDE, getting them to compile, and running them is exactly the same as we saw in the past.
As you progress through this book, it will be a great exercise to go back to the demos' source code and try to identify the concepts and techniques explained here.
There's more…
Luckily enough, the Libgdx community is big, active, and generous. This results in a great number of open source projects for people to study and learn from. Some of them can be found in the Libgdx gallery at http://libgdx.badlogicgames.com/gallery.html.
- SQL Server 2008數(shù)據(jù)庫(kù)應(yīng)用技術(shù)(第二版)
- 云計(jì)算與大數(shù)據(jù)應(yīng)用
- 云計(jì)算服務(wù)保障體系
- Hadoop與大數(shù)據(jù)挖掘(第2版)
- 重復(fù)數(shù)據(jù)刪除技術(shù):面向大數(shù)據(jù)管理的縮減技術(shù)
- 數(shù)據(jù)庫(kù)原理與應(yīng)用
- Google Cloud Platform for Developers
- MySQL技術(shù)內(nèi)幕:SQL編程
- MySQL DBA修煉之道
- Oracle高性能SQL引擎剖析:SQL優(yōu)化與調(diào)優(yōu)機(jī)制詳解
- Doris實(shí)時(shí)數(shù)倉(cāng)實(shí)戰(zhàn)
- 商業(yè)智能工具應(yīng)用與數(shù)據(jù)可視化
- Oracle 11g數(shù)據(jù)庫(kù)管理員指南
- 大數(shù)據(jù)計(jì)算系統(tǒng)原理、技術(shù)與應(yīng)用
- 掌中寶:電腦綜合應(yīng)用技巧