From 0f30b506759df12a092ca647bcaac94985ec2fe4 Mon Sep 17 00:00:00 2001 From: endolf Date: Fri, 28 Nov 2003 22:47:24 +0000 Subject: 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 --- .../games/input/DefaultControllerEnvironment.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'coreAPI') 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(); -- cgit v1.2.3