All classes use Sys.initialize now
This commit is contained in:
parent
c093f3ace1
commit
b98677fb47
|
@ -75,7 +75,7 @@ public final class Display {
|
||||||
public static final int PLATFORM_AGL = 2;
|
public static final int PLATFORM_AGL = 2;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
Sys.initialize();
|
||||||
init();
|
init();
|
||||||
Sys.log("Adapter: "+getAdapter()+" Version: "+getVersion());
|
Sys.log("Adapter: "+getAdapter()+" Version: "+getVersion());
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,8 @@ public final class Sys {
|
||||||
*/
|
*/
|
||||||
public static final boolean DEBUG = Boolean.getBoolean("org.lwjgl.Sys.debug");
|
public static final boolean DEBUG = Boolean.getBoolean("org.lwjgl.Sys.debug");
|
||||||
|
|
||||||
|
private static boolean initialized = false;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
|
@ -123,7 +125,10 @@ public final class Sys {
|
||||||
/**
|
/**
|
||||||
* Initialization.
|
* Initialization.
|
||||||
*/
|
*/
|
||||||
private static void initialize() {
|
public static void initialize() {
|
||||||
|
if (initialized)
|
||||||
|
return;
|
||||||
|
initialized = true;
|
||||||
System.loadLibrary(LIBRARY_NAME);
|
System.loadLibrary(LIBRARY_NAME);
|
||||||
setDebug(DEBUG);
|
setDebug(DEBUG);
|
||||||
setTime(0);
|
setTime(0);
|
||||||
|
|
|
@ -146,7 +146,9 @@ public class Controller {
|
||||||
* Static initialization
|
* Static initialization
|
||||||
*/
|
*/
|
||||||
private static void initialize() {
|
private static void initialize() {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
if (initialized)
|
||||||
|
return;
|
||||||
|
Sys.initialize();
|
||||||
initIDs();
|
initIDs();
|
||||||
|
|
||||||
// Assign names to all the buttons
|
// Assign names to all the buttons
|
||||||
|
@ -166,9 +168,7 @@ public class Controller {
|
||||||
public static void create() throws Exception {
|
public static void create() throws Exception {
|
||||||
if (!Window.isCreated())
|
if (!Window.isCreated())
|
||||||
throw new IllegalStateException("Window must be created before you can create Controller");
|
throw new IllegalStateException("Window must be created before you can create Controller");
|
||||||
if (!initialized) {
|
initialize();
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (created) {
|
if (created) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -49,10 +49,6 @@ import org.lwjgl.Sys;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Cursor {
|
public class Cursor {
|
||||||
|
|
||||||
/** Lazy initialization */
|
|
||||||
private static boolean initialized = false;
|
|
||||||
|
|
||||||
/** First element to display */
|
/** First element to display */
|
||||||
private CursorElement[] cursors = null;
|
private CursorElement[] cursors = null;
|
||||||
|
|
||||||
|
@ -86,10 +82,7 @@ public class Cursor {
|
||||||
if (yHotspot >= height || yHotspot < 0)
|
if (yHotspot >= height || yHotspot < 0)
|
||||||
throw new IllegalArgumentException("yHotspot > height || yHotspot < 0");
|
throw new IllegalArgumentException("yHotspot > height || yHotspot < 0");
|
||||||
|
|
||||||
// initialize
|
Sys.initialize();
|
||||||
if (!initialized) {
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hmm
|
// Hmm
|
||||||
yHotspot = height - 1 - yHotspot;
|
yHotspot = height - 1 - yHotspot;
|
||||||
|
@ -98,14 +91,6 @@ public class Cursor {
|
||||||
createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
|
createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the cursor class
|
|
||||||
*/
|
|
||||||
private static void initialize() {
|
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
|
||||||
initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the actual cursor, using a platform specific class
|
* Creates the actual cursor, using a platform specific class
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -268,7 +268,9 @@ public class Keyboard {
|
||||||
* Static initialization
|
* Static initialization
|
||||||
*/
|
*/
|
||||||
private static void initialize() {
|
private static void initialize() {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
if (initialized)
|
||||||
|
return;
|
||||||
|
Sys.initialize();
|
||||||
initIDs();
|
initIDs();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class Mouse {
|
||||||
* Static initialization
|
* Static initialization
|
||||||
*/
|
*/
|
||||||
private static void initialize() {
|
private static void initialize() {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
Sys.initialize();
|
||||||
initIDs();
|
initIDs();
|
||||||
|
|
||||||
// Assign names to all the buttons
|
// Assign names to all the buttons
|
||||||
|
@ -245,9 +245,7 @@ public class Mouse {
|
||||||
if (!Window.isCreated())
|
if (!Window.isCreated())
|
||||||
throw new IllegalStateException("Window must be created prior to creating mouse");
|
throw new IllegalStateException("Window must be created prior to creating mouse");
|
||||||
|
|
||||||
if (!initialized) {
|
initialize();
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
if (created) {
|
if (created) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,14 +77,7 @@ public abstract class AL {
|
||||||
protected static boolean created;
|
protected static boolean created;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initialize();
|
Sys.initialize();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static initialization
|
|
||||||
*/
|
|
||||||
private static void initialize() {
|
|
||||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,6 +34,8 @@ package org.lwjgl.openal;
|
||||||
import java.nio.Buffer;
|
import java.nio.Buffer;
|
||||||
import java.nio.IntBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
|
import org.lwjgl.Sys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
|
@ -140,7 +142,7 @@ public class ALC {
|
||||||
public static final int ALC_OUT_OF_MEMORY = 0xA005;
|
public static final int ALC_OUT_OF_MEMORY = 0xA005;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
initialize();
|
Sys.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a new instance of ALC */
|
/** Creates a new instance of ALC */
|
||||||
|
@ -153,13 +155,6 @@ public class ALC {
|
||||||
protected static void init() {
|
protected static void init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Static initialization
|
|
||||||
*/
|
|
||||||
private static void initialize() {
|
|
||||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the ALC instance
|
* Creates the ALC instance
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package org.lwjgl.openal.eax;
|
|
||||||
|
package org.lwjgl.openal.eax;
|
||||||
|
|
||||||
|
import org.lwjgl.Sys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* $Id$
|
||||||
|
@ -40,65 +43,57 @@
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
*/
|
*/
|
||||||
public class EAX {
|
public class EAX {
|
||||||
|
/** Has the EAX object been created? */
|
||||||
|
protected static boolean created;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Sys.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
/** Has the EAX object been created? */
|
/**
|
||||||
protected static boolean created;
|
* Loads the EAX functions
|
||||||
|
*
|
||||||
static {
|
* @throws Exception if the EAX extensions couldn't be loaded
|
||||||
initialize();
|
*/
|
||||||
}
|
public static void create() throws Exception {
|
||||||
|
if (created) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
if (!nCreate()) {
|
||||||
* Static initialization
|
throw new Exception("EAX instance could not be created.");
|
||||||
*/
|
}
|
||||||
private static void initialize() {
|
EAX20.init();
|
||||||
System.loadLibrary(org.lwjgl.Sys.getLibraryName());
|
created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the EAX functions
|
* Native method to create EAX instance
|
||||||
*
|
*
|
||||||
* @throws Exception if the EAX extensions couldn't be loaded
|
* @return true if the EAX extensions could be found
|
||||||
*/
|
*/
|
||||||
public static void create() throws Exception {
|
protected static native boolean nCreate();
|
||||||
if (created) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!nCreate()) {
|
/**
|
||||||
throw new Exception("EAX instance could not be created.");
|
* "Destroy" the EAX object
|
||||||
}
|
*/
|
||||||
EAX20.init();
|
public static void destroy() {
|
||||||
created = true;
|
if (!created) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
created = false;
|
||||||
|
nDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method to create EAX instance
|
* Native method the destroy the EAX
|
||||||
*
|
*/
|
||||||
* @return true if the EAX extensions could be found
|
protected static native void nDestroy();
|
||||||
*/
|
|
||||||
protected static native boolean nCreate();
|
/**
|
||||||
|
* @return true if EAX has been created
|
||||||
/**
|
*/
|
||||||
* "Destroy" the EAX object
|
public static boolean isCreated() {
|
||||||
*/
|
return created;
|
||||||
public static void destroy() {
|
}
|
||||||
if (!created) {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
created = false;
|
|
||||||
nDestroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Native method the destroy the EAX
|
|
||||||
*/
|
|
||||||
protected static native void nDestroy();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if EAX has been created
|
|
||||||
*/
|
|
||||||
public static boolean isCreated() {
|
|
||||||
return created;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -167,7 +167,7 @@ public final class GLContext {
|
||||||
public static boolean OpenGL15;
|
public static boolean OpenGL15;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
Sys.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -155,7 +155,7 @@ public final class Pbuffer {
|
||||||
private final int height;
|
private final int height;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
Sys.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.lwjgl.input.Mouse;
|
||||||
public final class Window {
|
public final class Window {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.loadLibrary(Sys.getLibraryName());
|
Sys.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** X coordinate of the window */
|
/** X coordinate of the window */
|
||||||
|
|
Loading…
Reference in New Issue