[MUSIC]
Well g'day, g'day.
It's Tim Buchalka, the Aussie Android Dev Guy, here with yet another video.
This time we're setting up and installing libGDX which is a game framework
using Android, Android Studio for Linux.
Now, if you're running a Mac or a Windows machine, click on the links over to my
left and you'll be taken to a video where I show you how to do that
on your platform, but again this video is all about configuring and
setting up LibGDX, a game framework, using Android Studio for Linux.
Let's get into it.
Okay, so let's do a search for LibGDX Then goes with the first result,
which is libgdx.badlogicgames.com.
And click on that.
And once we're there we're gonna go to the download, click on Download and
select Download Setup App.
And I'm gonna save that.
It's quite a small file.
You can see it's now downloaded.
So we're now going to open that file.
I'm gonna double click it.
Now if that doesn't work, depending on the way your Linux machine is configured,
that may or may not work.
If double clicking it doesn't open this for your automatically,
then what you can do, and remember we're in the downloads folders.
I can go back and open a terminal.
Going to the Downloads folder and I can
type JA sorry Java- jar GDX- setup.
Jar and that will open it up that way.
So either way one of those should actually work for you so I'm just going to go back
and close the terminal down now Then go back and double click it.
Okay, so, now we've got a few things to do here so we need to know the name,
the package, the game class destination and the Android SDK.
Now this is the LibGDX Project Generator, so the idea of this is it
generates the project, the shell, if you will Of the code that you need to be able
to use libGDX, so use this tool once to create the project and
from then on you edit it and create your game using Android Studio.
So this is the shell.
So what we need to know.
We need a few things.
We need to know the destination where we're gonna save the project.
But also the Android SDK.
The best way to find the Android SDK is to go back into Android Studio And
just grab that link that we had.
So we're going to open Android Studio cause you'll recall if you followed
along at home in the previous video where I set up Android Studio, we went in and
set up and located the correct tree where the Android SDK is deployed.
Another thing we'll remember while we're here is the home folder.
So we're storing our projects in Android Studio Projects.
So we need to remember that because we're going to be putting our project in there.
So I'm going to close down the project, the current project.
Then I'm going to go back to here.
Then you'll go into configure.
Project defaults, project structure.
Here's our android STK location.
So, I'm going to take a copy of that and
I'm going to paste that into the other app.
I'm going to cancel the screen for now.
Go back to our generator, and
then in here under android STK I'm going to paste that path in.
The destination, remember, was the home folder.
And is my Android project, so click on Browse for that one.
Here's AndroidStudioProjects, so I'm just gonna select that.
We're gonna click on OK.
We're also gonna add something to here,
we're gonna add the name of the folder we're gonna use for this project.
I'm just gonna call it /test So that's where it's going to write the files.
So the name I'm just going to, it's going to be pretty simple: My First Game.
Package, I haven't really got time in this video to talk about packages,
it just needs to be something unique.
I'll address packages in another video.
In game classes, the initial game class that is executed When the project starts,
when the game starts, so we'll talk about that later.
So for now, also keep in mind that some projects are there because libGDX is
cross-platform, it works on all those platforms.
I'm gonna just take the ticks off all those inferior platforms, I'm kidding.
And just leave Android on.
So now in terms of extensions, if you don't know what these are,
you can just hover your mouse over there and you'll get some help.
So Bullet just to give you a bit of an overview is a physics library.
Free Tarp is a lightweight fonts tool, so it does,
sort of saves the space typically associated with bitmap fonts.
Tools gives you things like texture packers and the ability to generate fonts.
Controllers is for joysticks and game pads.
Box2d is a 2D physics library, and Box2dlights is lights and
shadows for that 2D physics library.
Ashley is an entity framework.
And last, but by no means least, AI is the artificial intelligence
Framework that is now part of GDX as an extension.
You can also click on show third party extensions and grab one of those or one or
more of those things depending on what comes up as well.
And you can see that these aren't maintained by the libGDX team.
I might do that now.
So I'm actually gonna deselect everything, but
you would normally have Box2d selected.
I'm gonna leave that all like that.
So once we've done that, we can go into Advanced if we want to, but
we won't need to.
But just to show you what it looks like, that's if you're using Eclipse, or
some other setup.
But we're not doing that.
We're using Android Studio.
So to do that now, all we need to do is click on Generate.
Now this will possibly pop up on your system if you've got a more recent version
of Android built tools.
Possibly, in the previous video I
downloaded the latest version which was sort of ahead of the release of GDX.
Usually you're okay you can try this.
If you did have difficulty you can go back And
fix that if you need to and by downloading a previous version.
Lock with the IPA, we're using IPA level 21 which is Android Lollipop.
They haven't tested it fully with libGDX, but with that said it's going to be ok,
but if you did have a problem you could always go back and regenerate it and
just sort of download a previous version first.
But I'm going to click on yes though to use both.
You can see on the screen below it's not downloading the relevant files in bits and
pieces that it needs to create this project.
So the amount of time it takes and
the size of downloads will be dependent on the options you've selected.
So you can see I deselected the sub projects and
I've deselected all the extensions just to save a bit of time.
So I'm going to pause the video here and wait until this finishes and
we'll continue by importing this project into Android Studio.
Okay, can't quite see because haven't got a lot of screen real estate here but
it has actually finished if I scroll up you can see build successful.
So at this point we're now done with the libGDX project generator, so
I'm going to close that down.
Go back to Android Studio which I've left open.
And we go back to the main options or main menu.
You want to select important non Android Studio project.
We've got that.
We need to navigate to the folder that just created it and
of course that was my home folder, Android Studio projects test.
So I'm just going to click on test, and click OK.
This message may or may not come up for you.
If it does, click OK, because it's okay,
and Android Studio [INAUDIBLE] grade will upgrade automatically.
So at this point now it's going to still do a little bit more analysis of
the project and
download the relevant files it needs to create an Android Studio project.
Now keep in mind here that what it's doing is it's importing the game framework.
You know, the basic skeleton code that we've created into Android Studio.
But it's doing it in the same folder.
So it's not creating another folder.
If you recall we created, we generated the project in that folder,
Android Studio Projects four slash test.
It's creating an infrastructure around that, in that same folder.
Click on yes the language level changes.
And it's just a matter of leaving this to finish and do its thing.
Now it might take several minutes.
It may take quite a bit of time.
The first time that you open a project.
But once it's done you can edit it normally as you would any other
android studio project.
So I'm just going to pause the video now until this is completed.
Okay, shouldn't be too much longer now.
So again, the first time you do this can take quite some time
just to update and download and
do whatever else it needs to do just to get that project into Android Studio.
That is a once only process.
So we'll just wait for this to finish off, and
then I'll just quickly go through Just to show you some bits and pieces.
Not a lot to show, but basically again this is just the skeleton code for libgdx.
On this point forward, you can start creating your code in Android Studio.
And creating a game and running the game via the emulator, or
via a physical Android device if you've got one connected.
Okay you can see it's finished now so do give it plenty time.
It does take a while to finish, but it's a once only process.
First in terms of some of the folders.
You can see the standard Android manifest files there,
Java files, resources, and so forth as you would normally see in a project.
The part I want to show you is in the core, and you can see, again,
this is the package we choose, the class that we choose, and
that's the class that gets called or executed on the game start.
In this case it's just setup by default because of some skeleton code to
show the bad logic jpeg onscreen.
So that's it.
And we're done.
Dusted, complete and fully set up.
So libGDX is now ready to go on your machine.
Please now subscribe to my channel.
Click on the subscribe button to the left hand side, and you'll be kept up to date.
With new videos as I release them.
If you've got a moment also,
can I ask you to please check out my Android Development Course.
Over 25 hours of video training,
showing you how to become a better Android developer.
Feel free also to peruse some of the videos there to my left hand side, and
really get you a feel, so to speak, of more Android app goodness.
Last, but by no means least, please comment on this video,
let me know what you thought about it, but also please give me some feedback of what
you'd love in the cover in the future video and I'd to do just that,
to cover as many as those requests as I can in the future videos.
This is Tim Buchalka,
the Aussie Android dev guy signing off and I'll see you in another video.
Cheers for now.