use of org.terasology.splash.overlay.AnimatedBoxRowOverlay in project Terasology by MovingBlocks.
the class Terasology method configureSplashScreen.
private static SplashScreen configureSplashScreen() {
int imageHeight = 283;
int maxTextWidth = 450;
int width = 600;
int height = 30;
int left = 20;
int top = imageHeight - height - 20;
Rectangle rectRc = new Rectangle(left, top, width, height);
Rectangle textRc = new Rectangle(left + 10, top + 5, maxTextWidth, height);
Rectangle boxRc = new Rectangle(left + maxTextWidth + 10, top, width - maxTextWidth - 20, height);
SplashScreenBuilder builder = new SplashScreenBuilder();
String[] imgFiles = new String[] { "splash_1.png", "splash_2.png", "splash_3.png", "splash_4.png", "splash_5.png" };
Point[] imgOffsets = new Point[] { new Point(0, 0), new Point(150, 0), new Point(300, 0), new Point(450, 0), new Point(630, 0) };
EngineStatus[] trigger = new EngineStatus[] { TerasologyEngineStatus.PREPARING_SUBSYSTEMS, TerasologyEngineStatus.INITIALIZING_MODULE_MANAGER, TerasologyEngineStatus.INITIALIZING_ASSET_TYPES, TerasologyEngineStatus.INITIALIZING_SUBSYSTEMS, TerasologyEngineStatus.INITIALIZING_ASSET_MANAGEMENT };
try {
for (int index = 0; index < 5; index++) {
URL resource = Terasology.class.getResource("/splash/" + imgFiles[index]);
builder.add(new TriggerImageOverlay(resource).setTrigger(trigger[index].getDescription()).setPosition(imgOffsets[index].x, imgOffsets[index].y));
}
builder.add(new ImageOverlay(Terasology.class.getResource("/splash/splash_text.png")));
} catch (IOException e) {
e.printStackTrace();
}
SplashScreen instance = builder.add(new RectOverlay(rectRc)).add(new TextOverlay(textRc)).add(new AnimatedBoxRowOverlay(boxRc)).build();
return instance;
}
Aggregations