|
From: Elias N. <eli...@us...> - 2004-03-27 14:56:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31555/src/java/org/lwjgl/input Modified Files: Controller.java Cursor.java Keyboard.java Mouse.java Log Message: Added LWJGLErrorException to replace the too general Exception Index: Controller.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Controller.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Controller.java 27 Mar 2004 13:48:57 -0000 1.14 +++ Controller.java 27 Mar 2004 14:42:46 -0000 1.15 @@ -37,6 +37,7 @@ import org.lwjgl.Sys; import org.lwjgl.opengl.Window; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -163,9 +164,9 @@ /** * "Create" the controller. The display must first have been created. - * @throws Exception if the controller could not be created for any reason + * @throws LWJGLErrorException if the controller could not be created for any reason */ - public static void create() throws Exception { + public static void create() throws LWJGLErrorException { if (!Window.isCreated()) throw new IllegalStateException("Window must be created before you can create Controller"); initialize(); @@ -267,7 +268,7 @@ /** * Native method to create the controller */ - private static native void nCreate() throws Exception; + private static native void nCreate() throws LWJGLErrorException; /** * Native method the destroy the controller @@ -278,122 +279,122 @@ * Register fields with the native library */ private static native void initIDs(); - /** - * @return Returns the buttonCount. - */ - public static int getButtonCount() { - return buttonCount; - } + /** + * @return Returns the buttonCount. + */ + public static int getButtonCount() { + return buttonCount; + } - /** - * @return Returns whether POV is supported - */ - public static boolean hasPOV() { - return hasPOV; - } + /** + * @return Returns whether POV is supported + */ + public static boolean hasPOV() { + return hasPOV; + } - /** - * @return Returns whether a rotational x axis is supported - */ - public static boolean hasRXAxis() { - return hasRXAxis; - } + /** + * @return Returns whether a rotational x axis is supported + */ + public static boolean hasRXAxis() { + return hasRXAxis; + } - /** - * @return Returns whether a rotational y axis is supported - */ - public static boolean hasRYAxis() { - return hasRYAxis; - } + /** + * @return Returns whether a rotational y axis is supported + */ + public static boolean hasRYAxis() { + return hasRYAxis; + } - /** - * @return Returns whether a rotational z axis is supported - */ - public static boolean hasRZAxis() { - return hasRZAxis; - } + /** + * @return Returns whether a rotational z axis is supported + */ + public static boolean hasRZAxis() { + return hasRZAxis; + } - /** - * @return Returns whether a slider is supported - */ - public static boolean hasSlider() { - return hasSlider; - } + /** + * @return Returns whether a slider is supported + */ + public static boolean hasSlider() { + return hasSlider; + } - /** - * @return Returns whether a x axis is supported - */ - public static boolean hasXAxis() { - return hasXAxis; - } + /** + * @return Returns whether a x axis is supported + */ + public static boolean hasXAxis() { + return hasXAxis; + } - /** - * @return Returns whether a y axis is supported - */ - public static boolean hasYAxis() { - return hasYAxis; - } + /** + * @return Returns whether a y axis is supported + */ + public static boolean hasYAxis() { + return hasYAxis; + } - /** - * @return Returns whether a z axis is supported - */ - public static boolean hasZAxis() { - return hasZAxis; - } + /** + * @return Returns whether a z axis is supported + */ + public static boolean hasZAxis() { + return hasZAxis; + } - /** - * @return Returns the POV value - */ - public static int getPov() { - return pov; - } + /** + * @return Returns the POV value + */ + public static int getPov() { + return pov; + } - /** - * @return Returns the rotational value of the x axis - */ - public static int getRx() { - return rx; - } + /** + * @return Returns the rotational value of the x axis + */ + public static int getRx() { + return rx; + } - /** - * @return Returns the rotational value of the y axis - */ - public static int getRy() { - return ry; - } + /** + * @return Returns the rotational value of the y axis + */ + public static int getRy() { + return ry; + } - /** - * @return Returns the rotational value of the z axis - */ - public static int getRz() { - return rz; - } + /** + * @return Returns the rotational value of the z axis + */ + public static int getRz() { + return rz; + } - /** - * @return Returns the slider value - */ - public static int getSlider() { - return slider; - } + /** + * @return Returns the slider value + */ + public static int getSlider() { + return slider; + } - /** - * @return Returns the x axis value - */ - public static int getX() { - return x; - } + /** + * @return Returns the x axis value + */ + public static int getX() { + return x; + } - /** - * @return Returns the y axis value - */ - public static int getY() { - return y; - } + /** + * @return Returns the y axis value + */ + public static int getY() { + return y; + } - /** - * @return Returns the z axis value - */ - public static int getZ() { - return z; - } + /** + * @return Returns the z axis value + */ + public static int getZ() { + return z; + } } Index: Cursor.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Cursor.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Cursor.java 27 Mar 2004 13:48:57 -0000 1.18 +++ Cursor.java 27 Mar 2004 14:42:46 -0000 1.19 @@ -37,6 +37,7 @@ import java.nio.IntBuffer; import org.lwjgl.Sys; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -68,9 +69,9 @@ * @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 Exception if the cursor could not be created for any reason + * @throws LWJGLErrorException 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 Exception { + public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLErrorException { if (!Mouse.isCreated()) throw new IllegalStateException("Mouse must be created before creating cursor objects"); if (width*height*numImages > images.remaining()) @@ -94,7 +95,7 @@ /** * 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 Exception { + private void createCursors(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLErrorException { // 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); Index: Keyboard.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- Keyboard.java 27 Mar 2004 13:48:57 -0000 1.42 +++ Keyboard.java 27 Mar 2004 14:42:46 -0000 1.43 @@ -41,6 +41,7 @@ import org.lwjgl.BufferUtils; import org.lwjgl.Sys; import org.lwjgl.opengl.Window; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -284,9 +285,9 @@ * "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 Exception if the keyboard could not be created for any reason + * @throws LWJGLErrorException if the keyboard could not be created for any reason */ - public static void create() throws Exception { + public static void create() throws LWJGLErrorException { if (!Window.isCreated()) throw new IllegalStateException("Window must be created before you can create Keyboard"); if (!initialized) @@ -300,7 +301,7 @@ /** * Native method to create the keyboard */ - private static native void nCreate() throws Exception; + private static native void nCreate() throws LWJGLErrorException; /** * @return true if the keyboard has been created @@ -388,7 +389,7 @@ * Enable keyboard translation. Must be called after the keyboard is created, * and keyboard buffering must be enabled. */ - public static void enableTranslation() throws Exception { + public static void enableTranslation() throws LWJGLErrorException { if (!created) throw new IllegalStateException("Keyboard must be created before you can read events"); if (readBuffer == null) @@ -400,12 +401,12 @@ /** * Native method to enable the translation buffer */ - private static native void nEnableTranslation() throws Exception; + private static native void nEnableTranslation() throws LWJGLErrorException; /** * Enable keyboard buffering. Must be called after the keyboard is created. */ - public static void enableBuffer() throws Exception { + public static void enableBuffer() throws LWJGLErrorException { if (!created) throw new IllegalStateException("Keyboard must be created before you can enable buffering"); readBuffer = BufferUtils.createByteBuffer(4*BUFFER_SIZE); @@ -418,7 +419,7 @@ * @return the event buffer, * or null if no buffer can be allocated */ - private static native void nEnableBuffer() throws Exception; + private static native void nEnableBuffer() throws LWJGLErrorException; /** * Checks to see if a key is down. Index: Mouse.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- Mouse.java 27 Mar 2004 13:48:57 -0000 1.44 +++ Mouse.java 27 Mar 2004 14:42:46 -0000 1.45 @@ -39,6 +39,7 @@ import org.lwjgl.BufferUtils; import org.lwjgl.Sys; import org.lwjgl.opengl.Window; +import org.lwjgl.LWJGLErrorException; /** * $Id$ @@ -164,9 +165,9 @@ * * @param cursor the native cursor object to bind. May be null. * @return The previous Cursor object set, or null. - * @throws Exception if the cursor could not be set for any reason + * @throws LWJGLErrorException if the cursor could not be set for any reason */ - public static Cursor setNativeCursor(Cursor cursor) throws Exception { + public static Cursor setNativeCursor(Cursor cursor) throws LWJGLErrorException { if (!created) throw new IllegalStateException("Create the Mouse before setting the native cursor"); if ((getNativeCursorCaps() & CURSOR_ONE_BIT_TRANSPARENCY) == 0) @@ -183,7 +184,7 @@ } /** Native method to set the native cursor */ - private static native void nSetNativeCursor(long handle) throws Exception; + private static native void nSetNativeCursor(long handle) throws LWJGLErrorException; /** * Gets the minimum size of a native cursor. Can only be called if @@ -238,9 +239,9 @@ /** * "Create" the mouse. The display must first have been created. * - * @throws Exception if the mouse could not be created for any reason + * @throws LWJGLErrorException if the mouse could not be created for any reason */ - public static void create() throws Exception { + public static void create() throws LWJGLErrorException { if (!Window.isCreated()) throw new IllegalStateException("Window must be created prior to creating mouse"); @@ -293,7 +294,7 @@ if (currentCursor != null) { try { setNativeCursor(null); - } catch (Exception e) { + } catch (LWJGLErrorException e) { if (Sys.DEBUG) e.printStackTrace(); } @@ -401,7 +402,7 @@ /** * Enable mouse button buffering. Must be called after the mouse is created. */ - public static void enableBuffer() throws Exception { + public static void enableBuffer() throws LWJGLErrorException { if (!created) throw new IllegalStateException("Mouse must be created before you can enable buffering"); readBuffer = BufferUtils.createByteBuffer(2*BUFFER_SIZE); @@ -414,7 +415,7 @@ * @return the event buffer, * or null if no buffer can be allocated */ - private static native void nEnableBuffer() throws Exception; + private static native void nEnableBuffer() throws LWJGLErrorException; /** * Reads all button events since last read. @@ -545,7 +546,7 @@ currentCursor.nextCursor(); try { setNativeCursor(currentCursor); - } catch (Exception e) { + } catch (LWJGLErrorException e) { if (Sys.DEBUG) e.printStackTrace(); } |