Tidied up unused variables, added serialVersionUIDs as appropriate,

removed a few unnecessary casts and brackets and exceptions.
This commit is contained in:
Caspian Rychlik-Prince 2006-04-21 11:11:21 +00:00
parent 5db7a9a7b8
commit 16524516cd
22 changed files with 42 additions and 26 deletions

View File

@ -43,6 +43,8 @@ package org.lwjgl;
*/
public class LWJGLException extends Exception {
private static final long serialVersionUID = 1L;
/**
* Plain c'tor
*/

View File

@ -42,6 +42,8 @@ package org.lwjgl.openal;
*/
public class OpenALException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* Constructor for OpenALException.
*/

View File

@ -55,6 +55,9 @@ import org.lwjgl.Sys;
* $Id$
*/
public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener, HierarchyListener {
private static final long serialVersionUID = 1L;
private final static AWTCanvasImplementation implementation;
private boolean update_context;
private Object SYNC_LOCK = new Object();
@ -173,7 +176,7 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
/**
* Set swap interval.
*/
public void setSwapInterval(int swap_interval) throws LWJGLException {
public void setSwapInterval(int swap_interval) {
synchronized(SYNC_LOCK) {
if (context == null)
throw new IllegalStateException("Canvas not yet displayable");
@ -184,7 +187,7 @@ public class AWTGLCanvas extends Canvas implements Drawable, ComponentListener,
/**
* Enable vsync
*/
public void setVSyncEnabled(boolean enabled) throws LWJGLException {
public void setVSyncEnabled(boolean enabled) {
setSwapInterval(enabled ? 1 : 0);
}

View File

@ -355,7 +355,7 @@ public final class Display {
* @param fps The desired frame rate, in frames per second
*/
public static void sync3(int fps) {
float frameTime = 1.0f / (float) (fps > 1 ? fps - 1 : 1);
float frameTime = 1.0f / (fps > 1 ? fps - 1 : 1);
timeNow = Sys.getTime();
while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameTime) {
// This is a system-friendly way of allowing other stuff to use CPU if it wants to
@ -685,7 +685,7 @@ public final class Display {
// We haven't used GLU here to do this to avoid an unnecessary dependency.
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0.0, (double) current_mode.getWidth(), 0.0, (double) current_mode.getHeight(), -1.0, 1.0);
GL11.glOrtho(0.0, current_mode.getWidth(), 0.0, current_mode.getHeight(), -1.0, 1.0);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();
GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight());

View File

@ -264,7 +264,7 @@ final class KeyboardEventQueue extends EventQueue implements KeyListener {
if ( key_states[key_code_mapped] == state )
return;
key_states[key_code_mapped] = state;
int key_int_char = ((int)character) & 0xffff;
int key_int_char = character & 0xffff;
putKeyboardEvent(key_code_mapped, state, key_int_char);
}

View File

@ -287,8 +287,6 @@ final class MacOSXDisplay implements DisplayImplementation {
native void getMouseDeltas(IntBuffer delta_buffer);
private native void updateContext();
public void reshape(int x, int y, int width, int height) {
frame.resize(x, y, width, height);
}

View File

@ -55,13 +55,14 @@ import org.lwjgl.LWJGLException;
final class MacOSXFrame extends Frame implements WindowListener, ComponentListener {
private static final long serialVersionUID = -5823294716668988777L;
private final MacOSXGLCanvas canvas;
private boolean close_requested;
/* States */
private Rectangle bounds;
private boolean active;
private boolean visible;
private boolean minimized;
private boolean should_warp_cursor;

View File

@ -47,6 +47,8 @@ import java.awt.event.HierarchyListener;
final class MacOSXGLCanvas extends Canvas implements ComponentListener, HierarchyListener {
private static final long serialVersionUID = 6916664741667434870L;
private int width;
private int height;
private boolean context_update;

View File

@ -43,6 +43,8 @@ import org.lwjgl.opengl.glu.GLU;
*/
public class OpenGLException extends RuntimeException {
private static final long serialVersionUID = 1L;
/** Constructor for OpenGLException. */
public OpenGLException(int gl_error_code) {
this(createErrorMessage(gl_error_code));

View File

@ -234,7 +234,7 @@ public class MipMap extends Util {
for ( i = 0; i < heightIn; i++ ) {
int ubptr = i * rowstride + pss.unpackSkipRows * rowstride + pss.unpackSkipPixels * components;
for ( j = 0; j < widthIn * components; j++ ) {
tempIn[k++] = (float)((int)dataIn.get(ubptr++) & 0xff);
tempIn[k++] = dataIn.get(ubptr++) & 0xff;
}
}
break;

View File

@ -83,11 +83,10 @@ public class PartialDisk extends Quadric {
float startAngle,
float sweepAngle) {
int i, j, max;
int i, j;
float[] sinCache = new float[CACHE_SIZE];
float[] cosCache = new float[CACHE_SIZE];
float angle;
float x, y;
float sintemp, costemp;
float deltaRadius;
float radiusLow, radiusHigh;

View File

@ -462,7 +462,7 @@ public final class Color implements ReadableColor, Serializable, WritableColor {
int i1 = r >= g ? g : r;
if (b < i1)
i1 = b;
float brightness = (float) l / 255F;
float brightness = l / 255F;
float saturation;
if (l != 0)
saturation = (float) (l - i1) / (float) l;

View File

@ -163,7 +163,7 @@ public final class Display {
final FieldAccessor[] field;
Sorter() throws NoSuchFieldException {
Sorter() {
field = new FieldAccessor[param.length];
for (int i = 0; i < field.length; i ++) {
int idx = param[i].indexOf('=');

View File

@ -62,10 +62,8 @@ public class XPMFile {
* @param is
* InputStream to read file from
* @return XPMFile loaded, or exception
* @throws IOException
* If any IO exceptions occurs while reading file
*/
public static XPMFile load(InputStream is) throws IOException {
public static XPMFile load(InputStream is) {
XPMFile xFile = new XPMFile();
xFile.readImage(is);
return xFile;
@ -94,11 +92,8 @@ public class XPMFile {
/**
* Read the image from the specified file.
*
* @throws IOException
* If any IO exceptions occurs while reading file
*/
private void readImage(InputStream is) throws IOException {
private void readImage(InputStream is) {
try {
LineNumberReader reader = new LineNumberReader(
new InputStreamReader(is));

View File

@ -25,16 +25,14 @@
package org.lwjgl.util.jinput;
import java.io.IOException;
import net.java.games.input.AbstractComponent;
import net.java.games.input.Mouse;
import net.java.games.input.Component;
import net.java.games.input.Controller;
import net.java.games.input.Rumbler;
import net.java.games.input.Event;
import java.util.List;
import java.util.ArrayList;
import java.io.IOException;
import net.java.games.input.Mouse;
import net.java.games.input.Rumbler;
/**
* @author elias

View File

@ -45,6 +45,8 @@ import java.nio.FloatBuffer;
public class Matrix2f extends Matrix implements Serializable {
private static final long serialVersionUID = 1L;
public float m00 = 1.0f, m01, m10, m11 = 1.0f;
/**

View File

@ -45,6 +45,8 @@ import java.nio.FloatBuffer;
public class Matrix3f extends Matrix implements Serializable {
private static final long serialVersionUID = 1L;
public float m00 = 1.0f,
m01,
m02,

View File

@ -41,6 +41,8 @@ import java.nio.FloatBuffer;
*/
public class Matrix4f extends Matrix implements Serializable {
private static final long serialVersionUID = 1L;
public float m00 = 1.0f, m01, m02, m03, m10, m11 = 1.0f, m12, m13, m20, m21, m22 = 1.0f, m23, m30, m31, m32, m33 = 1.0f;
/**

View File

@ -44,6 +44,8 @@ import java.nio.FloatBuffer;
public class Quaternion extends Vector implements ReadableVector4f {
private static final long serialVersionUID = 1L;
private float x, y, z, w;
/**

View File

@ -45,6 +45,8 @@ import java.nio.FloatBuffer;
public class Vector2f extends Vector implements Serializable, ReadableVector2f, WritableVector2f {
private static final long serialVersionUID = 1L;
public float x, y;
/**

View File

@ -45,6 +45,8 @@ import java.nio.FloatBuffer;
public class Vector3f extends Vector implements Serializable, ReadableVector3f, WritableVector3f {
private static final long serialVersionUID = 1L;
public float x, y, z;
/**

View File

@ -45,6 +45,8 @@ import java.nio.FloatBuffer;
public class Vector4f extends Vector implements Serializable, ReadableVector4f, WritableVector4f {
private static final long serialVersionUID = 1L;
public float x, y, z, w;
/**