Skip to content
This repository was archived by the owner on Sep 17, 2021. It is now read-only.

Creating a New Scene

Asher edited this page Oct 27, 2020 · 1 revision

To create a new scene

Optionally, create a new package inside of src.Gprocessing.
If you created a new package, create a new class inside of that, otherwise, create the new class directly inside of src.Gprocessing.

Inside of the new class, add this boilerplate code.

package path.to.class;

public class ExampleNewScene extends Scene {	
		
	public static void main (String[] args) {
		Engine.init(1600, 900, "Hello World!");
	}
	
	public void awake() {		
		camera = new Camera();
	}

	public void update() {
                // Clear color RGB (0 - 255)
		background(255, 255, 255);
	}
}

Set the current scene in Window.java

Look for the class Gprocessing.Window, inside you will see these variables defined at the top:

// Define and set the current scene
public static Main main = new Main();

public static Scene currentScene = main;

Declare and define the new class that you previously declared eg.

public static ExampleNewScene newScene = new ExampleNewScene();

then set currentScene equal to your new scene

public static Scene currentScene = newScene;

IDE Run Configuration

Set your IDE's main class to ExampleNewScene.java (or whatever you named it), and run.