Game Development Reference
In-Depth Information
top
,
bottom
,
left
, and
right
offset distances. The Insets method is in fact overloaded,
so you can specify an equidistant inset or a customized inset, using the following code:
Insets(double
topRightBottomLeft
)
Insets(double
top
, double
right
, double
bottom
, double
left
)
The Bounds class is a
public abstract
class and will never be an object, but instead
is a
blueprint
for creating Node boundary classes, such as its BoundingBox subclass.
The Bounds superclass also allows a
negative
value, which is used to indicate that a
bounding area is
empty
(think of it as
null
, or
unused
). A BoundingBox class uses the
following (overloaded) constructor methods to create a
2D
(first constructor) or
3D
(second constructor) BoundingBox object:
BoundingBox(double
minX
, double
minY
, double
width
,
double
height
)
BoundingBox(double
minX
, double
minY
, double
minZ
, double
width
, double
height
, double
depth
)
Next, let's take a look at Event and ActionEvent processing in JavaFX, as this will
add interactivity to your games.
JavaFX Input Control for Games: Using javafx.event
Classes
Because games are interactive by their very nature, let's take a look at the
javafx.event
package next; it provides us with the
Event
superclass and its
ActionEvent
subclass,
for handling
ACTION
events, such as UI element use and animation KeyFrame pro-
cessing. Because you are going to be using ActionEvent in your JavaFX games (applic-
ations), I am describing its class inheritance hierarchy here, as this will show you the
origins of the Event class as well:
Java.lang.Object
> java.util.EventObject
> javafx.event.Event
> javafx.event.
ActionEvent