Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 21 ■ Questions and answers: Finishing the setup Methods and digital audio


and, in the next chapter, one for 2D UI Node components for creating the scoring engine. After reconfiguring
the Java code a bit, we will then create the UI infrastructure for the question and answer (Q&A) panel using
a StackPane to hold four large Button UI elements. After we create the basic code to put this UI into place,
we will “tweak” its settings to work optimally within the camera zoom in Animation object that we created in
Chapter 20 , as this Animation moves the camera location and rotation, which will assuredly change how the
2D Q&A UI pane is going to render visually on your display.


Adding Another Organization Layer: The createUInodes() Method


Let’s separate your createBoardGameNodes() method into one method for creating the 3D Scene objects
(such as the PointLight, ParallelCamera, gameBoard, 3D spinner UI, and game board quadrants) and a
second createUInodes() method for holding the 2D UI objects we created in the first several chapters of this
book. This will place two to three dozen statements into each method body and better organize each section
of the SceneGraph before we create the createQAnodes() method to hold the Node objects that will create
and configure our Q&A panel, which we will do next. The selection should look like the 34 Java statements
shown in medium blue in Figure 21-1.


Figure 21-1. Select and cut your uiLayout branch Node statements and paste them into a createUInodes()
method body

Free download pdf