Using LibGDX's scene graph for the menu UI
We are now going to create the scene of the menu screen. The scene will feature a background image that fills the whole screen. There will be logos in the top-left and bottom-left corner of the screen and two clickable buttons anchored in the bottom-right corner that will trigger either a play or an options action. A gold coin and a huge image of the bunny head are also added to the scene.
The following is a screenshot of how the finished menu screen will look:
However, before we start to create this scene, we have to do some preparations in advance. First of all, we need to add new images to our project and also make a small change to the automatic texture packing process so that we have a texture atlas for our UI.
Add a new subfolder in CanyonBunny-desktop/assets-raw/
called images-ui
and copy all the new images into this directory. After this, make the following change to Main.java
:
if (rebuildAtlas) { Settings settings = new Settings()...