Project Setup with gdx-setup

View: 332    Dowload: 0   Comment: 0   Post by: kulzxt  
Author: none   Category: Mobile applications   Fields: Game - Entertainment

9 point/1 review File has been tested

Libgdx comes with a file called gdx-setup.jar which is an executable UI and command line tool. You can simply execute the JAR file which will open the setup UI. To execute the JAR file at the command line

Introduction

Creating a libgdx project

Libgdx comes with a file called gdx-setup.jar which is an executable UI and command line tool. You can simply execute the JAR file which will open the setup UI.
To execute the JAR file at the command line:
java -jar gdx-setup.jar Download gdx-setup.jar

Specify your application name, your Java package name, the name of your main class, the output directory, and the path to your android sdk. Next, you can select what platforms you want to support. Note: once chosen, you'll have to add new platforms manually!. Finally, you can select extensions to be included in your app. Some may not work on all platforms, for which you'll get a warning. When you've set everything, click "Generate". Now you are ready to import the project into your IDE, run, debug and package it!

  • Eclipse
  • Intellij IDEA and Android studio
  • NetBeans
  • Commandline

Note that the Advanced button lets you set the project generation to generate Eclipse and/or IDEA projects without Gradle integration, as described in more detail in the wiki article about workflow without Gradle, as well as options to use an alternative repository to Maven Central and to not force downloading dependencies.

screen capture of gdx-setup.jar

Creating a libgdx project on the command line

IF you run it from the command line, specify the following arguments.

  • dir: the directory to write the project to, relative or absolute
  • name: the name of the application, lower-case with minuses is usually a good idea, e.g. mygame
  • package: the Java package under which your code will live, e.g. com.badlogic.mygame
  • mainClass: the name of the main ApplicationListener of your app, e.g. MyGame
  • sdkLocation: the location of your android sdk, Intellij uses this if ANDROID_HOME is not set
  • excludeModules: the modules to exclude (Desktop; Android; iOS; HTML) separated by ';' and not case sensitive, e.g. Android;ios. Optional. Default it includes all the modules
  • extensions: the extensions to include (same name as in GUI: Bullet; Freetype; Tools; Controllers; Box2d; Box2dlights; Ashley; Ai) separated by ';' and not case sensitive, e.g. box2d;box2dlights;Ai. Optional

Putting it all together, you can run the project generator on the command line as follows:

java -jar gdx-setup.jar --dir mygame --name mygame --package com.badlogic.mygame --mainClass MyGame --sdkLocation mySdkLocation [--excludeModules <modules>] [--extensions <extensions>]

Project layout

This will create a directory called mygamewith the following layout:

settings.gradle            <- definition of sub-modules. By default core, desktop, android, html, ios
build.gradle               <- main Gradle build file, defines dependencies and plugins
gradlew                    <- script that will run Gradle on Unix systems
gradlew.bat                <- script that will run Gradle on Windows
gradle                     <- local gradle wrapper
local.properties           <- Intellij only file, defines android sdk location

core/
    build.gradle           <- Gradle build file for core project*
    src/                   <- Source folder for all your game's code

desktop/
    build.gradle           <- Gradle build file for desktop project*
    src/                   <- Source folder for your desktop project, contains Lwjgl launcher class

android/
    build.gradle           <- Gradle build file for android project*
    AndroidManifest.xml    <- Android specific config
    assets/                <- contains for your graphics, audio, etc.  Shared with other projects.
    res/                   <- contains icons for your app and other resources
    src/                   <- Source folder for your Android project, contains android launcher class

html/
    build.gradle           <- Gradle build file for the html project*
    src/                   <- Source folder for your html project, contains launcher and html definition
    webapp/                <- War template, on generation the contents are copied to war. Contains startup url index page and web.xml


ios/
    build.gradle           <- Gradle build file for the ios project*
    src/                   <- Source folder for your ios project, contains launcher

* These scripts contain tasks that package natives and distribute your applications on the respective platforms, you can add/maintain these tasks yourself, but only do so if you are familiar with Gradle, and what these tasks are doing, otherwise you will break your project.

What is Gradle?

Gradle is a dependency management and build system.

A dependency management system is an easy way to pull in 3rd party libraries into your project, without having to store the libraries in your source tree. Instead, the dependency management system relies on a file in your source tree that specifies the names and versions of the libraries you need to be included in your application. Adding, removing and changing the version of a 3rd party 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.

A build system helps 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 server, where IDEs aren't readily available. Instead, the build server can call the build system, providing it with a build configuration so it knows how to build your application for different platforms.

In case of Gradle, both dependency management and build system go hand in hand. Both are configured in the same set of files. See the Dependency management with Gradle and "Packaging" sections below for more information.

Project Setup with gdx-setup

Project Setup with gdx-setup Posted on 27-10-2016  Libgdx comes with a file called gdx-setup.jar which is an executable UI and command line tool. You can simply execute the JAR file which will open the setup UI. To execute the JAR file at the command line 9/10 332

Comment:

To comment you must be logged in members.

Files with category

  • Start classes & configuration

    View: 354    Download: 0   Comment: 0   Author: none  

    Start classes & configuration

    Category: Mobile applications
    Fields: Game - Entertainment

    1.75/2 review
    For each target platform, a starter class has to be written. This class instantiates a back-end specific Application implementation and the ApplicationListener that implements the application logic. The starter classes are platform dependent, let's...

  • Project setup Guide

    View: 545    Download: 0   Comment: 0   Author: none  

    Project setup Guide

    Category: Mobile applications
    Fields: Game - Entertainment

    2.25/2 review

  • Using libgdx with intellij idea

    View: 516    Download: 0   Comment: 0   Author: none  

    Using libgdx with intellij idea

    Category: Mobile applications
    Fields: Game - Entertainment

    2.25/2 review
    The newest, and easiest way to setup libgdx for use with IntelliJ IDEA is to use the gradle build system. A detailed tutorial can be read here

  • Start classes & configuration

    View: 466    Download: 0   Comment: 0   Author: none  

    Start classes & configuration

    Category: Mobile applications
    Fields: Game - Entertainment

    1.5/3 review
    For each target platform, a starter class has to be written. This class instantiates a back-end specificApplication implementation and the ApplicationListener that implements the application logic. The starter classes are platform dependent, let's...

  • Project setup, running and debugging

    View: 535    Download: 0   Comment: 0   Author: none  

    Project setup, running and debugging

    Category: Mobile applications
    Fields: Game - Entertainment

    2.25/2 review
    Attention: this is extremely outdated and NOT supported anymore! Please use the Gradle-based setup instead Libgdx is very Eclipse centric due to its Android and HTML5/GWT back-ends. This article discusses how to setup libgdx projects for Eclipse....

  • The applications framework

    View: 461    Download: 0   Comment: 0   Author: none  

    The applications framework

    Category: Mobile applications
    Fields: Game - Entertainment

    2/2 review
    At its core, libgdx consists of six interfaces that provide means to interact with the operating system. Each back-end implements these interfaces.

  • Start Building libgdx from source

    View: 459    Download: 0   Comment: 0   Author: none  

    Start Building libgdx from source

    Category: Mobile applications
    Fields: Game - Entertainment

    1.75/2 review
    Before trying to build libgdx from source yourself, you'll have to install Eclipse and all other related software. We currently don't support development with other IDEs. In addition you'll have to install Ant and make sure its bin/ directory is...

  • Start Build Infrastructure Setup

    View: 557    Download: 0   Comment: 0   Author: none  

    Start Build Infrastructure Setup

    Category: Mobile applications
    Fields: Game - Entertainment

    0/1 review
    Our build infrastructure has the responsibility of building libgdx for all supported platforms (Windows, Linux, Mac OS X, Android, iOS, HTML). On top of the boring old Java code, we also need to compile the native code for each platform and...

 

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd