Newer
Older
AlgebraicDataflowArchitectureModel / GameEngine / src / main / java / gameEngine / scenes / EditorScene.java
package gameEngine.scenes;

import gameEngine.input.*;
import gameEngine.views.Window;

import java.awt.event.KeyEvent;

import static org.lwjgl.opengl.GL11.glClearColor;

public class EditorScene extends Scene {

    private boolean changingScene = false;
    private float timeToChangeScene = 2.0f;
    public float r,g,b,a;
    public EditorScene(){
        System.out.println("Active Editor scene");
        r = 1;
        g = 1;
        b = 1;
        a = 0;
    }

    @Override
    public void update(float dt) {
        //System.out.println("" + (1.0f / dt) + "FPS");

        if(!changingScene && Input.GetKeyDown(KeyEvent.VK_SPACE)){
            changingScene = true;
        }

        if(changingScene && timeToChangeScene > 0){
            timeToChangeScene -= dt;
            r -= dt * 5.0f;
            g -= dt * 5.0f;
            b -= dt * 5.0f;
        }
        else if(changingScene){
            Window.changeScene(1);
        }

        glClearColor(r, g, b, a);
    }
}