summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorendolf <[email protected]>2003-11-28 22:47:24 +0000
committerendolf <[email protected]>2003-11-28 22:47:24 +0000
commit0f30b506759df12a092ca647bcaac94985ec2fe4 (patch)
treeef830baa5f15d12cfc6f719306b70088a9a8ed72
parentb6d0678a9d1aeafa06e95da3128fd20a2b705bba (diff)
Added jinput.plugins (or net.java.games.input.plugins, both work) to allow plugin class names to be specified for useage with webstart.
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@61 e343933a-64c8-49c5-92b1-88f2ce3e89e8
-rw-r--r--coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java b/coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java
index 7a62286..5e8e358 100644
--- a/coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java
+++ b/coreAPI/src/java/net/java/games/input/DefaultControllerEnvironment.java
@@ -46,6 +46,7 @@ import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Properties;
+import java.util.StringTokenizer;
import net.java.games.util.plugins.*;
/**
@@ -109,6 +110,25 @@ class DefaultControllerEnvironment extends ControllerEnvironment {
return DefaultControllerEnvironment.this;
}
});
+ //Check the properties for specified controller classes
+ String pluginClasses = System.getProperty("jinput.plugins", "") + System.getProperty("net.java.games.input.plugins", "");
+ if(!pluginClasses.equals("")) {
+ ArrayList pluginClassList = new ArrayList();
+ StringTokenizer pluginClassTok = new StringTokenizer(pluginClasses, " \t\n\r\f,;:");
+ while(pluginClassTok.hasMoreTokens()) {
+ String className = pluginClassTok.nextToken();
+ try {
+ ControllerEnvironment ce = (ControllerEnvironment) Class.forName(className).newInstance();
+ addControllers(ce.getControllers());
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
Controller[] ret = new Controller[controllers.size()];
Iterator it = controllers.iterator();