From 78a5a25fc1c2177db9440d8f40ebd8c6f172e2ac Mon Sep 17 00:00:00 2001 From: Paul Speed Date: Mon, 28 Mar 2016 11:03:58 -0400 Subject: [PATCH] Added the app state varargs constructor to LegacyApplication and modified SimpleApplication to use it. --- .../java/com/jme3/app/LegacyApplication.java | 19 ++++++++++++++++++- .../java/com/jme3/app/SimpleApplication.java | 10 +--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java b/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java index 89a81be5b..e861ef66b 100644 --- a/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java +++ b/jme3-core/src/main/java/com/jme3/app/LegacyApplication.java @@ -31,6 +31,7 @@ */ package com.jme3.app; +import com.jme3.app.state.AppState; import com.jme3.app.state.AppStateManager; import com.jme3.asset.AssetManager; import com.jme3.audio.AudioContext; @@ -100,8 +101,24 @@ public class LegacyApplication implements Application, SystemListener { /** * Create a new instance of LegacyApplication. */ - public LegacyApplication(){ + public LegacyApplication() { + this((AppState[])null); + } + + /** + * Create a new instance of LegacyApplication, preinitialized + * with the specified set of app states. + */ + public LegacyApplication( AppState... initialStates ) { initStateManager(); + + if (initialStates != null) { + for (AppState a : initialStates) { + if (a != null) { + stateManager.attach(a); + } + } + } } /** diff --git a/jme3-core/src/main/java/com/jme3/app/SimpleApplication.java b/jme3-core/src/main/java/com/jme3/app/SimpleApplication.java index 310191007..2ab008c5c 100644 --- a/jme3-core/src/main/java/com/jme3/app/SimpleApplication.java +++ b/jme3-core/src/main/java/com/jme3/app/SimpleApplication.java @@ -100,15 +100,7 @@ public abstract class SimpleApplication extends LegacyApplication { } public SimpleApplication( AppState... initialStates ) { - super(); - - if (initialStates != null) { - for (AppState a : initialStates) { - if (a != null) { - stateManager.attach(a); - } - } - } + super(initialStates); } @Override