Renamed LWJGLErrorException to LWJGLException

This commit is contained in:
Elias Naur 2004-03-27 15:05:24 +00:00
parent 63b33930b1
commit 9d55bbb302
14 changed files with 77 additions and 77 deletions

View File

@ -131,9 +131,9 @@ public final class Display {
* still need to query the display's characteristics using getDisplayMode().
*
* @param mode The new display mode to set
* @throws LWJGLErrorException if the display mode could not be set
* @throws LWJGLException if the display mode could not be set
*/
public static native void setDisplayMode(DisplayMode mode) throws LWJGLErrorException;
public static native void setDisplayMode(DisplayMode mode) throws LWJGLException;
/**
* Reset the display mode to whatever it was when LWJGL was initialized.
@ -195,14 +195,14 @@ public final class Display {
* @param brightness The brightness value between -1.0 and 1.0, inclusive
* @param contrast The contrast, larger than 0.0.
*/
public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLErrorException {
public static void setDisplayConfiguration(float gamma, float brightness, float contrast) throws LWJGLException {
if (brightness < -1.0f || brightness > 1.0f)
throw new IllegalArgumentException("Invalid brightness value");
if (contrast < 0.0f)
throw new IllegalArgumentException("Invalid contrast value");
int rampSize = getGammaRampLength();
if (rampSize == 0) {
throw new LWJGLErrorException("Display configuration not supported");
throw new LWJGLException("Display configuration not supported");
}
FloatBuffer gammaRamp = ByteBuffer.allocateDirect(rampSize*4).order(ByteOrder.nativeOrder()).asFloatBuffer();
for (int i = 0; i < rampSize; i++) {
@ -235,7 +235,7 @@ public final class Display {
/**
* Native method to set the gamma ramp.
*/
private static native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLErrorException;
private static native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException;
/**
* Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2",

View File

@ -1,7 +0,0 @@
package org.lwjgl;
public class LWJGLErrorException extends Exception {
public LWJGLErrorException(String msg) {
super(msg);
}
}

View File

@ -0,0 +1,7 @@
package org.lwjgl;
public class LWJGLException extends Exception {
public LWJGLException(String msg) {
super(msg);
}
}

View File

@ -128,7 +128,7 @@ public final class Sys {
System.loadLibrary(LIBRARY_NAME);
String native_version = getNativeLibraryVersion();
if (!native_version.equals(VERSION))
throw new IllegalStateException("Version mismatch: jar version is '" + VERSION +
throw new LinkageError("Version mismatch: jar version is '" + VERSION +
"', native libary version is '" + native_version + "'");
setDebug(DEBUG);
setTime(0);

View File

@ -37,7 +37,7 @@ import java.util.Map;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Window;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -164,9 +164,9 @@ public class Controller {
/**
* "Create" the controller. The display must first have been created.
* @throws LWJGLErrorException if the controller could not be created for any reason
* @throws LWJGLException if the controller could not be created for any reason
*/
public static void create() throws LWJGLErrorException {
public static void create() throws LWJGLException {
if (!Window.isCreated())
throw new IllegalStateException("Window must be created before you can create Controller");
initialize();
@ -268,7 +268,7 @@ public class Controller {
/**
* Native method to create the controller
*/
private static native void nCreate() throws LWJGLErrorException;
private static native void nCreate() throws LWJGLException;
/**
* Native method the destroy the controller

View File

@ -37,7 +37,7 @@ import java.nio.ByteOrder;
import java.nio.IntBuffer;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -69,9 +69,9 @@ public class Cursor {
* @param numImages number of cursor images specified. Must be 1 if animations are not supported.
* @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL.
* @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null
* @throws LWJGLErrorException if the cursor could not be created for any reason
* @throws LWJGLException if the cursor could not be created for any reason
*/
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLErrorException {
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
if (!Mouse.isCreated())
throw new IllegalStateException("Mouse must be created before creating cursor objects");
if (width*height*numImages > images.remaining())
@ -95,7 +95,7 @@ public class Cursor {
/**
* Creates the actual cursor, using a platform specific class
*/
private void createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLErrorException {
private void createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
// create copy and flip images to match ogl
IntBuffer images_copy = ByteBuffer.allocateDirect(images.remaining()*4).order(ByteOrder.nativeOrder()).asIntBuffer();
flipImages(width, height, numImages, images, images_copy);

View File

@ -41,7 +41,7 @@ import java.util.Map;
import org.lwjgl.BufferUtils;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Window;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -285,9 +285,9 @@ public class Keyboard {
* "Create" the keyboard. The display must first have been created. The
* reason for this is so the keyboard has a window to "focus" in.
*
* @throws LWJGLErrorException if the keyboard could not be created for any reason
* @throws LWJGLException if the keyboard could not be created for any reason
*/
public static void create() throws LWJGLErrorException {
public static void create() throws LWJGLException {
if (!Window.isCreated())
throw new IllegalStateException("Window must be created before you can create Keyboard");
if (!initialized)
@ -301,7 +301,7 @@ public class Keyboard {
/**
* Native method to create the keyboard
*/
private static native void nCreate() throws LWJGLErrorException;
private static native void nCreate() throws LWJGLException;
/**
* @return true if the keyboard has been created
@ -389,7 +389,7 @@ public class Keyboard {
* Enable keyboard translation. Must be called after the keyboard is created,
* and keyboard buffering must be enabled.
*/
public static void enableTranslation() throws LWJGLErrorException {
public static void enableTranslation() throws LWJGLException {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can read events");
if (readBuffer == null)
@ -401,12 +401,12 @@ public class Keyboard {
/**
* Native method to enable the translation buffer
*/
private static native void nEnableTranslation() throws LWJGLErrorException;
private static native void nEnableTranslation() throws LWJGLException;
/**
* Enable keyboard buffering. Must be called after the keyboard is created.
*/
public static void enableBuffer() throws LWJGLErrorException {
public static void enableBuffer() throws LWJGLException {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can enable buffering");
readBuffer = BufferUtils.createByteBuffer(4*BUFFER_SIZE);
@ -419,7 +419,7 @@ public class Keyboard {
* @return the event buffer,
* or null if no buffer can be allocated
*/
private static native void nEnableBuffer() throws LWJGLErrorException;
private static native void nEnableBuffer() throws LWJGLException;
/**
* Checks to see if a key is down.

View File

@ -39,7 +39,7 @@ import java.util.Map;
import org.lwjgl.BufferUtils;
import org.lwjgl.Sys;
import org.lwjgl.opengl.Window;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -165,9 +165,9 @@ public class Mouse {
*
* @param cursor the native cursor object to bind. May be null.
* @return The previous Cursor object set, or null.
* @throws LWJGLErrorException if the cursor could not be set for any reason
* @throws LWJGLException if the cursor could not be set for any reason
*/
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLErrorException {
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
if (!created)
throw new IllegalStateException("Create the Mouse before setting the native cursor");
if ((getNativeCursorCaps() & CURSOR_ONE_BIT_TRANSPARENCY) == 0)
@ -184,7 +184,7 @@ public class Mouse {
}
/** Native method to set the native cursor */
private static native void nSetNativeCursor(long handle) throws LWJGLErrorException;
private static native void nSetNativeCursor(long handle) throws LWJGLException;
/**
* Gets the minimum size of a native cursor. Can only be called if
@ -239,9 +239,9 @@ public class Mouse {
/**
* "Create" the mouse. The display must first have been created.
*
* @throws LWJGLErrorException if the mouse could not be created for any reason
* @throws LWJGLException if the mouse could not be created for any reason
*/
public static void create() throws LWJGLErrorException {
public static void create() throws LWJGLException {
if (!Window.isCreated())
throw new IllegalStateException("Window must be created prior to creating mouse");
@ -294,7 +294,7 @@ public class Mouse {
if (currentCursor != null) {
try {
setNativeCursor(null);
} catch (LWJGLErrorException e) {
} catch (LWJGLException e) {
if (Sys.DEBUG)
e.printStackTrace();
}
@ -402,7 +402,7 @@ public class Mouse {
/**
* Enable mouse button buffering. Must be called after the mouse is created.
*/
public static void enableBuffer() throws LWJGLErrorException {
public static void enableBuffer() throws LWJGLException {
if (!created)
throw new IllegalStateException("Mouse must be created before you can enable buffering");
readBuffer = BufferUtils.createByteBuffer(2*BUFFER_SIZE);
@ -415,7 +415,7 @@ public class Mouse {
* @return the event buffer,
* or null if no buffer can be allocated
*/
private static native void nEnableBuffer() throws LWJGLErrorException;
private static native void nEnableBuffer() throws LWJGLException;
/**
* Reads all button events since last read.
@ -546,7 +546,7 @@ public class Mouse {
currentCursor.nextCursor();
try {
setNativeCursor(currentCursor);
} catch (LWJGLErrorException e) {
} catch (LWJGLException e) {
if (Sys.DEBUG)
e.printStackTrace();
}

View File

@ -37,7 +37,7 @@ import java.util.StringTokenizer;
import org.lwjgl.Display;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -87,7 +87,7 @@ public abstract class AL {
* @param oalPaths Array of strings containing paths to search for OpenAL library
* @return true if the AL creation process succeeded
*/
protected static native void nCreate(String[] oalPaths) throws LWJGLErrorException;
protected static native void nCreate(String[] oalPaths) throws LWJGLException;
/**
* Native method the destroy the AL
@ -112,7 +112,7 @@ public abstract class AL {
* @param contextSynchronized Flag, indicating a synchronous context.*
*/
public static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized)
throws LWJGLErrorException {
throws LWJGLException {
if (created) {
return;
@ -131,7 +131,7 @@ public abstract class AL {
* Creates an OpenAL instance. The empty create will cause OpenAL to
* open the default device, and create a context using default values.
*/
public static void create() throws LWJGLErrorException {
public static void create() throws LWJGLException {
if(created) {
return;
}
@ -152,7 +152,7 @@ public abstract class AL {
jwsLibname = "openal";
break;
default:
throw new LWJGLErrorException("Unknown platform");
throw new LWJGLException("Unknown platform");
}
String jwsPath = getPathFromJWS(jwsLibname);

View File

@ -35,7 +35,7 @@ import java.nio.Buffer;
import java.nio.IntBuffer;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -159,9 +159,9 @@ public class ALC {
/**
* Creates the ALC instance
*
* @throws LWJGLErrorException if a failiure occured in the ALC creation process
* @throws LWJGLException if a failiure occured in the ALC creation process
*/
protected static void create() throws LWJGLErrorException {
protected static void create() throws LWJGLException {
if (created) {
return;
}

View File

@ -33,7 +33,7 @@
package org.lwjgl.openal.eax;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
/**
* $Id$
@ -54,15 +54,15 @@ public class EAX {
/**
* Loads the EAX functions
*
* @throws LWJGLErrorException if the EAX extensions couldn't be loaded
* @throws LWJGLException if the EAX extensions couldn't be loaded
*/
public static void create() throws LWJGLErrorException {
public static void create() throws LWJGLException {
if (created) {
return;
}
if (!nCreate()) {
throw new LWJGLErrorException("EAX instance could not be created.");
throw new LWJGLException("EAX instance could not be created.");
}
EAX20.init();
created = true;

View File

@ -33,7 +33,7 @@
package org.lwjgl.opengl;
import org.lwjgl.Sys;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
import java.nio.IntBuffer;
@ -160,7 +160,7 @@ public final class Pbuffer {
}
/**
* Construct an instance of a Pbuffer. If this fails then an LWJGLErrorException will be thrown. The buffer is single-buffered.
* Construct an instance of a Pbuffer. If this fails then an LWJGLException will be thrown. The buffer is single-buffered.
* <p/>
* NOTE: An OpenGL window must be created before a Pbuffer can be created. The Pbuffer will have its own context that shares
* display lists and textures with the OpenGL window context, but it will have its own OpenGL state. Therefore, state changes
@ -183,7 +183,7 @@ public final class Pbuffer {
* 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported.
* @param renderTexture
*/
public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil, int samples, RenderTexture renderTexture) throws LWJGLErrorException {
public Pbuffer(int width, int height, int bpp, int alpha, int depth, int stencil, int samples, RenderTexture renderTexture) throws LWJGLException {
this.width = width;
this.height = height;
@ -241,7 +241,7 @@ public final class Pbuffer {
int bpp, int alpha, int depth, int stencil,
int samples,
IntBuffer pixelFormatCaps, int pixelFormatCapsSize,
IntBuffer pBufferAttribs, int pBufferAttribsSize) throws LWJGLErrorException;
IntBuffer pBufferAttribs, int pBufferAttribsSize) throws LWJGLException;
/**
* Destroys the Pbuffer. After this call, there will be no valid GL rendering context - regardless of whether this Pbuffer was

View File

@ -52,7 +52,7 @@ import org.lwjgl.Sys;
import org.lwjgl.input.Controller;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.LWJGLErrorException;
import org.lwjgl.LWJGLException;
public final class Window {
@ -287,33 +287,33 @@ public final class Window {
* buffer, probably no alpha buffer, and probably no multisampling.
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
* @param title
* @throws LWJGLErrorException
* @throws LWJGLException
*/
public static void create(String title) throws LWJGLErrorException {
public static void create(String title) throws LWJGLException {
create(title, Display.getDepth(), 0, 16, 8, 0);
}
/**
* Create a fullscreen window. If the underlying OS does not
* support fullscreen mode, then a window will be created instead. If this
* fails too then an LWJGLErrorException will be thrown.
* fails too then an LWJGLException will be thrown.
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
* @param title The title of the window
* @param bpp Minimum bits per pixel
* @param alpha Minimum bits per pixel in alpha buffer
* @param depth Minimum bits per pixel in depth buffer
* @param stencil Minimum bits per pixel in stencil buffer
* @throws LWJGLErrorException if the window could not be created for any reason; typically because
* @throws LWJGLException if the window could not be created for any reason; typically because
* the minimum requirements could not be met satisfactorily
*/
public static void create(String title, int bpp, int alpha, int depth, int stencil) throws LWJGLErrorException {
public static void create(String title, int bpp, int alpha, int depth, int stencil) throws LWJGLException {
create(title, bpp, alpha, depth, stencil, 0);
}
/**
* Create a fullscreen window. If the underlying OS does not
* support fullscreen mode, then a window will be created instead. If this
* fails too then an LWJGLErrorException will be thrown.
* fails too then an LWJGLException will be thrown.
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
* @param title The title of the window
* @param bpp Minimum bits per pixel
@ -322,10 +322,10 @@ public final class Window {
* @param stencil Minimum bits per pixel in stencil buffer
* @param samples Minimum samples in multisample buffer (corresponds to GL_SAMPLES_ARB in GL_ARB_multisample spec).
Pass 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported.
* @throws LWJGLErrorException if the window could not be created for any reason; typically because
* @throws LWJGLException if the window could not be created for any reason; typically because
* the minimum requirements could not be met satisfactorily
*/
public static void create(String title, int bpp, int alpha, int depth, int stencil, int samples) throws LWJGLErrorException {
public static void create(String title, int bpp, int alpha, int depth, int stencil, int samples) throws LWJGLException {
if (isCreated())
throw new IllegalStateException("Only one LWJGL window may be instantiated at any one time.");
Window.fullscreen = true;
@ -339,7 +339,7 @@ public final class Window {
/**
* Create a window. If the underlying OS does not have "floating" windows, then a fullscreen
* display will be created instead. If this fails too then an LWJGLErrorException will be thrown.
* display will be created instead. If this fails too then an LWJGLException will be thrown.
* If the window is created fullscreen, then its size may not match the specified size
* here.
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
@ -353,16 +353,16 @@ public final class Window {
* @param depth Minimum bits per pixel in depth buffer
* @param samples Minimum samples in multisample buffer (corresponds to GL_SAMPLES_ARB in GL_ARB_multisample spec).
Pass 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported.
* @throws LWJGLErrorException if the window could not be created for any reason; typically because
* @throws LWJGLException if the window could not be created for any reason; typically because
* the minimum requirements could not be met satisfactorily
*/
public static void create(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) throws LWJGLErrorException {
public static void create(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil) throws LWJGLException {
create(title, x, y, width, height, bpp, alpha, depth, stencil, 0);
}
/**
* Create a window. If the underlying OS does not have "floating" windows, then a fullscreen
* display will be created instead. If this fails too then an LWJGLErrorException will be thrown.
* display will be created instead. If this fails too then an LWJGLException will be thrown.
* If the window is created fullscreen, then its size may not match the specified size
* here.
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
@ -377,11 +377,11 @@ public final class Window {
* @param stencil Minimum bits per pixel in stencil buffer
* @param samples Minimum samples in multisample buffer (corresponds to GL_SAMPLES_ARB in GL_ARB_multisample spec).
Pass 0 to disable multisampling. This parameter is ignored if GL_ARB_multisample is not supported.
* @throws LWJGLErrorException if the window could not be created for any reason; typically because
* @throws LWJGLException if the window could not be created for any reason; typically because
* the minimum requirements could not be met satisfactorily
*/
public static void create(String title, int x, int y, int width, int height, int bpp, int alpha, int depth, int stencil, int samples)
throws LWJGLErrorException {
throws LWJGLException {
if (isCreated())
throw new IllegalStateException("Only one LWJGL window may be instantiated at any one time.");
Window.fullscreen = false;
@ -395,7 +395,7 @@ public final class Window {
/**
* Create the native window peer.
* @throws LWJGLErrorException
* @throws LWJGLException
*/
private static native void nCreate(
String title,
@ -409,9 +409,9 @@ public final class Window {
int depth,
int stencil,
int samples)
throws LWJGLErrorException;
throws LWJGLException;
private static void createWindow(int bpp, int alpha, int depth, int stencil, int samples) throws LWJGLErrorException {
private static void createWindow(int bpp, int alpha, int depth, int stencil, int samples) throws LWJGLException {
nCreate(title, x, y, width, height, fullscreen, bpp, alpha, depth, stencil, samples);
context = new Window();
makeCurrent();
@ -431,7 +431,7 @@ public final class Window {
Mouse.create();
createdMouse = true;
Mouse.enableBuffer();
} catch (LWJGLErrorException e) {
} catch (LWJGLException e) {
if (Sys.DEBUG) {
e.printStackTrace(System.err);
} else {
@ -445,7 +445,7 @@ public final class Window {
createdKeyboard = true;
Keyboard.enableBuffer();
Keyboard.enableTranslation();
} catch (LWJGLErrorException e) {
} catch (LWJGLException e) {
if (Sys.DEBUG) {
e.printStackTrace(System.err);
} else {
@ -457,7 +457,7 @@ public final class Window {
try {
Controller.create();
createdController = true;
} catch (LWJGLErrorException e) {
} catch (LWJGLException e) {
if (Sys.DEBUG) {
e.printStackTrace(System.err);
} else {

View File

@ -120,7 +120,7 @@ void throwOpenALException(JNIEnv * env, const char * err) {
}
void throwException(JNIEnv * env, const char * err) {
throwGeneralException(env, "org/lwjgl/LWJGLErrorException", err);
throwGeneralException(env, "org/lwjgl/LWJGLException", err);
}
void doExtension(JNIEnv *env, jobject ext_set, const char *method_name, const char *ext) {