package de.frajul.endlessroll.main.screens;

import android.view.MotionEvent;
import android.view.View;

import de.frajul.endlessroll.entities.particles.ParticleSystem;
import de.frajul.endlessroll.entities.textures.TexturePack;
import de.frajul.endlessroll.main.GameActivity;
import de.frajul.endlessroll.main.GameLog;
import de.frajul.endlessroll.main.game.StartScene;
import de.frajul.endlessroll.main.game.Timer;
import de.frajul.endlessroll.rendering.Rendering;

/**
 * Created by Julian on 20.07.2016.
 */
public class StartScreenRendering extends Rendering<StartScene> {

    private Timer timer;
    private ParticleSystem particleSystem;

    public StartScreenRendering(GameActivity gameActivity) throws Exception {
        super(gameActivity);
        this.particleSystem = new ParticleSystem(gameActivity);
    }

    @Override
    public StartScene init(TexturePack texturePack, Timer timer, boolean isFirstTime) {
        GameLog.d("init Start Screen Rendering");
        this.timer = timer;
        if (isFirstTime)
            scene = new StartScene(texturePack, particleSystem);
        else
            scene.setTexturePack(texturePack);
        try {
            particleSystem.loadTextures();
        } catch (Exception e) {
        }
        return scene;
    }

    @Override
    public void update() {
        particleSystem.update(timer);
        scene.update(timer);
    }

    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return false;
    }

}
