formatting and better javadoc
This commit is contained in:
parent
3a28d769a7
commit
7bff025626
|
@ -95,8 +95,9 @@ public final class Display {
|
|||
String title)
|
||||
throws Exception {
|
||||
|
||||
if (created)
|
||||
if (created) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!nCreate(displayMode.width,
|
||||
displayMode.height,
|
||||
|
@ -106,8 +107,9 @@ public final class Display {
|
|||
displayMode.depth,
|
||||
displayMode.stencil,
|
||||
fullscreen,
|
||||
title))
|
||||
title)) {
|
||||
throw new Exception("Failed to set display mode to " + displayMode);
|
||||
}
|
||||
|
||||
created = true;
|
||||
mode = displayMode;
|
||||
|
@ -135,8 +137,10 @@ public final class Display {
|
|||
* been created no action is taken.
|
||||
*/
|
||||
public static void destroy() {
|
||||
if (!created)
|
||||
if (!created) {
|
||||
return;
|
||||
}
|
||||
|
||||
nDestroy();
|
||||
created = false;
|
||||
mode = null;
|
||||
|
@ -148,6 +152,8 @@ public final class Display {
|
|||
private static native void nDestroy();
|
||||
|
||||
/**
|
||||
* Retrieves the width of the created display
|
||||
*
|
||||
* @return the current display width.
|
||||
* @throws AssertionError if the display has not been created yet.
|
||||
*/
|
||||
|
@ -157,6 +163,8 @@ public final class Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the height of the created display
|
||||
*
|
||||
* @return the current display height.
|
||||
* @throws AssertionError if the display has not been created yet.
|
||||
*/
|
||||
|
@ -166,6 +174,8 @@ public final class Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current display depth of the created display
|
||||
*
|
||||
* @return the current display depth.
|
||||
* @throws AssertionError if the display has not been created yet.
|
||||
*/
|
||||
|
@ -175,6 +185,8 @@ public final class Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the current display frequency of the created display
|
||||
*
|
||||
* @return the current display frequency.
|
||||
* @throws AssertionError if the display has not been created yet.
|
||||
*/
|
||||
|
@ -184,6 +196,9 @@ public final class Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the <code>DisplayMode</code> that the display has currently been
|
||||
* set to.
|
||||
*
|
||||
* @return the current display mode, or null if the display is not yet created
|
||||
* @throws AssertionError if the display has not been created yet.
|
||||
*/
|
||||
|
@ -193,6 +208,8 @@ public final class Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the native handle to the created window
|
||||
*
|
||||
* @return the native handle
|
||||
* @throws AssertionError if the display has not been created yet.
|
||||
*/
|
||||
|
@ -202,6 +219,8 @@ public final class Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests whether or not the display has been created
|
||||
*
|
||||
* @return true if the display has been created
|
||||
*/
|
||||
public static boolean isCreated() {
|
||||
|
@ -220,6 +239,9 @@ public final class Display {
|
|||
|
||||
/**
|
||||
* Determines if the user has requested that the application should close.
|
||||
* When a user has requested that the application should shutdown, it is up to
|
||||
* the application to perform the actual shutdown and cleanup of any allocated
|
||||
* resources.
|
||||
*
|
||||
* @return true if the user has requested that the application should close
|
||||
*/
|
||||
|
|
|
@ -35,7 +35,9 @@ package org.lwjgl;
|
|||
/**
|
||||
* $Id$
|
||||
*
|
||||
* Describes a display mode.
|
||||
* This class encapsulates the properties for a given display mode.
|
||||
* This class is not instantiable, and is aquired from the <code>Display.
|
||||
* getAvailableDisplayModes()</code> method.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
|
@ -43,6 +45,7 @@ package org.lwjgl;
|
|||
|
||||
public final class DisplayMode {
|
||||
|
||||
/** properties of the display mode */
|
||||
public final int width, height, bpp, freq, alpha, depth, stencil;
|
||||
|
||||
/**
|
||||
|
@ -61,12 +64,15 @@ public final class DisplayMode {
|
|||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Tests for <code>DisplayMode</code> equality
|
||||
*
|
||||
* @see java.lang.Object#equals(Object)
|
||||
*/
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof DisplayMode))
|
||||
if (obj == null || !(obj instanceof DisplayMode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DisplayMode dm = (DisplayMode) obj;
|
||||
return dm.width == width
|
||||
|
@ -78,14 +84,18 @@ public final class DisplayMode {
|
|||
&& dm.stencil == stencil;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Retrieves the hashcode for this object
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
public int hashCode() {
|
||||
return width ^ height ^ freq ^ bpp ^ alpha ^ (depth << 8) ^ (stencil << 24);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/**
|
||||
* Retrieves a String representation of this <code>DisplayMode</code>
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
|
@ -106,5 +116,4 @@ public final class DisplayMode {
|
|||
sb.append("bit stencil");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -43,10 +43,8 @@ import org.lwjgl.Sys;
|
|||
*
|
||||
* No buffering is available.
|
||||
*
|
||||
* Currently n (native limits, currently 128 - might change) buttons, the x, y,
|
||||
* z axis is supported along with a POV (or HAT) and a slider, where the z axis
|
||||
* represents a throttle. In the future the controller may support more buttons
|
||||
* and axises and other features. but this is a platform issue.
|
||||
* Currently n (native limits) buttons, the x, y, z axis (also rotational x,y ,
|
||||
* z axis) is supported along with a POV (or HAT) and a slider
|
||||
*
|
||||
* The Controller implementation currently only supports the first attached device.
|
||||
*
|
||||
|
@ -104,15 +102,31 @@ public class Controller {
|
|||
/** Constant specifying westward POV */
|
||||
public static final int POV_WEST = 9000;
|
||||
|
||||
/* Controller capabilities */
|
||||
/** Number of buttons on the controller */
|
||||
public static int buttonCount = -1;
|
||||
|
||||
/** Does this controller support a x axis */
|
||||
public static boolean hasXAxis = false;
|
||||
|
||||
/** Does this controller support a rotational x axis */
|
||||
public static boolean hasRXAxis = false;
|
||||
|
||||
/** Does this controller support an y axis */
|
||||
public static boolean hasYAxis = false;
|
||||
|
||||
/** Does this controller support a rotational y axis */
|
||||
public static boolean hasRYAxis = false;
|
||||
|
||||
/** Does this controller support a z axis */
|
||||
public static boolean hasZAxis = false;
|
||||
|
||||
/** Does this controller support a rotational z axis */
|
||||
public static boolean hasRZAxis = false;
|
||||
|
||||
/** Does this controller support a Point-Of-View (hat) */
|
||||
public static boolean hasPOV = false;
|
||||
|
||||
/** Does this controller support a slider */
|
||||
public static boolean hasSlider = false;
|
||||
|
||||
/**
|
||||
|
@ -165,9 +179,9 @@ public class Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* See if a particular button is down.
|
||||
* Tests if a particular button is down.
|
||||
*
|
||||
* @param button The index of the button you wish to test (0..buttonCount)
|
||||
* @param button The index of the button you wish to test (0..buttonCount-1)
|
||||
* @return true if the specified button is down
|
||||
* @see #buttonCount
|
||||
*/
|
||||
|
|
|
@ -41,8 +41,9 @@ import org.lwjgl.Sys;
|
|||
* A raw Mouse interface. This can be used to poll the current state of the
|
||||
* mouse buttons, and determine the mouse movement delta since the last poll.
|
||||
*
|
||||
* Up to 8 buttons are available. A scrolly wheel, if present, is the z
|
||||
* value. This will be in the range of -10000 to +10000.
|
||||
* n buttons supported, n being a native limit. A scrolly wheel is also
|
||||
* supported, if one such is available. All movement is reported as delta from
|
||||
* last position.
|
||||
*
|
||||
* @author cix_foo <cix_foo@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
|
@ -68,8 +69,10 @@ public class Mouse {
|
|||
/** Delta Z */
|
||||
public static int dwheel;
|
||||
|
||||
/* Mouse capabilities */
|
||||
/** Number of buttons supported by the mouse */
|
||||
public static int buttonCount = -1;
|
||||
|
||||
/** Does this mouse support a scroll wheel */
|
||||
public static boolean hasWheel = false;
|
||||
|
||||
/**
|
||||
|
@ -93,6 +96,7 @@ public class Mouse {
|
|||
|
||||
/**
|
||||
* "Create" the mouse. The display must first have been created.
|
||||
*
|
||||
* @throws Exception if the mouse could not be created for any reason
|
||||
*/
|
||||
public static void create() throws Exception {
|
||||
|
@ -143,7 +147,7 @@ public class Mouse {
|
|||
/**
|
||||
* See if a particular mouse button is down.
|
||||
*
|
||||
* @param button The index of the button you wish to test (0..buttonCount)
|
||||
* @param button The index of the button you wish to test (0..buttonCount-1)
|
||||
* @return true if the specified button is down
|
||||
*/
|
||||
public static boolean isButtonDown(int button) {
|
||||
|
|
Loading…
Reference in New Issue