User interface (Scene2D)

Elements such as Images, Sprite, buttons, checkbox, scrollbars and other elements have in common that they have a screen position, handle events, have a size etc

LibGDX provides you an easy way to create and manipulate them: Scene2D.

preview
Examples of Scene2D Elements

With Scene2D you can add those elements (they are called Actors) onto a Stage, group them, scale them, assign them action and events. You don´t need to bother about rendering them, you just tell the application to render the stage.

Scene2D is the easiest way to get you started to create a menu with buttons or manipulate sprites.

Later on in this tutorial we will see how you can customize the components look and feel using a “Skin” for now we will start with the basics and use Skins available on the Internet.

Let’s start with an Image

Advertisement