From 351e6f5b196ea686f4e458058c9f691d5679debd Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Wed, 29 Jun 2005 20:47:18 +0000 Subject: [PATCH] support isCreated and destroy (destroy currently ignored) --- src/java/org/lwjgl/input/Controllers.java | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/java/org/lwjgl/input/Controllers.java b/src/java/org/lwjgl/input/Controllers.java index 727658d6..7efa1af4 100644 --- a/src/java/org/lwjgl/input/Controllers.java +++ b/src/java/org/lwjgl/input/Controllers.java @@ -29,12 +29,18 @@ public class Controllers { /** The current event */ private static ControllerEvent event; + /** Whether controllers were created */ + private static boolean created; + /** * Initialise the controllers collection * * @throws LWJGLException Indicates a failure to initialise the controller library. */ public static void create() throws LWJGLException { + if (created) + return; + try { String plugins = System.getProperty("jinput.plugins"); @@ -70,6 +76,8 @@ public class Controllers { createController(c); } + + created = true; } catch (Throwable e) { throw new LWJGLException("Failed to initialise controllers",e); } @@ -145,6 +153,35 @@ public class Controllers { return event != null; } + /** + * @return True if Controllers has been created + */ + public static boolean isCreated() { + return created; + } + + /** + * Destroys any resources used by the controllers + */ + public static void destroy() { +// FIXME! not currently possible to destroy a controller + +// if (!created) +// return; +// created = false; +// +// // nuke each controller +// for (int i=0;i