Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 15 ■ 3D Gameplay UI CreatIon: UsInG the sphere prImItIve to Create a UI noDe


object declarations, named diffuse21 through diffuse25, and five more PhongMaterial object declarations,
named Shader21 through Shader25. This is shown in the following Java code, as well as in green (with some
code being highlighted using yellow and blue) at the top of the class in Figure 15-1:


Image ... diffuse21, diffuse22, diffuse23, diffuse24, diffuse25;
PhongMaterial ... Shader21, Shader22, Shader23, Shader24, Shader25;


Cut and paste the last five diffuse16 through diffuse20 Image object declarations, create five new ones
named diffuse21 through diffuse25, and configure them for use, as shown here and in Figure 15-2:


diffuse 21 = new Image("/gameboardquad1.png", 512, 512, true, true, true);
diffuse 22 = new Image("/gameboardquad2.png", 512, 512, true, true, true);
diffuse 23 = new Image("/gameboardquad3.png", 512, 512, true, true, true);
diffuse 24 = new Image("/gameboardquad4.png", 512, 512, true, true, true);
diffuse 25 = new Image("/gameboardspin.png", 256, 256, true, true, true);


Figure 15-1. Add objects at the top of your class for diffuse texture maps and shaders for your quadrants and
a spinner

Free download pdf