Game Development Reference
In-Depth Information
A leaf node will therefore always contain a JavaFX class that has not been sub-
classed (extended) from the Parent class, and that has not itself been specifically de-
signed to have child elements (child objects) within it, or below it, in the JavaFX Scene
Graph hierarchy.
The four subclasses of the Parent class can all be used as branch nodes and include
the Group class, for grouping child (leaf node) objects, so that opacity, transforms, and
effects can be applied to them; the Region class, for grouping child (leaf node) objects
to form screen layouts, which can also be styled using CSS; the Control class, which
can be used to create custom user interface elements (called controls in JavaFX); and
the WebView class, which is used to contain the JavaFX WebEngine class (this class
renders HTML5 and CSS3 content into a WebView).
JavaFX Scene Content: Lights, Camera, Cursor, Ac-
tion!
Next, let's take a look at the eight classes listed in the center column in Figure 4-2 .
They provide powerful multimedia tools for controlling your application's cursor as
well as custom lighting special effects and custom camera capabilities for your 2D and
3D JavaFX applications (in this case, games, but they could also be e-books, or iTV
shows, or anything else that requires the powerful new media capabilities that JavaFX
offers via the Java language).
The more generalized classes (Cursor , LightBase , Camera ) in the figure are par-
ent classes, and the more specialized ones ( ImageCursor , PointLight , ParallelCam-
era , and so on) listed after each of those are the subclasses of those parent classes. Ex-
cept the LightBase class, that seems to be stating the obvious!
As you may have guessed (correctly), the JavaFX Cursor class can be used to con-
trol the application cursor graphic (arrow, hand, closed hand, crosshair, and so on) be-
ing used at any given time. The ImageCursor subclass can be used to define and sup-
ply a custom image-based cursor as well as an x and a y location within the custom
cursor image that defines where its point (also called the cursor hot spot) is located.
The LightBase class, and its PointLight and AmbientLight subclasses, can be
used to light your scenes. These classes are primarily used for 3D scenes, and they re-
quire 3D capabilities on any platform that the game is running on, which is not really a
problem these days, as most of the major CPU manufacturers also make (and include)
GPUs. Also, it is important to note that the Prism game engine will simulate a 3D en-
vironment (GPU), using 3D processing emulation, if one is not available on the plat-
Search WWH ::




Custom Search