|
|
|
@ -1,5 +1,6 @@ |
|
|
|
|
package com.jme3.system; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.res.Resources; |
|
|
|
|
import com.jme3.util.AndroidLogHandler; |
|
|
|
|
import com.jme3.asset.AndroidAssetManager; |
|
|
|
@ -23,7 +24,69 @@ import java.net.URL; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class JmeSystem { |
|
|
|
|
public class JmeSystem |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
public static enum Platform { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Microsoft Windows 32 bit |
|
|
|
|
*/ |
|
|
|
|
Windows32, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Microsoft Windows 64 bit |
|
|
|
|
*/ |
|
|
|
|
Windows64, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Linux 32 bit |
|
|
|
|
*/ |
|
|
|
|
Linux32, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Linux 64 bit |
|
|
|
|
*/ |
|
|
|
|
Linux64, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Apple Mac OS X 32 bit |
|
|
|
|
*/ |
|
|
|
|
MacOSX32, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Apple Mac OS X 64 bit |
|
|
|
|
*/ |
|
|
|
|
MacOSX64, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Apple Mac OS X 32 bit PowerPC |
|
|
|
|
*/ |
|
|
|
|
MacOSX_PPC32, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Apple Mac OS X 64 bit PowerPC |
|
|
|
|
*/ |
|
|
|
|
MacOSX_PPC64, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Android 2.2 |
|
|
|
|
*/ |
|
|
|
|
Android_Froyo, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Android 2.3 |
|
|
|
|
*/ |
|
|
|
|
Android_Gingerbread, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Android 3.0 |
|
|
|
|
*/ |
|
|
|
|
Android_Honeycomb, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static final Logger logger = Logger.getLogger(JmeSystem.class.getName()); |
|
|
|
|
|
|
|
|
@ -31,45 +94,51 @@ public class JmeSystem { |
|
|
|
|
private static boolean lowPermissions = false; |
|
|
|
|
private static Resources res; |
|
|
|
|
|
|
|
|
|
public static void initialize(AppSettings settings){ |
|
|
|
|
public static void initialize(AppSettings settings) |
|
|
|
|
{ |
|
|
|
|
if (initialized) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
initialized = true; |
|
|
|
|
try { |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
JmeFormatter formatter = new JmeFormatter(); |
|
|
|
|
|
|
|
|
|
Handler consoleHandler = new AndroidLogHandler(); |
|
|
|
|
consoleHandler.setFormatter(formatter); |
|
|
|
|
// Logger.getLogger("").removeHandler(Logger.getLogger("").getHandlers()[0]);
|
|
|
|
|
// Logger.getLogger("").addHandler(consoleHandler);
|
|
|
|
|
|
|
|
|
|
// Logger.getLogger("com.g3d").setLevel(Level.FINEST);
|
|
|
|
|
} catch (SecurityException ex){ |
|
|
|
|
} |
|
|
|
|
catch (SecurityException ex) |
|
|
|
|
{ |
|
|
|
|
logger.log(Level.SEVERE, "Security error in creating log file", ex); |
|
|
|
|
} |
|
|
|
|
logger.info("Running on "+getFullName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String getFullName(){ |
|
|
|
|
return "jMonkey Engine 3 ALPHA 0.50 Android"; |
|
|
|
|
public static String getFullName() |
|
|
|
|
{ |
|
|
|
|
return "jMonkey Engine 3 ALPHA 0.6 Android"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void setLowPermissions(boolean lowPerm){ |
|
|
|
|
public static void setLowPermissions(boolean lowPerm) |
|
|
|
|
{ |
|
|
|
|
lowPermissions = lowPerm; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean isLowPermissions() { |
|
|
|
|
public static boolean isLowPermissions() |
|
|
|
|
{ |
|
|
|
|
return lowPermissions; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static JmeContext newContext(AppSettings settings, Type contextType) { |
|
|
|
|
public static JmeContext newContext(AppSettings settings, Type contextType) |
|
|
|
|
{ |
|
|
|
|
initialize(settings); |
|
|
|
|
return new OGLESContext(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static AudioRenderer newAudioRenderer(AppSettings settings) { |
|
|
|
|
return new AudioRenderer() { |
|
|
|
|
public static AudioRenderer newAudioRenderer(AppSettings settings) |
|
|
|
|
{ |
|
|
|
|
return new AudioRenderer() |
|
|
|
|
{ |
|
|
|
|
public void setListener(Listener listener) {} |
|
|
|
|
public void setEnvironment(Environment env) {} |
|
|
|
|
public void playSourceInstance(AudioNode src) {} |
|
|
|
@ -92,26 +161,41 @@ public class JmeSystem { |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void setResources(Resources res){ |
|
|
|
|
public static void setResources(Resources res) |
|
|
|
|
{ |
|
|
|
|
JmeSystem.res = res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static Resources getResources(){ |
|
|
|
|
public static Resources getResources() |
|
|
|
|
{ |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static AssetManager newAssetManager(){ |
|
|
|
|
public static AssetManager newAssetManager() |
|
|
|
|
{ |
|
|
|
|
logger.info("newAssetManager()"); |
|
|
|
|
return new AndroidAssetManager(null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static AssetManager newAssetManager(URL url){ |
|
|
|
|
public static AssetManager newAssetManager(URL url) |
|
|
|
|
{ |
|
|
|
|
logger.info("newAssetManager(" + url + ")"); |
|
|
|
|
return new AndroidAssetManager(url); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean showSettingsDialog(AppSettings settings, boolean loadSettings) { |
|
|
|
|
public static boolean showSettingsDialog(AppSettings settings, boolean loadSettings) |
|
|
|
|
{ |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static Platform getPlatform() |
|
|
|
|
{ |
|
|
|
|
String os = System.getProperty("os.name").toLowerCase(); |
|
|
|
|
String arch = System.getProperty("os.arch").toLowerCase(); |
|
|
|
|
|
|
|
|
|
return Platform.Android_Froyo; |
|
|
|
|
// throw new UnsupportedOperationException("The specified platform: "+os+" is not supported.");
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|