LibGDX: Demos on Github

I have made a start on fully Mavenizing my LibGDX demos and placed them up on Github.

The good news is that the core netthreads-libgdx library and the demos have been converted to use the latest version of LibGDX (0.9.9 at the time of writing). Taking the latest build from the LibGDX repo should mean that it will be easier to keep these up to date with changes to Scene2d etc.

I used the LibGDX archetype so you should have no problems building these once you have jumped through a few (minor I hope) hoops to install some dependencies on non-maven-available jar files like the tween-engine and fixtureatlas. There are detailed instructions. If you are having problems make a comment/email me or raise an issue on the issues list.

The core library is here. You will need this for the demos.

The demos up so far are:

Simple Shooter

This is the same simple shmup as before but with a lot of code tidied up. It is here.

Menu

Simple Shooter

Main

Simple Shooter

Box2d-Test

A straightforward Box2d demo with a central rotating fixture, falling objects and nice fading labels. It is here.

box2d-test
 

Box2d-Bumpers

Bumper walls, anti-gravity, tumbling blocks and flashing psychedelics..what’s not to like? Shows how to detect collisions between box2d elements and how to handle them.

box2d-bumpers

Putting these all the once place I have discovered a ton of bugs which I have had a chance to go through and fix. Later demos fixed stuff which I never went back and applied to the earlier ones like SimpleShooter so this has been a great exercise. It’s even given me a bit of a kick to write some more.

NOTE: All the LibGDX demos linked on this blog go to GitHub now. It is easier to manage them all in the one place. The new demos have a bunch of new concepts in them like the removal of the old Singleton patterns with Google Guice managing this stuff instead. Also it’s Maven from here on. If you are familiar with the old code and build mechanism then you’ll just have to come along for the ride. I promise you’ll learn stuff that will benefit you.

Comments

7 Responses to “LibGDX: Demos on Github”

  1. Robert on May 8th, 2013 7:38 am

    Is it possible to open simple shoter as an eclipse project?
    It would be much easier to read… is anywhere an instruction how to do it?

    thanks for great code, I’m learning from it a lot.

  2. admin on May 8th, 2013 8:50 am

    Robert, You generate the eclipse project by running the following maven command in the same directory as the pom file.

    mvn eclipse:eclipse

    I hope this helps.

  3. Shashank Sharma on May 21st, 2013 11:12 am

    Hi, first of all thanks for sharing these demos..
    I do not know anything about maven at all.. Is there any way I could import these demos in eclipse without maven??

  4. admin on May 21st, 2013 8:27 pm

    Hi, technically it’s possible to build the demos without maven but not without a great deal of effort which might be better spent attempting the maven build process first. I appreciate your frustration as I was quite confused about Maven initially but it does make sense once you start to use it.

    Essentially the demos require dependencies which can only come easily from a Maven build. If you take it piece by piece I hope you will find that you come to an understanding which will help you in future dealing with Maven.

    The initial extension library instructions are here:

    https://github.com/alistairrutherford/netthreads-libgdx/wiki/Build-Instructions

    And the main build instructions are here:

    https://github.com/alistairrutherford/libgdx-demos/wiki/Build-Instructions

    As I said, I was initially confused by Maven but once I grasped what it’s advantages were I realised how wonderful it was in replacing a lot of the problems I had with tying particular versions of jar to a project.

    I would suggest you attempt to follow my instructions first and if you get stuck email me.

  5. Erico on June 9th, 2013 1:04 pm

    Thanks, the examples work very well. With maven the build process become very easy. (I had to adapt “.bat” to “.sh” to add no maven libraries in linux)

  6. Dzafar Sadik on October 26th, 2013 7:19 pm

    Hi. Is it safe to use dependency injection framework (google guice) with libgdx? By doing so you probably cannot port game to HTML5 and iOS platforms.

    Thanks for article 🙂

  7. admin on October 27th, 2013 12:18 pm

    Hi Dzafar. You are quite correct I believe. Guice won’t port to html5 or iOS as far as I know. However, I am only using it to implement singletons so it should be straightforward to remove it and implement either the standard singleton pattern or refactor the design to pass the various components by reference. In terms of the desktop and android targets it just makes the design so much neater but you certainly have a good point there.

Leave a Reply