|
|
@ -10,6 +10,7 @@ import mightypork.gamecore.core.events.ShutdownEvent; |
|
|
|
import mightypork.gamecore.core.init.InitTask; |
|
|
|
import mightypork.gamecore.core.init.InitTask; |
|
|
|
import mightypork.gamecore.core.plugins.AppPlugin; |
|
|
|
import mightypork.gamecore.core.plugins.AppPlugin; |
|
|
|
import mightypork.gamecore.graphics.GraphicsModule; |
|
|
|
import mightypork.gamecore.graphics.GraphicsModule; |
|
|
|
|
|
|
|
import mightypork.gamecore.graphics.Renderable; |
|
|
|
import mightypork.gamecore.input.InputModule; |
|
|
|
import mightypork.gamecore.input.InputModule; |
|
|
|
import mightypork.utils.annotations.Stub; |
|
|
|
import mightypork.utils.annotations.Stub; |
|
|
|
import mightypork.utils.eventbus.EventBus; |
|
|
|
import mightypork.utils.eventbus.EventBus; |
|
|
@ -41,6 +42,8 @@ public class App extends BusNode { |
|
|
|
/** The used main loop instance */ |
|
|
|
/** The used main loop instance */ |
|
|
|
protected MainLoop mainLoop; |
|
|
|
protected MainLoop mainLoop; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Renderable mainRenderable; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create an app with given backend. |
|
|
|
* Create an app with given backend. |
|
|
@ -78,10 +81,6 @@ public class App extends BusNode { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void addPlugin(AppPlugin plugin) |
|
|
|
public void addPlugin(AppPlugin plugin) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (started) { |
|
|
|
|
|
|
|
throw new IllegalStateException("App already started, cannot add plugins."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// attach to event bus
|
|
|
|
// attach to event bus
|
|
|
|
plugins.add(plugin); |
|
|
|
plugins.add(plugin); |
|
|
|
plugin.bind(this); |
|
|
|
plugin.bind(this); |
|
|
@ -112,6 +111,18 @@ public class App extends BusNode { |
|
|
|
public void setMainLoop(MainLoop loop) |
|
|
|
public void setMainLoop(MainLoop loop) |
|
|
|
{ |
|
|
|
{ |
|
|
|
this.mainLoop = loop; |
|
|
|
this.mainLoop = loop; |
|
|
|
|
|
|
|
bus().subscribe(loop); // ?
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Set the main renderable |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param renderable the main renderable |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void setMainRenderable(Renderable renderable) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.mainRenderable = renderable; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -146,6 +157,7 @@ public class App extends BusNode { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Log.i("Starting main loop..."); |
|
|
|
Log.i("Starting main loop..."); |
|
|
|
|
|
|
|
mainLoop.setRootRenderable(mainRenderable); |
|
|
|
mainLoop.start(); |
|
|
|
mainLoop.start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|