-
Notifications
You must be signed in to change notification settings - Fork 0
Running demos & tests
Libgdx comes with a ton of small test examples and many demo games. To run and easily analyze these, you need to work directly from the libgdx source.
Before you start, make sure you have all the Prerequisites installed. You will not need the C/C++ cross compilers to run the tests and demos or mess with libgdx's Java source code.
To get the sources and all the native libraries for all platforms, perform the following on the command line. You can do the cloning with a Git GUI as well of course:
git clone git://github.com/libgdx/libgdx.git
cd libgdx
ant -f fetch.xml
This fetches all the source code from the git repository, then downloads the native files from the build server via the fetch.xml Ant script. The Git repository does not contain these native libraries to trim down it's size, hence the two steps.
To stay up to date you can do the following from within the libgdx directory every now and then:
git pull
ant -f fetch.xml
This will pull in the latest changes from the Git repository, and download the latest native libraries from the build server.
Once you have the sources and native libraries, you can open Eclipse and import all the projects:
- Go to
File -> Import
- Choose
General -> Existing Projects into Workspace
-
Browse
to the libgdx directory and make sure all projects are checked - Click
Finish
Eclipse now imports all the projects from the libgdx directory. On first import, you usually see errors everywhere. Fear not, that is just Eclipse being silly. To resolve the issues do the following:
- Go to
Project -> Clean
- Make sure all projects are selected, then click
OK
- Select all projects in the package explorer, then hit
F5
to refresh them (vodoo...) - There will be a few issues remaining concerning GWT. In the Problems view, right click on each entry saying "The web.xml file does not exist", select
Quick Fix
and pressOK
You are now ready to start the tests or run the demo games.
The test examples are contained in the gdx-tests project. This project only contains the source code. To actually start the tests on the desktop you have to run the LwjglTestStarter class, contained in the gdx-tests-lwjgl project. To run the tests on Android simply fire up the gdx-tests-android project in the emulator or on a connected device! To run the tests in your browser fire up the gdx-tests-gwt project.
Running the demo games works similarly. Each demo game has 4-5 projects, the core project, the desktop project (sometimes that's the same as the core project), the android project, the html5 project and the iOS/RoboVM project.
For both the tests and the demos the following steps are used to start the apps
- Right click one of the projects mentioned above
- Select Run As -> Java Application for desktop projects. In the upcoming dialog select LwjglTestStarter
- Select Run As -> Android Application for the android project. This will either start the emulator or deploy the test project to a connected Android device
- Select Run As -> Web Application for the html5 project. A new view opens up, click the URL that's presented to you. You might get prompted to install the GWT plugin for your browser of choice (hint: use Chrome). Note that the app runs in development mode, which means it will be terribly slow. For full speed you have to compile the HTML project, then deploy it to a web server.
For a more in-depth description of the project setup as well as how to run and debug a libgdx project see ProjectSetupNew
-
Developer's Guide
- Introduction
- Goals & Features
- Community & Support
- Contributing
- Games Built with Libgdx
- Prerequisites
- Gradle Project Setup, Running, Debugging and Packaging
- Project Setup, Running & Debugging
- Third Party Services
- Working from Source
- Using libgdx with other JVM languages
- The Application Framework
- A Simple Game
- File Handling
- Networking
- Preferences
- Input Handling
- Memory Management
- Audio
-
Graphics
- Configuration & Querying Graphics ??
- Fullscreen & VSync
- Continuous & Non-Continuous Rendering
- Clearing the Screen
- Take a Screenshot
- OpenGL ES Support * Configuration & Querying OpenGL ?? * Direct Access ?? * Utility Classes * Rendering Shapes * Textures & TextureRegions * Meshes * Shaders * Frame Buffer Objects
- 2D Graphics * SpriteBatch, TextureRegions, and Sprite * 2D Animation * Clipping, with the use of ScissorStack * Orthographic camera * Mapping Touch Coordinates ?? * Viewports * NinePatches * Bitmap Fonts * Distance field fonts * Using TextureAtlases * Pixmaps * Packing Atlases Offline * Packing Atlases at Runtime * 2D Particle Effects * Tile Maps * scene2d * scene2d.ui * Skin
- 3D Graphics * Quick Start * Models * Material and environment * 3D animations and skinning * Importing Blender models in LibGDX * Perspective Camera ?? * Picking ??
- Managing Your Assets
- Utilities
-
Math Utilities
- Interpolation
- Vectors, Matrices, Quaternions
- Circles, Planes, Rays, etc.
- Path interface & Splines
- Bounding Volumes ??
- Intersection & Overlap Testing ??
- Physics
- Tools
- Extensions
- Deploying your Application
- Building Libgdx ??
- Known Issues
- Articles
- Deprecated (May be outdated)