add support for passing in lwjgl specific properties via java_arguments applet parameter

This commit is contained in:
Brian Matzon 2011-01-10 21:50:21 +00:00
parent ea5f8518ee
commit 99cb0f9451
1 changed files with 23 additions and 0 deletions

View File

@ -759,6 +759,9 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
// add the downloaded jars and natives to classpath
updateClassPath(path);
// set lwjgl properties
setLWJGLProperties();
// switch to LWJGL Applet
switchApplet();
@ -776,6 +779,26 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
}
}
/**
* Parses the java_arguments list and sets lwjgl specific
* properties accordingly, before the launch.
*/
protected void setLWJGLProperties() {
String javaArguments = getParameter("java_arguments");
if(javaArguments != null && javaArguments.length() > 0) {
int start = javaArguments.indexOf("-Dorg.lwjgl");
while(start != -1) {
int end = javaArguments.indexOf(" ", start);
if(end == -1) {
end = javaArguments.length();
}
String[] keyValue = javaArguments.substring(start+2, end).split("=");
System.setProperty(keyValue[0], keyValue[1]);
start = javaArguments.indexOf("-Dorg.lwjgl", end);
}
}
}
/**
* get path to the lwjgl cache directory
*