From 32bc1b99866518bda03409dd8c81a2756656f44f Mon Sep 17 00:00:00 2001 From: Squibid Date: Mon, 3 Jun 2024 20:33:38 -0400 Subject: update game engine and example game --- src/main/java/los/numeros/GameEngine/Engine.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/los/numeros/GameEngine/Engine.java (limited to 'src/main/java/los/numeros/GameEngine/Engine.java') diff --git a/src/main/java/los/numeros/GameEngine/Engine.java b/src/main/java/los/numeros/GameEngine/Engine.java new file mode 100644 index 0000000..2cc509a --- /dev/null +++ b/src/main/java/los/numeros/GameEngine/Engine.java @@ -0,0 +1,24 @@ +package los.numeros.GameEngine; + +import java.util.function.BooleanSupplier; + +public interface Engine { + public static int + StartEngine(BooleanSupplier running, Module modules[]) + { + /* run module inits */ + for (Module module : modules) { + module.init(); + } + + /* wait for the game to end */ + while (running.getAsBoolean()); + + /* run module ends */ + for (Module module : modules) { + module.end(); + } + + return 0; + } +} -- cgit v1.2.1