First way to do this <1st Mth>
The installation of
the Libgdx library is a very easy operation!
Download Library
First, go to the
official site of Libgdx
Download the
latest version which is at the top:
Once the download
is finished you must extract the format ". Rar" downloaded file.
We assumed that
Eclipse and Android SDK are already available. If this is not the case check
(link article1 Solution pour développer des applications mobiles )
Create you first project with Libgdx.
Here are the
steps to make a new project :
A- Prepare the environment for Desktop development
1 – On Eclipse, create
a new Java project
Then name the
project gdx-hello and click finish
Now your project
is in the “package explorer “.
2 - Open it and
create a file called libs in the src file of your project
Follow these
steps beginning with a right click on the src file of the project
The file must be
called libs as followings:
Then click finish
This folder (libs)
will contain the format" .jar " library file of Libgdx.
3 - Create
another file named assets
This file is to contain
the resources (images , sounds, music ...) of the apps/game
Do you remember
the file being downloaded, that I asked you to extract its contents. If you
take a look at the file you will find:
• gdx.jar
• gdx -backend-
jogl.jar
• gdx -backend-
jogl - natives.jar
• gdx -
natives.jar
Copy these format
“.jar” files in the libs file that we created in our project gdx-hello
In this tutorial I chose the
back-end JOGL that why I use “gdx-backend-jogl.jar”
and “gdx -backend- jogl - natives.jar” files . But,
if one opts for LWJGL it will be necessary to copy the format jar file of LWJGL
: “gdx-backend-lwjgl.jar” and “gdx -backend-jogl-natives.jar”
Now we will add these files in the gdx-hello project
After a right
click on your project make build path ---> Configure build path
On Library
click Add JARs
Then select the
four format jar files that you will find in the libs file our project
Once the four
files are selected click OK
Now, On source
click Add Folder and add the assets file we created in our
project
Click OK
Now your Desktop
project is ready.
The only thing
that remains is to write the source code.
B- Prepare the environment for Android Development
1 – First, create
a new Android project :
Name it gdx-helloAndroid
and click Next. Choose your emulator and then click Next.
Then enter the
name of :
Your apps, I have
named it gdx-helloAndroid
The package name,
I have named it my.works.gdxhelloAndroid
And the name of
the activity class I have named it main
Click finish
Now we will
create a file called libs in our project.
After right click
on the gdx-helloAndroid which now we can find in the “Package
Explorer” make new ---> Folder
We must name it libs
Now we will put
these format " jar " files that we can find in the folder you
downloaded :
• gdx.jar
• gdx -backend-
android.jar
• armeabi
• armeabi-v7a
3 - Now we will
add the files in our project.
After a right
click on our project gdx-helloAndroid make build path --- > configure
build path
On source click
Add JARs , and select the two JARs files :
• gdx.jar
• gdx -backend-
android.jar
Click on OK.
4 - Now we will
import the Desktop project gdx-hello that we created
On Project
click Add and select the project to import gdx-hello
It's over ! We
have created a Libgdx project.
You will make the
previous steps every time you when you create a new project
Problems ?
If you have any
comments or questions please post them in the comments section . Thank you for reading.
See also !
Install Libgdx and create a project 2nd mth
No comments:
Post a Comment