Advertisement

LibGDX Setup

Started by January 22, 2017 08:22 PM
2 comments, last by menyo 7 years, 11 months ago
Hi there. I'm a senior in high school and I've been tasked with creating a 2d 1980 arcade style game for my school competition. A few days ago I was recommended to try LibGDX because OpenGL is too complex for such a simple game. My issue is just setting it up! I've watched video after video attempting to set it up in both Eclipse and Netbeans, and each video has me downloading different software for things I don't imagine I even need. I'm making the game on a windows computer, and have zero intention of implementing it into Android or OS systems. Can someone please provide a video or article containing the correct way to set this up? Any feedback will be greatly appreciated!

Last time I started a project with libGDX I used this tool to generate the project and I was coding my game in no time. You shouldn't need Android SDK or other stuff if you only select Desktop platform. If you check the libGDX docs, they seem to recommend it as well.

Hope you find it helpful.

Advertisement

The official instructions are here: https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle

Basically just download Eclipse and the setup-jar.

When you run the jar it'll present you with a wizard. Just fill in the name, package, game-class and output location (ignore the android SDK field). Then untick Android, IOS and HTML subprojects. You probably won't need any of the extensions either. And then hit 'Generate'.

From Eclipse you need to go to File -> Import -> Gradle -> Gradle Project.

That is assuming you have a recent version of Eclipse for Java which pre-bundles the Buildship plugin. If not you won't see the Gradle option in the import dialog and you will first need to install the Buildship plugin for Eclipse (Find it in the Eclipse Marketplace under the Help menu).

And that's it! You're ready to go.

Find your main class in the Desktop project. Run it from Eclipse as a Java Application.

It should give you a window with a picture in it; when you look at the source code this is just the default application that gets generated by the setup tool to get you going.

I advice against Eclipse, worked with it for years but to step away from it was the best decision i ever made. I work in Android Studio now for all my java projects, also none android projects but you can use Jetbrains Intelij (which AS is based upon) as well. I used to run in lots of IDE problems using Eclipse and AO just seems to work, and if it doesn't on a rare occasion there either is a button to auto-fix or the fix is easy to solve. It takes some time to get used to but it is well worth the time.

To start a project for LibGDX in AS just create a project with the LibGDX setup app. Then just click File->New->Import Project and get going. You do need to install the android SDK, you can however do this within AS. To run a desktop project from your LibGDX you have to:

  • Go to Run/Debug Configurations
  • Click the + and add Application
  • Select Desktop as classpath or module
  • Now set DesktopLauncher as main class (first to run)
  • And the working directory preferably needs to point to your assets folder, this usally is in the android module if you created one with the LibGDX setup.

This topic is closed to new replies.

Advertisement