Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 11 ■ 3D SCene Configuration: uSing the perSpeCtiveCamera anD pointLight


If you use your Run ➤ Project work process and test these three Button UI elements, you will see that
all of your hard design work from the previous chapters has been completely restored thanks to our use of
the StackPane’s backplate (Background object) to hold the Paint object set to a Color helper class constant of
Color.WHITE.


Implementing the Start Game Button: Hiding Your UI


The next thing that we want to do is to comment out all the code in the gameButton event handler code
(so we can restore these later, if we want to) and then add some new statements that will hide (set visibility
to false) the StackPane branch of the SceneGraph; we will also set the camera.setTranslateZ() method
call to the -1000 value we wanted to use originally. As we build the game, we will be adding additional
configuration and control statements into this Button regarding the i3D game, which, as you can now see,
will “live” behind the StackPane UI Control Panel.


Figure 11-14. Copy and paste the uiLayout.setBackground() construct from helpButton to legalButton and
creditButton

Free download pdf