Search in sources :

Example 1 with ImageOverlay

use of org.terasology.splash.overlay.ImageOverlay 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;
}
Also used : Rectangle(java.awt.Rectangle) AnimatedBoxRowOverlay(org.terasology.splash.overlay.AnimatedBoxRowOverlay) TriggerImageOverlay(org.terasology.splash.overlay.TriggerImageOverlay) Point(java.awt.Point) IOException(java.io.IOException) RectOverlay(org.terasology.splash.overlay.RectOverlay) Point(java.awt.Point) SplashScreenBuilder(org.terasology.splash.SplashScreenBuilder) URL(java.net.URL) TextOverlay(org.terasology.splash.overlay.TextOverlay) SplashScreen(org.terasology.splash.SplashScreen) ImageOverlay(org.terasology.splash.overlay.ImageOverlay) TriggerImageOverlay(org.terasology.splash.overlay.TriggerImageOverlay)

Aggregations

Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 IOException (java.io.IOException)1 URL (java.net.URL)1 SplashScreen (org.terasology.splash.SplashScreen)1 SplashScreenBuilder (org.terasology.splash.SplashScreenBuilder)1 AnimatedBoxRowOverlay (org.terasology.splash.overlay.AnimatedBoxRowOverlay)1 ImageOverlay (org.terasology.splash.overlay.ImageOverlay)1 RectOverlay (org.terasology.splash.overlay.RectOverlay)1 TextOverlay (org.terasology.splash.overlay.TextOverlay)1 TriggerImageOverlay (org.terasology.splash.overlay.TriggerImageOverlay)1