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