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

import gameEngine.input.*;
import gameEngine.views.Color;
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;
    private final Color editorBackColor = new Color(1,1,1,0);
    public EditorScene(){
        System.out.println("Active Editor scene");
    }

    @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;
            editorBackColor.r -= dt * 5.0f;
            editorBackColor.g  -= dt * 5.0f;
            editorBackColor.b  -= dt * 5.0f;
        }
        else if(changingScene){
            Window.changeScene(1);
        }

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