Game Development Reference
In-Depth Information
splashScreenBackplate = new ImageView( splashScreen ); //
using the overloaded constructor method
If you want to bypass the process of creating and loading an Image object, there is a
constructor method for that as well, which uses the following format:
ImageView(String url )
To load an image in the background ( asynchronously ), using its native (default)
resolution and native aspect ratio, the Image() constructor uses the following format:
splashScreen = new Image("/invincibagelsplash.png", 640,
400, true, false, true);
splashScreenBackplate = new ImageView();
splashScreenBackplate.setImage( splashScreen );
// uses
the empty constructor method approach
If you did not want to specify the image dimensions, background image loading,
and smooth scaling, or lock the aspect ratio for any scaling, you could condense the
previous three lines of Java code into the following constructor:
splashScreenBackplate = new ImageView("/
invincibagel.png");
// uses third constructor method
At least initially (for learning purposes), I am going to do this the long way, and I
will always explicitly load Image objects, using the Image() constructor method, so
that you can specify all the different attributes and see all the different image assets that
you are using in this Java programming logic. I want to show you the shortcut code
here, because you will be using this approach later in the topic, once you start using
ImageViews as sprites (see Chapter 8 ). You can use this shortcut approach with your
sprites because you will not be scaling them and because they are so highly optimized
that background loading will not be necessary.
Next, let's take a quick look at the TableView class, which will hold the high scores
table. Although you will not be implementing this here, I will cover the class, as it is
part of the top-level UI design that you are creating and implementing in this chapter.
Search WWH ::




Custom Search