Sunteți pe pagina 1din 5

Project Setup Gradle libgdx/libgdx Wiki https://github.

com/libgdx/libgdx/wiki/Project-Setup-Gradle

Pull request s Issues Gist

libgdx / libgdx Wat ch 1,174 St ar 10,603 Fork 5,036

Code Issues 107 Pull requests 46 Projects 0 Wiki Pulse Graphs

Edit New Page

Julien Villegas edited this page on 10 Dec 2016 98 revisions

Pages 201

Libgdx provides a simple wizard tool ( gdxsetup.jar ) allowing you to easily get you started. This
will create a gradle ready project that ready to be imported into your IDE (Android Studio,
Table of Cont ent s
Eclipse..).
Wiki St yle Guide
Developer's Guide
1. Download LibGDX Project setup tool "gdx-setup.jar"
Introduction
2. Open you command line tool, go to the download folder and run Goals & Features
javajar./gdxsetup.jar Community &
Support
This will open the following setup that will allow you to generate your project Contributing
Games Built With
libGDX
Setting up your
Development Environment
(Eclipse, Android Studio,
Intellij IDEA, NetBeans)
Creating, Running,
Debugging and Packaging
Your Project
Eclipse
Android Studio and
Intellij IDEA
NetBeans
Commandline
Updating Your libGDX
Version
Adding Extensions
and 3rd Party Libraries
Publishing Your Own
Extensions Via the
Setup Application
Improving Your
Gradle Workflow
Creating Asset Project
in Eclipse
Deploying your
application
Working From Source
Running Demos
Running Tests
Building libGDX From
Source
Building the Bullet
wrapper
The Application
Framework
The Life-Cycle
Modules Overview
Starter Classes &

1 de 5 25/1/2017 8:50 p. m.
Project Setup Gradle libgdx/libgdx Wiki https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle

You are asked to provide the following parameters: Configuration


Querying
Name: the name of the application, lower-case with minuses is usually a good idea, e.g. Logging
mygame Threading
Package: the Java package under which your code will live, e.g. com.badlogic.mygame Interfacing With
Platform-Specific
Game Class: the name of the main game java class of your app, e.g. MyGame Code
Destination: Folder where your app will be created A Simple Game
Extending the Simple
Android SDK: the location of your android sdk. With Android Studio, to find out where it is, Game
start Android Studio and click "Configure"->"SDK Manager". By default is is in /Users File Handling
/username/Library/Android/sdk Networking
Preferences
Input Handling
Configuration &
Querying
Mouse, Touch &
Keyboard
Polling
Event Handling
Controllers
Gesture Detection
Simple Text Input
Accelerometer
Compass
Gyroscope
Vibrator
Cursor Visibility &
Catching
Back and Menu Key
Catching
On-Screen Keyboard
Memory Management
Audio
Sound Effects
Streaming Music
Playing PCM Audio
Recording PCM Audio
Graphics
Querying &
configuring graphics
(monitors, display
modes, vsync)
Continuous &
Non-Continuous
Rendering
Clearing the Screen
Taking a Screenshot
Profiling
Viewports
OpenGL ES Support
Configuration &
Sub Project s: LibGDX is crossplatform. By default all the target platform except ios-moe are Querying OpenGL
included (Desktop; Android; iOS; HTML). No need to change the default value unless you are ??
Direct Access ??
sure you will never compile for a specific target. ios-moe is an alternative to robovm
Utility Classes
supported by Intel.
Rendering
Shapes
extensions: the extensions to include:
Textures &
Bullet : 3D Collision Detection and Rigid Body Dynamics Library.
TextureRegio
FreeType Scallable font. Great to manipulate font size dynamically. However be aware that it ns
does not work with HTML target if you cross compile for that target. Meshes
Tools Set of tools including: particle editor (2d/3d), bitmap font and image texture packers. Shaders

2 de 5 25/1/2017 8:50 p. m.
Project Setup Gradle libgdx/libgdx Wiki https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle

Cont roller Frame Buffer


Objects
Library to handle controllers (e.g.:XBox 360 controller).
2D Graphics
Box2d: Box2D is a 2D physics library.
SpriteBatch,
Box2dlight s: 2D lighting framework that uses box2d for raycasting and OpenGL ES 2.0 for TextureRegions,
rendering. and Sprites
Ashley:A tiny entity framework. 2D Animation
Ai: An artificial intelligence framework. Clipping, With
the Use of
by clicking "Show Third Party Extensions" you can access the list of other popular LibGDX ScissorStack
extensions Orthographic
Camera
Note that the Advanced button lets you set the project generation to generate Eclipse and/or Mapping Touch
IDEA projects wit hout Gradle integration, as described in more detail in the wiki article about Coordinates ??

workflow without Gradle, as well as options to use an alternative repository to Maven Central and NinePatches
Bitmap Fonts
to not force downloading dependencies. You do not need to change the advance settings if you
Distance
are a beginner. Field Fonts
Color
When ready, click "Generate".
Markup
Language
note: You may get a message indicating that you have a more recent version of android build
Using
tools or android API than the recomended. This is not a blocking message and you may continue. TextureAtlases
Pixmaps
Now you are ready to impor t the project into your IDE, run, debug and package it !
Packing Atlases
Offline
Eclipse
Packing Atlases at
Intellij IDEA and Android studio Runtime
NetBeans Texture
Compression
Commandline
2D ParticleEffects
Tile Maps
scene2d
scene2d.ui
Table
This section provides additional information regarding:
Skin
3D Graphics
How to create a project from the command line, without the wizard.
Quick Start
The structure of a libGDX project. Models
What is Gradle Material and
Environment
ModelBatch
Creat ing a libgdx project using t he command line ModelCache
ModelBuilder,
This section is to create your project from the command line. This is not required if you use the MeshBuilder and
wizard above. IF you run it from the command line, specify the following arguments. MeshPartBuilder
3D Animations
dir: the directory to write the project to, relative or absolute and Skinning
name: the name of the application, lower-case with minuses is usually a good idea, e.g. Importing
mygame Blender Models in
libGDX
package: the Java package under which your code will live, e.g. com.badlogic.mygame
3D Particle Effects
mainClass: the name of the main ApplicationListener of your app, e.g. MyGame Perspective
sdkLocation: the location of your android sdk, Intellij uses this if ANDROID_HOME is not set Camera ??
Picking ??
excludeM odules: the modules to exclude (Desktop; Android; iOS; HTML) separated by ';' and
Managing Your Assets
not case sensitive, e.g. Android;ios. Optional. Default it includes all the modules
Internationalization and
extensions: the extensions to include (same name as in GUI: Bullet; Freetype; Tools; Localization
Controllers; Box2d; Box2dlights; Ashley; Ai) separated by ';' and not case sensitive, e.g. Utilities
box2d;box2dlights;Ai. Optional Reading & Writing
JSON
Putting it all together, you can run the project generator on the command line as follows: Reading & Writing
XML
javajargdxsetup.jardirmygamenamemygamepackagecom.badlogic.mygamemainClass Collections

3 de 5 25/1/2017 8:50 p. m.
Project Setup Gradle libgdx/libgdx Wiki https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle

MyGamesdkLocationmySdkLocation[excludeModules<modules>][extensions<extensions>] Reflection
jnigen
Math Utilities
Project layout
Interpolation

This will create a directory called mygame with the following layout: Vectors, Matrices,
Quaternions
Circles, Planes, Rays,
settings.gradle<definitionofsubmodules.Bydefaultcore,desktop,android,ht etc.
build.gradle<mainGradlebuildfile,definesdependenciesandplugins
Path Interface &
gradlew<scriptthatwillrunGradleonUnixsystems
Splines
gradlew.bat<scriptthatwillrunGradleonWindows
Bounding Volumes ??
gradle<localgradlewrapper
local.properties<Intellijonlyfile,definesandroidsdklocation Intersection &
Overlap Testing ??
core/ Tools
build.gradle<Gradlebuildfileforcoreproject* Texture Packer
src/<Sourcefolderforallyourgame'scode Hiero
2D Particle Editor
desktop/ Extensions
build.gradle<Gradlebuildfilefordesktopproject* Artificial Intelligence
src/<Sourcefolderforyourdesktopproject,containsLwjgllauncher
gdx-freetype
gdx-pay: cross-
android/
platform In-App-
build.gradle<Gradlebuildfileforandroidproject*
Purchasing API
AndroidManifest.xml<Androidspecificconfig
assets/<containsforyourgraphics,audio,etc.Sharedwithotherproje Physics
res/<containsiconsforyourappandotherresources Box2D
src/<SourcefolderforyourAndroidproject,containsandroidlaunche Bullet Physics
Setup
html/ Using the
build.gradle<Gradlebuildfileforthehtmlproject* Wrapper
src/<Sourcefolderforyourhtmlproject,containslauncherandhtml Using
webapp/<Wartemplate,ongenerationthecontentsarecopiedtowar.Cont Models
Contact
Callbacks
ios/
Custom
build.gradle<Gradlebuildfilefortheiosproject*
Classes
src/<Sourcefolderforyouriosproject,containslauncher
Debugging
Using libGDX With Other
* These scripts contain tasks that package natives and distribute your applications on the JVM Languages
Using libGDX With
respective platforms, you can add/maintain these tasks yourself, but only do so if you are familiar
Clojure
with Gradle, and what these tasks are doing, otherwise you will break your project.
Using libGDX With
Kotlin
Here is a good tutorial on how to install libGDX using a tool provided by Bad Logic.
Using libGDX With
Python
What is Gradle? Using libGDX With
Scala
Gradle is a dependency management and build system.
Third Party Extensions
Overlap2D
A dependency management system is an easy way to pull in 3rd party libraries into your project,
VisUI
without having to store the libraries in your source tree. Instead, the dependency management
VisRuntime
system relies on a file in your source tree that specifies the names and versions of the libraries
libgdx-utils
you need to be included in your application. Adding, removing and changing the version of a 3rd libgdx-utils-box2d
party library is as easy as changing a few lines in that configuration file. The dependency gdx-facebook
management system will pull in the libraries you specified from a central repository (in our case gdx-dialogs
Maven Central) and store them in a directory outside of your project. gdx-kiwi
gdx-lml
A build system helps with building and packaging your application, without being tied to a
Third Party Services
specific IDE. This is especially useful if you use a build or continuous integration server, where AdMob in libGDX
IDEs aren't readily available. Instead, the build server can call the build system, providing it with a Airpush in libGDX
build configuration so it knows how to build your application for different platforms. Swarm in libGDX
NextPeer in libGDX
In case of Gradle, both dependency management and build system go hand in hand. Both are Google Play Game
configured in the same set of files. See the Dependency management with Gradle and Services in libGDX

4 de 5 25/1/2017 8:50 p. m.
Project Setup Gradle libgdx/libgdx Wiki https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle

"Packaging" sections below for more information. ProGuard/DexGuard


and libGDX
Excelsior JET and
libGDX
Articles
Getting Help
External Tutorials
Bundling a JRE
Deploying as an Applet
Getting ready for
#libGDXJAM
Coordinate systems

Clone t his wiki locally

Clone in Deskt op

2017 GitHub, Inc. Terms Privacy Security Status Help Contact GitHub API Training Shop Blog About

5 de 5 25/1/2017 8:50 p. m.

S-ar putea să vă placă și