package gameEngine.scenes; import gameEngine.entites.Camera; import gameEngine.entites.Entity; import gameEngine.entites.GameObject; import gameEngine.entites.gameComponents.GameComponent; import gameEngine.input.Input; import gameEngine.views.Color; import gameEngine.views.Window; import java.awt.event.KeyEvent; import java.util.HashMap; import static org.lwjgl.opengl.GL11.glClearColor; public abstract class Scene { private Camera camera; public HashMap<Integer, Entity> entities = new HashMap<>(); private boolean changingScene = false; private float timeToChangeScene = 2.0f; private final Color editorBackColor = new Color(1,1,1,0); public Scene(){ } public abstract void update(float dt); public void createNewObject() { } public void addComponent(GameObject gameObject) { } public void removeComponent(GameObject gameObject, GameComponent selectedComponent) { } void changeScene(int scene, float dt){ if(!changingScene && Input.GetKeyDown(KeyEvent.VK_SPACE)){ changingScene = true; } if(changingScene && timeToChangeScene > 0){ timeToChangeScene -= dt * 1.5f; editorBackColor.r -= dt * 5.0f; editorBackColor.g -= dt * 5.0f; editorBackColor.b -= dt * 5.0f; } else if(changingScene){ Window.changeScene(scene); } glClearColor(editorBackColor.r, editorBackColor.g, editorBackColor.b, editorBackColor.a); } }