LibGDX Video Tutorial: Hello World!


In this video tutorial, we create our first LibGDX project.  This tutorial covers that basic layout of a LibGDX application, adding new assets to a project and looks at how the initial project is composed and how multiple platforms are supported.  We then go through the initial code, then look in depth at coordinate systems, then move on to creating a sprite.  Finally we look at positioning, scaling and rotating a sprite with a SpriteBatch.


This tutorial assumes you already have your development environment setup and know how to run a LibGDX application in your chosen IDE.  If you do no, please watch these videos first.


The following is the video tutorial.  It was recorded in 1080p and the complete version can be viewed here.



The following is the final code generated:


package com.gamefromscratch;    import com.badlogic.gdx.ApplicationAdapter;  import com.badlogic.gdx.Gdx;  import;  import;  import;  import;    public class HelloWorld extends ApplicationAdapter {     SpriteBatch batch;     Texture img;     Sprite sprite;          @Override     public void create () {        batch = new SpriteBatch();        img = new Texture("HelloWorld.png");        sprite = new Sprite(img);        sprite.setPosition(     - sprite.getWidth()/2,     - sprite.getHeight()/2);        sprite.setScale(1.0f,2.0f);     }       @Override     public void render () {, 0, 0, 1);;        batch.begin();        batch.draw(sprite, sprite.getX(),sprite.getY(),sprite.getWidth()/2,              sprite.getHeight()/2,sprite.getWidth(),              sprite.getHeight(),sprite.getScaleX(),              sprite.getScaleY(),sprite.getRotation());        batch.end();     }  }


Here is the image that was used in this tutorial:


Programming Video

Scroll to Top