LibGDX Video Tutorial: Scene2D Introduction


In this first of multiple part video tutorial we start looking at using Scene2D in LibGDX.  Scene2D is a library built over top of LibGDX providing a scene graph and UI/widget layer.  None of that make any sense?  Then watch the video! :)  Speaking of which, it is available in 1080p on YouTube.



The code from the example:

package com.gamefromscratch;    import com.badlogic.gdx.ApplicationAdapter;  import com.badlogic.gdx.Gdx;  import;  import;  import;  import com.badlogic.gdx.scenes.scene2d.Actor;  import com.badlogic.gdx.scenes.scene2d.Stage;  import com.badlogic.gdx.utils.viewport.ScreenViewport;    public class Scene2DDemo1 extends ApplicationAdapter {       class MyActor extends Actor {        Texture texture = new Texture(Gdx.files.internal("badlogic.jpg"));          @Override        public void draw(Batch batch, float parentAlpha) {           batch.draw(texture,0,0);        }     }     Stage stage;     @Override     public void create () {        stage = new Stage(new ScreenViewport());        MyActor actor = new MyActor();        stage.addActor(actor);        Gdx.input.setInputProcessor(stage);     }       @Override     public void render () {;        stage.draw();     }  }

Programming Video

Scroll to Top