GUI creation with Scene2D

We have our game, but you may be wondering why we haven't done anything with the lifecycle of the game, like we did with Snake. Well, that is because we are going to add new screens that will appear at the start and the end. But before we get on to creating and making the new screens, I want to talk about a really useful set of UI tools LibGDX offers for making UIs, Scene2D. Well, what is it?

According the LibGDX wiki page:

"Scene2d is a 2D scene graph for building applications and UIs using a hierarchy of actors."

At its core, Scene2d is made of three classes:

  • Actor: This contains the position, size (rectangular only), origin, scale, rotation, and color.
  • Group: This is an Actor class that can contain other actors and children. ...

Get LibGDX Game Development By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.