package project.scenes;

import pi.Controller;
import pi.Scene;
import pi.Text;
import pi.actor.Image;

import static pi.Controller.fonts;
import java.awt.Font;

public class LoadingScene extends Scene
{
    private Text title;
    private Text subtitle;
    private String subtitle_content;
    private Image tatli;
    
    public LoadingScene() {
        title = new Text("Royal Kebab");
        subtitle_content = "Loading";
        subtitle = new Text(subtitle_content);
        tatli = new Image("images/kebab-pack/tatli-ekmek-256x256.png");
        
        Font font = fonts.get("fonts/BitcountGridDouble-Regular.ttf");
        title.center(0, 3);
        title.font(font);
        
        subtitle.center(0, -3);
        subtitle.font(font);

        tatli.center(0, 0);

        add(title);
        add(subtitle);
        add(tatli);

        repeat(0.5, 4, (int i)->{
            remove(subtitle);
            subtitle_content = subtitle_content + ".";
            subtitle = new Text(subtitle_content);
            subtitle.center(0, -3);
            subtitle.font(font);
            add(subtitle);
        }, (int i)->{
            Controller.transitionToScene(new GameScene());
        });
    }
}
