mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-05 06:25:46 +00:00
Split out native implementation of Display/Mouse/Keyboard into implementers of DisplayImplementation
This commit is contained in:
parent
974af03e30
commit
ddd61963ee
10 changed files with 576 additions and 1079 deletions
|
|
@ -290,15 +290,10 @@ public class Keyboard {
|
|||
initialize();
|
||||
if (created)
|
||||
return;
|
||||
nCreate();
|
||||
Display.getImplementation().createKeyboard();
|
||||
created = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to create the keyboard
|
||||
*/
|
||||
private static native void nCreate() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* @return true if the keyboard has been created
|
||||
*/
|
||||
|
|
@ -313,14 +308,9 @@ public class Keyboard {
|
|||
if (!created)
|
||||
return;
|
||||
created = false;
|
||||
nDestroy();
|
||||
Display.getImplementation().destroyKeyboard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to destroy the keyboard
|
||||
*/
|
||||
private static native void nDestroy();
|
||||
|
||||
/**
|
||||
* Polls the keyboard for its current state. Access the polled values using the
|
||||
* <code>isKeyDown</code> method.
|
||||
|
|
@ -346,32 +336,18 @@ public class Keyboard {
|
|||
public static void poll() {
|
||||
if (!created)
|
||||
throw new IllegalStateException("Keyboard must be created before you can poll the device");
|
||||
nPoll(keyDownBuffer);
|
||||
Display.getImplementation().pollKeyboard(keyDownBuffer);
|
||||
if (readBuffer != null)
|
||||
read();
|
||||
}
|
||||
|
||||
private static void read() {
|
||||
readBuffer.compact();
|
||||
int numEvents = nRead(readBuffer, readBuffer.position());
|
||||
int numEvents = Display.getImplementation().readKeyboard(readBuffer, readBuffer.position());
|
||||
readBuffer.position(readBuffer.position() + numEvents*EVENT_SIZE);
|
||||
readBuffer.flip();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to poll the keyboard.
|
||||
*
|
||||
* @param keyDownBufferAddress the address of a 256-byte buffer to place
|
||||
* key states in.
|
||||
*/
|
||||
private static native void nPoll(ByteBuffer keyDownBuffer);
|
||||
|
||||
/**
|
||||
* Native method to read the keyboard buffer
|
||||
* @return the total number of events read.
|
||||
*/
|
||||
private static native int nRead(IntBuffer buffer, int buffer_position);
|
||||
|
||||
/**
|
||||
* Enable keyboard translation. Must be called after the keyboard is created,
|
||||
* and keyboard buffering must be enabled.
|
||||
|
|
@ -381,15 +357,10 @@ public class Keyboard {
|
|||
throw new IllegalStateException("Keyboard must be created before you can read events");
|
||||
if (readBuffer == null)
|
||||
throw new IllegalStateException("Event buffering must be enabled before you can read events");
|
||||
nEnableTranslation();
|
||||
Display.getImplementation().enableTranslation();
|
||||
translationEnabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to enable the translation buffer
|
||||
*/
|
||||
private static native void nEnableTranslation() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Enable keyboard buffering. Must be called after the keyboard is created.
|
||||
*/
|
||||
|
|
@ -398,16 +369,9 @@ public class Keyboard {
|
|||
throw new IllegalStateException("Keyboard must be created before you can enable buffering");
|
||||
readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE*BUFFER_SIZE);
|
||||
readBuffer.limit(0);
|
||||
nEnableBuffer();
|
||||
Display.getImplementation().enableKeyboardBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to enable the buffer
|
||||
* @return the event buffer,
|
||||
* or null if no buffer can be allocated
|
||||
*/
|
||||
private static native void nEnableBuffer() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Checks to see if a key is down.
|
||||
* @param key Keycode to check
|
||||
|
|
@ -442,10 +406,9 @@ public class Keyboard {
|
|||
public static int isStateKeySet(int key) {
|
||||
if (!created)
|
||||
throw new IllegalStateException("Keyboard must be created before you can query key state");
|
||||
return nisStateKeySet(key);
|
||||
return Display.getImplementation().isStateKeySet(key);
|
||||
}
|
||||
private static native int nisStateKeySet(int key);
|
||||
|
||||
|
||||
/**
|
||||
* Gets a key's name
|
||||
* @param key The key
|
||||
|
|
|
|||
|
|
@ -174,14 +174,9 @@ public class Mouse {
|
|||
* @return A bit mask with native cursor capabilities.
|
||||
*/
|
||||
public static int getNativeCursorCaps() {
|
||||
return nGetNativeCursorCaps();
|
||||
return Display.getImplementation().getNativeCursorCaps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native function to determine native cursor support
|
||||
*/
|
||||
private static native int nGetNativeCursorCaps();
|
||||
|
||||
/**
|
||||
* Binds a native cursor. If the cursor argument is null, the
|
||||
* native cursor is disabled, as if native cursors were not supported.
|
||||
|
|
@ -204,18 +199,15 @@ public class Mouse {
|
|||
currentCursor = cursor;
|
||||
if (isCreated()) {
|
||||
if (currentCursor != null) {
|
||||
nSetNativeCursor(currentCursor.getHandle());
|
||||
Display.getImplementation().setNativeCursor(currentCursor.getHandle());
|
||||
currentCursor.setTimeout();
|
||||
} else {
|
||||
nSetNativeCursor(null);
|
||||
Display.getImplementation().setNativeCursor(null);
|
||||
}
|
||||
}
|
||||
return oldCursor;
|
||||
}
|
||||
|
||||
/** Native method to set the native cursor */
|
||||
private static native void nSetNativeCursor(ByteBuffer handle) throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Gets the minimum size of a native cursor. Can only be called if
|
||||
* The Mouse is created and cursor caps includes at least
|
||||
|
|
@ -224,12 +216,9 @@ public class Mouse {
|
|||
* @return the maximum size of a native cursor
|
||||
*/
|
||||
public static int getMinCursorSize() {
|
||||
return nGetMinCursorSize();
|
||||
return Display.getImplementation().getMinCursorSize();
|
||||
}
|
||||
|
||||
/** Native method returning the minimum cursor size */
|
||||
private static native int nGetMinCursorSize();
|
||||
|
||||
/**
|
||||
* Gets the maximum size of a native cursor. Can only be called if
|
||||
* The Mouse is created and cursor caps includes at least
|
||||
|
|
@ -238,12 +227,9 @@ public class Mouse {
|
|||
* @return the maximum size of a native cursor
|
||||
*/
|
||||
public static int getMaxCursorSize() {
|
||||
return nGetMaxCursorSize();
|
||||
return Display.getImplementation().getMaxCursorSize();
|
||||
}
|
||||
|
||||
/** Native method returning the maximum cursor size */
|
||||
private static native int nGetMaxCursorSize();
|
||||
|
||||
/**
|
||||
* Static initialization
|
||||
*/
|
||||
|
|
@ -281,31 +267,18 @@ public class Mouse {
|
|||
if (!initialized)
|
||||
initialize();
|
||||
if (created) { return; }
|
||||
nCreate();
|
||||
hasWheel = nHasWheel();
|
||||
Display.getImplementation().createMouse();
|
||||
hasWheel = Display.getImplementation().hasWheel();
|
||||
created = true;
|
||||
|
||||
|
||||
// set mouse buttons
|
||||
buttonCount = nGetButtonCount();
|
||||
buttonCount = Display.getImplementation().getButtonCount();
|
||||
buttons = BufferUtils.createByteBuffer(buttonCount);
|
||||
coord_buffer = BufferUtils.createIntBuffer(3);
|
||||
setNativeCursor(currentCursor);
|
||||
setGrabbed(isGrabbed);
|
||||
}
|
||||
|
||||
/** Native query of wheel support */
|
||||
private static native boolean nHasWheel();
|
||||
|
||||
/** Native query of button count */
|
||||
private static native int nGetButtonCount();
|
||||
|
||||
/**
|
||||
* Native method to create the mouse.
|
||||
*
|
||||
* @return true if the mouse was created
|
||||
*/
|
||||
private static native void nCreate();
|
||||
|
||||
/**
|
||||
* @return true if the mouse has been created
|
||||
*/
|
||||
|
|
@ -329,14 +302,9 @@ public class Mouse {
|
|||
buttons = null;
|
||||
coord_buffer = null;
|
||||
|
||||
nDestroy();
|
||||
Display.getImplementation().destroyMouse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method the destroy the mouse
|
||||
*/
|
||||
private static native void nDestroy();
|
||||
|
||||
/**
|
||||
* Polls the mouse for its current state. Access the polled values using the
|
||||
* get<value> methods.
|
||||
|
|
@ -363,7 +331,7 @@ public class Mouse {
|
|||
*/
|
||||
public static void poll() {
|
||||
if (!created) throw new IllegalStateException("Mouse must be created before you can poll it");
|
||||
nPoll(coord_buffer, buttons);
|
||||
Display.getImplementation().pollMouse(coord_buffer, buttons);
|
||||
|
||||
int poll_dx = coord_buffer.get(0);
|
||||
int poll_dy = coord_buffer.get(1);
|
||||
|
|
@ -410,16 +378,11 @@ public class Mouse {
|
|||
|
||||
private static void read() {
|
||||
readBuffer.compact();
|
||||
int numEvents = nRead(readBuffer, readBuffer.position());
|
||||
int numEvents = Display.getImplementation().readMouse(readBuffer, readBuffer.position());
|
||||
readBuffer.position(readBuffer.position() + numEvents * EVENT_SIZE);
|
||||
readBuffer.flip();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to poll the mouse
|
||||
*/
|
||||
private static native void nPoll(IntBuffer coord_buffer, ByteBuffer buttons);
|
||||
|
||||
/**
|
||||
* See if a particular mouse button is down.
|
||||
*
|
||||
|
|
@ -465,22 +428,9 @@ public class Mouse {
|
|||
if (!created) throw new IllegalStateException("Mouse must be created before you can enable buffering");
|
||||
readBuffer = BufferUtils.createIntBuffer(EVENT_SIZE * BUFFER_SIZE);
|
||||
readBuffer.limit(0);
|
||||
nEnableBuffer();
|
||||
Display.getImplementation().enableMouseBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to enable the buffer
|
||||
* @return the event buffer,
|
||||
* or null if no buffer can be allocated
|
||||
*/
|
||||
private static native void nEnableBuffer() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to read the keyboard buffer
|
||||
* @return the total number of events read.
|
||||
*/
|
||||
private static native int nRead(IntBuffer buffer, int buffer_position);
|
||||
|
||||
/**
|
||||
* Gets the next mouse event. You can query which button caused the event by using
|
||||
* <code>getEventButton()</code> (if any). To get the state of that key, for that event, use
|
||||
|
|
@ -638,13 +588,11 @@ public class Mouse {
|
|||
public static void setGrabbed(boolean grab) {
|
||||
isGrabbed = grab;
|
||||
if (isCreated()) {
|
||||
nGrabMouse(isGrabbed);
|
||||
Display.getImplementation().grabMouse(isGrabbed);
|
||||
resetMouse();
|
||||
}
|
||||
}
|
||||
|
||||
private static native void nGrabMouse(boolean grab);
|
||||
|
||||
/**
|
||||
* Updates the cursor, so that animation can be changed if needed.
|
||||
* This method is called automatically by the window on its update, and
|
||||
|
|
|
|||
|
|
@ -56,21 +56,14 @@ import org.lwjgl.input.Mouse;
|
|||
|
||||
public final class Display {
|
||||
|
||||
/** The current display mode, if created */
|
||||
private static DisplayMode current_mode;
|
||||
/** The display implementor */
|
||||
private final static DisplayImplementation display_impl;
|
||||
|
||||
/** The initial display mode */
|
||||
private final static DisplayMode initial_mode;
|
||||
|
||||
static {
|
||||
Sys.initialize();
|
||||
current_mode = initial_mode = init();
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
/** The current display mode, if created */
|
||||
private static DisplayMode current_mode;
|
||||
|
||||
/** Timer for sync() */
|
||||
private static long timeNow, timeThen;
|
||||
|
|
@ -96,6 +89,38 @@ public final class Display {
|
|||
/** A unique context object, so we can track different contexts between creates() and destroys() */
|
||||
private static Display context;
|
||||
|
||||
static {
|
||||
Sys.initialize();
|
||||
display_impl = createDisplayImplementation();
|
||||
current_mode = initial_mode = display_impl.init();
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
public void run() {
|
||||
reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private final static DisplayImplementation createDisplayImplementation() {
|
||||
String class_name;
|
||||
String os_name = System.getProperty("os.name");
|
||||
if (os_name.startsWith("Linux")) {
|
||||
class_name = "org.lwjgl.opengl.LinuxDisplay";
|
||||
} else if (os_name.startsWith("Windows")) {
|
||||
class_name = "org.lwjgl.opengl.Win32Display";
|
||||
} else
|
||||
throw new IllegalStateException("The platform " + os_name + " is not supported");
|
||||
try {
|
||||
Class display_class = Class.forName(class_name);
|
||||
return (DisplayImplementation)display_class.newInstance();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InstantiationException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Only constructed by ourselves
|
||||
*/
|
||||
|
|
@ -113,7 +138,7 @@ public final class Display {
|
|||
* @return an array of all display modes the system reckons it can handle.
|
||||
*/
|
||||
public static DisplayMode[] getAvailableDisplayModes() {
|
||||
DisplayMode[] unfilteredModes = nGetAvailableDisplayModes();
|
||||
DisplayMode[] unfilteredModes = display_impl.getAvailableDisplayModes();
|
||||
|
||||
if (unfilteredModes == null) {
|
||||
return new DisplayMode[0];
|
||||
|
|
@ -131,11 +156,6 @@ public final class Display {
|
|||
return filteredModes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method for getting displaymodes
|
||||
*/
|
||||
private static native DisplayMode[] nGetAvailableDisplayModes();
|
||||
|
||||
/**
|
||||
* Return the current display mode, as set by setDisplayMode().
|
||||
* @return The current display mode
|
||||
|
|
@ -165,8 +185,8 @@ public final class Display {
|
|||
switchDisplayMode();
|
||||
createWindow();
|
||||
} catch (LWJGLException e) {
|
||||
destroyContext();
|
||||
resetDisplayMode();
|
||||
display_impl.destroyContext();
|
||||
display_impl.resetDisplayMode();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
@ -179,14 +199,12 @@ public final class Display {
|
|||
private static void createWindow() throws LWJGLException {
|
||||
x = Math.max(0, Math.min(initial_mode.getWidth() - current_mode.getWidth(), x));
|
||||
y = Math.max(0, Math.min(initial_mode.getHeight() - current_mode.getHeight(), y));
|
||||
nCreateWindow(current_mode, fullscreen, (fullscreen) ? 0 : x, (fullscreen) ? 0 : y);
|
||||
nSetTitle(title);
|
||||
display_impl.createWindow(current_mode, fullscreen, (fullscreen) ? 0 : x, (fullscreen) ? 0 : y);
|
||||
setTitle(title);
|
||||
initControls();
|
||||
nSetVSyncEnabled(vsync);
|
||||
setVSyncEnabled(vsync);
|
||||
}
|
||||
|
||||
private static native void nCreateWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException;
|
||||
|
||||
private static void destroyWindow() {
|
||||
// Automatically destroy keyboard, mouse, and controller
|
||||
if (Mouse.isCreated()) {
|
||||
|
|
@ -198,25 +216,15 @@ public final class Display {
|
|||
if (Controller.isCreated()) {
|
||||
Controller.destroy();
|
||||
}
|
||||
nDestroyWindow();
|
||||
display_impl.destroyWindow();
|
||||
}
|
||||
|
||||
private static native void nDestroyWindow();
|
||||
|
||||
private static void switchDisplayMode() throws LWJGLException {
|
||||
if (!current_mode.isFullscreen())
|
||||
throw new LWJGLException("The current DisplayMode instance cannot be used for fullscreen mode");
|
||||
nSwitchDisplayMode(current_mode);
|
||||
display_impl.switchDisplayMode(current_mode);
|
||||
}
|
||||
|
||||
private static native void nSwitchDisplayMode(DisplayMode mode) throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Reset the display mode to whatever it was when LWJGL was initialized.
|
||||
* Fails silently.
|
||||
*/
|
||||
private static native void resetDisplayMode();
|
||||
|
||||
/**
|
||||
* Set the display configuration to the specified gamma, brightness and contrast.
|
||||
* The configuration changes will be reset when destroy() is called.
|
||||
|
|
@ -233,7 +241,7 @@ public final class Display {
|
|||
throw new IllegalArgumentException("Invalid brightness value");
|
||||
if (contrast < 0.0f)
|
||||
throw new IllegalArgumentException("Invalid contrast value");
|
||||
int rampSize = getGammaRampLength();
|
||||
int rampSize = display_impl.getGammaRampLength();
|
||||
if (rampSize == 0) {
|
||||
throw new LWJGLException("Display configuration not supported");
|
||||
}
|
||||
|
|
@ -253,37 +261,10 @@ public final class Display {
|
|||
rampEntry = 0.0f;
|
||||
gammaRamp.put(i, rampEntry);
|
||||
}
|
||||
setGammaRamp(gammaRamp);
|
||||
display_impl.setGammaRamp(gammaRamp);
|
||||
Sys.log("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the length of the gamma ramp arrays. Returns 0 if gamma settings are
|
||||
* unsupported.
|
||||
*
|
||||
* @return the length of each gamma ramp array, or 0 if gamma settings are unsupported.
|
||||
*/
|
||||
private static native int getGammaRampLength();
|
||||
|
||||
/**
|
||||
* Native method to set the gamma ramp.
|
||||
*/
|
||||
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",
|
||||
* "Radeon9700". If the adapter cannot be determined, this function returns null.
|
||||
* @return a String
|
||||
*/
|
||||
public static native String getAdapter();
|
||||
|
||||
/**
|
||||
* Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined,
|
||||
* this function returns null.
|
||||
* @return a String
|
||||
*/
|
||||
public static native String getVersion();
|
||||
|
||||
/**
|
||||
* Synchronize the display to a capped frame rate. Note that we are being "smart" about the
|
||||
* desired results in our implementation; we automatically subtract 1 from the desired framerate
|
||||
|
|
@ -323,11 +304,6 @@ public final class Display {
|
|||
timeThen = timeNow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize and return the current display mode.
|
||||
*/
|
||||
private static native DisplayMode init();
|
||||
|
||||
/**
|
||||
* @return the X coordinate of the window (always 0 for fullscreen)
|
||||
*/
|
||||
|
|
@ -371,12 +347,12 @@ public final class Display {
|
|||
if (fullscreen) {
|
||||
switchDisplayMode();
|
||||
} else {
|
||||
resetDisplayMode();
|
||||
display_impl.resetDisplayMode();
|
||||
}
|
||||
createWindow();
|
||||
} catch (LWJGLException e) {
|
||||
destroyContext();
|
||||
resetDisplayMode();
|
||||
display_impl.destroyContext();
|
||||
display_impl.resetDisplayMode();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
@ -399,51 +375,39 @@ public final class Display {
|
|||
}
|
||||
title = newTitle;
|
||||
if (isCreated())
|
||||
nSetTitle(title);
|
||||
display_impl.setTitle(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Native implementation of setTitle(). This will read the window's title member
|
||||
* and stash it in the native title of the window.
|
||||
*/
|
||||
private static native void nSetTitle(String title);
|
||||
|
||||
/**
|
||||
* @return true if the user or operating system has asked the window to close
|
||||
*/
|
||||
public static boolean isCloseRequested() {
|
||||
if (!isCreated())
|
||||
throw new IllegalStateException("Cannot determine close requested state of uncreated window");
|
||||
nUpdate();
|
||||
return nIsCloseRequested();
|
||||
display_impl.update();
|
||||
return display_impl.isCloseRequested();
|
||||
}
|
||||
|
||||
private static native boolean nIsCloseRequested();
|
||||
|
||||
/**
|
||||
* @return true if the window is visible, false if not
|
||||
*/
|
||||
public static boolean isVisible() {
|
||||
if (!isCreated())
|
||||
throw new IllegalStateException("Cannot determine minimized state of uncreated window");
|
||||
nUpdate();
|
||||
return nIsVisible();
|
||||
display_impl.update();
|
||||
return display_impl.isVisible();
|
||||
}
|
||||
|
||||
private static native boolean nIsVisible();
|
||||
|
||||
/**
|
||||
* @return true if window is active, that is, the foreground display of the operating system.
|
||||
*/
|
||||
public static boolean isActive() {
|
||||
if (!isCreated())
|
||||
throw new IllegalStateException("Cannot determine focused state of uncreated window");
|
||||
nUpdate();
|
||||
return nIsActive();
|
||||
display_impl.update();
|
||||
return display_impl.isActive();
|
||||
}
|
||||
|
||||
private static native boolean nIsActive();
|
||||
|
||||
/**
|
||||
* Determine if the window's contents have been damaged by external events.
|
||||
* If you are writing a straightforward game rendering loop and simply paint
|
||||
|
|
@ -457,12 +421,10 @@ public final class Display {
|
|||
public static boolean isDirty() {
|
||||
if (!isCreated())
|
||||
throw new IllegalStateException("Cannot determine dirty state of uncreated window");
|
||||
nUpdate();
|
||||
return nIsDirty();
|
||||
display_impl.update();
|
||||
return display_impl.isDirty();
|
||||
}
|
||||
|
||||
private static native boolean nIsDirty();
|
||||
|
||||
/**
|
||||
* Update the window. This processes operating system events, and if the window is visible
|
||||
* clears the dirty flag and swaps the buffers.
|
||||
|
|
@ -475,10 +437,10 @@ public final class Display {
|
|||
// We paint only when the window is visible or dirty
|
||||
if (isVisible() || isDirty()) {
|
||||
Util.checkGLError();
|
||||
swapBuffers();
|
||||
display_impl.swapBuffers();
|
||||
}
|
||||
|
||||
nUpdate();
|
||||
display_impl.update();
|
||||
|
||||
// Poll the input devices while we're here
|
||||
if (Mouse.isCreated()) {
|
||||
|
|
@ -493,11 +455,6 @@ public final class Display {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap double buffers.
|
||||
*/
|
||||
private static native void swapBuffers();
|
||||
|
||||
/**
|
||||
* Make the Display the current rendering context for GL calls. Also initialize native stubs.
|
||||
* @throws LWJGLException If the context could not be made current
|
||||
|
|
@ -505,15 +462,10 @@ public final class Display {
|
|||
public static void makeCurrent() throws LWJGLException {
|
||||
if (!isCreated())
|
||||
throw new IllegalStateException("No window created to make current");
|
||||
nMakeCurrent();
|
||||
display_impl.makeCurrent();
|
||||
GLContext.useContext(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the window the current rendering context for GL calls.
|
||||
*/
|
||||
private static native void nMakeCurrent() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Create the OpenGL context. If isFullscreen() is true or if windowed
|
||||
* context are not supported on the platform, the display mode will be switched to the mode returned by
|
||||
|
|
@ -549,14 +501,14 @@ public final class Display {
|
|||
try {
|
||||
GLContext.loadOpenGLLibrary();
|
||||
try {
|
||||
createContext(pixel_format);
|
||||
display_impl.createContext(pixel_format);
|
||||
try {
|
||||
context = new Display();
|
||||
createWindow();
|
||||
makeCurrent();
|
||||
initContext();
|
||||
} catch (LWJGLException e) {
|
||||
destroyContext();
|
||||
display_impl.destroyContext();
|
||||
context = null;
|
||||
throw e;
|
||||
}
|
||||
|
|
@ -565,19 +517,11 @@ public final class Display {
|
|||
throw e;
|
||||
}
|
||||
} catch (LWJGLException e) {
|
||||
resetDisplayMode();
|
||||
display_impl.resetDisplayMode();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the native OpenGL context.
|
||||
* @throws LWJGLException
|
||||
*/
|
||||
private static native void createContext(PixelFormat pixel_format) throws LWJGLException;
|
||||
|
||||
private static native void destroyContext();
|
||||
|
||||
private static void initContext() {
|
||||
// Put the window into orthographic projection mode with 1:1 pixel ratio.
|
||||
// We haven't used GLU here to do this to avoid an unnecessary dependency.
|
||||
|
|
@ -589,6 +533,10 @@ public final class Display {
|
|||
GL11.glViewport(0, 0, current_mode.getWidth(), current_mode.getHeight());
|
||||
}
|
||||
|
||||
public static DisplayImplementation getImplementation() {
|
||||
return display_impl;
|
||||
}
|
||||
|
||||
private static void initControls() {
|
||||
// Automatically create mouse, keyboard and controller
|
||||
if (!Boolean.getBoolean("org.lwjgl.opengl.Display.noinput")) {
|
||||
|
|
@ -641,7 +589,7 @@ public final class Display {
|
|||
}
|
||||
|
||||
destroyWindow();
|
||||
destroyContext();
|
||||
display_impl.destroyContext();
|
||||
GLContext.unloadOpenGLLibrary();
|
||||
context = null;
|
||||
try {
|
||||
|
|
@ -657,7 +605,7 @@ public final class Display {
|
|||
* in the static constructor
|
||||
*/
|
||||
private static void reset() {
|
||||
resetDisplayMode();
|
||||
display_impl.resetDisplayMode();
|
||||
current_mode = initial_mode;
|
||||
}
|
||||
|
||||
|
|
@ -675,12 +623,6 @@ public final class Display {
|
|||
return context != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the windows internal state. This must be called at least once per video frame
|
||||
* to handle window close requests, moves, paints, etc.
|
||||
*/
|
||||
private static native void nUpdate();
|
||||
|
||||
/**
|
||||
* Enable or disable vertical monitor synchronization. This call is a best-attempt at changing
|
||||
* the vertical refresh synchronization of the monitor, and is not guaranteed to be successful.
|
||||
|
|
@ -689,11 +631,9 @@ public final class Display {
|
|||
public static void setVSyncEnabled(boolean sync) {
|
||||
vsync = sync;
|
||||
if (isCreated())
|
||||
nSetVSyncEnabled(vsync);
|
||||
display_impl.setVSyncEnabled(vsync);
|
||||
}
|
||||
|
||||
private static native void nSetVSyncEnabled(boolean sync);
|
||||
|
||||
/**
|
||||
* Set the window's location. This is a no-op on fullscreen windows.
|
||||
* The window is clamped to remain entirely on the screen. If you attempt
|
||||
|
|
@ -705,17 +645,34 @@ public final class Display {
|
|||
if (fullscreen) {
|
||||
return;
|
||||
}
|
||||
|
||||
// offset if already created
|
||||
if(isCreated()) {
|
||||
x = Math.max(0, Math.min(initial_mode.getWidth() - current_mode.getWidth(), x));
|
||||
y = Math.max(0, Math.min(initial_mode.getHeight() - current_mode.getHeight(), y));
|
||||
nReshape(x, y, current_mode.getWidth(), current_mode.getHeight());
|
||||
}
|
||||
|
||||
// cache position
|
||||
Display.x = x;
|
||||
Display.y = y;
|
||||
// offset if already created
|
||||
if(isCreated()) {
|
||||
x = Math.max(0, Math.min(initial_mode.getWidth() - current_mode.getWidth(), x));
|
||||
y = Math.max(0, Math.min(initial_mode.getHeight() - current_mode.getHeight(), y));
|
||||
display_impl.reshape(x, y, current_mode.getWidth(), current_mode.getHeight());
|
||||
}
|
||||
|
||||
// cache position
|
||||
Display.x = x;
|
||||
Display.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the driver adapter string. This is a unique string describing the actual card's hardware, eg. "Geforce2", "PS2",
|
||||
* "Radeon9700". If the adapter cannot be determined, this function returns null.
|
||||
* @return a String
|
||||
*/
|
||||
public static String getAdapter() {
|
||||
return display_impl.getAdapter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined,
|
||||
* this function returns null.
|
||||
* @return a String
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return display_impl.getVersion();
|
||||
}
|
||||
private static native void nReshape(int x, int y, int width, int height);
|
||||
}
|
||||
|
|
|
|||
232
src/java/org/lwjgl/opengl/DisplayImplementation.java
Normal file
232
src/java/org/lwjgl/opengl/DisplayImplementation.java
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2004 LWJGL Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'LWJGL' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
/**
|
||||
* This is the Display implementation interface. Display delegates
|
||||
* to implementors of this interface. There is one DisplayImplementation
|
||||
* for each supported platform.
|
||||
* @author elias_naur
|
||||
*/
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import org.lwjgl.LWJGLException;
|
||||
|
||||
public interface DisplayImplementation {
|
||||
public void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException;
|
||||
public void destroyWindow();
|
||||
|
||||
public void switchDisplayMode(DisplayMode mode) throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Reset the display mode to whatever it was when LWJGL was initialized.
|
||||
* Fails silently.
|
||||
*/
|
||||
public void resetDisplayMode();
|
||||
|
||||
/**
|
||||
* Return the length of the gamma ramp arrays. Returns 0 if gamma settings are
|
||||
* unsupported.
|
||||
*
|
||||
* @return the length of each gamma ramp array, or 0 if gamma settings are unsupported.
|
||||
*/
|
||||
public int getGammaRampLength();
|
||||
|
||||
/**
|
||||
* Native method to set the gamma ramp.
|
||||
*/
|
||||
public 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",
|
||||
* "Radeon9700". If the adapter cannot be determined, this function returns null.
|
||||
* @return a String
|
||||
*/
|
||||
public String getAdapter();
|
||||
|
||||
/**
|
||||
* Get the driver version. This is a vendor/adapter specific version string. If the version cannot be determined,
|
||||
* this function returns null.
|
||||
* @return a String
|
||||
*/
|
||||
public String getVersion();
|
||||
|
||||
/**
|
||||
* Initialize and return the current display mode.
|
||||
*/
|
||||
public DisplayMode init();
|
||||
|
||||
/**
|
||||
* Native implementation of setTitle(). This will read the window's title member
|
||||
* and stash it in the native title of the window.
|
||||
*/
|
||||
public void setTitle(String title);
|
||||
|
||||
public boolean isCloseRequested();
|
||||
|
||||
public boolean isVisible();
|
||||
public boolean isActive();
|
||||
|
||||
public boolean isDirty();
|
||||
|
||||
/**
|
||||
* Swap double buffers.
|
||||
*/
|
||||
public void swapBuffers();
|
||||
|
||||
/**
|
||||
* Make the window the current rendering context for GL calls.
|
||||
*/
|
||||
public void makeCurrent() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Create the native OpenGL context.
|
||||
* @throws LWJGLException
|
||||
*/
|
||||
public void createContext(PixelFormat pixel_format) throws LWJGLException;
|
||||
|
||||
public void destroyContext();
|
||||
|
||||
/**
|
||||
* Updates the windows internal state. This must be called at least once per video frame
|
||||
* to handle window close requests, moves, paints, etc.
|
||||
*/
|
||||
public void update();
|
||||
|
||||
public void setVSyncEnabled(boolean sync);
|
||||
|
||||
public void reshape(int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* Native method for getting displaymodes
|
||||
*/
|
||||
public DisplayMode[] getAvailableDisplayModes();
|
||||
|
||||
/*
|
||||
* Mouse methods
|
||||
*/
|
||||
/** Native query of wheel support */
|
||||
public boolean hasWheel();
|
||||
|
||||
/** Native query of button count */
|
||||
public int getButtonCount();
|
||||
|
||||
/**
|
||||
* Native method to create the mouse.
|
||||
*
|
||||
* @return true if the mouse was created
|
||||
*/
|
||||
public void createMouse();
|
||||
|
||||
/**
|
||||
* Native method the destroy the mouse
|
||||
*/
|
||||
public void destroyMouse();
|
||||
|
||||
/**
|
||||
* Native method to poll the mouse
|
||||
*/
|
||||
public void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
|
||||
|
||||
/**
|
||||
* Native method to enable the buffer
|
||||
* @return the event buffer,
|
||||
* or null if no buffer can be allocated
|
||||
*/
|
||||
public void enableMouseBuffer() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to read the keyboard buffer
|
||||
* @return the total number of events read.
|
||||
*/
|
||||
public int readMouse(IntBuffer buffer, int buffer_position);
|
||||
|
||||
public void grabMouse(boolean grab);
|
||||
|
||||
/**
|
||||
* Native function to determine native cursor support
|
||||
*/
|
||||
public int getNativeCursorCaps();
|
||||
|
||||
/** Native method to set the native cursor */
|
||||
public void setNativeCursor(ByteBuffer handle) throws LWJGLException;
|
||||
|
||||
/** Native method returning the minimum cursor size */
|
||||
public int getMinCursorSize();
|
||||
|
||||
/** Native method returning the maximum cursor size */
|
||||
public int getMaxCursorSize();
|
||||
|
||||
/*
|
||||
* Keyboard methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Native method to create the keyboard
|
||||
*/
|
||||
public void createKeyboard() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to destroy the keyboard
|
||||
*/
|
||||
public void destroyKeyboard();
|
||||
|
||||
/**
|
||||
* Native method to poll the keyboard.
|
||||
*
|
||||
* @param keyDownBufferAddress the address of a 256-byte buffer to place
|
||||
* key states in.
|
||||
*/
|
||||
public void pollKeyboard(ByteBuffer keyDownBuffer);
|
||||
|
||||
/**
|
||||
* Native method to read the keyboard buffer
|
||||
* @return the total number of events read.
|
||||
*/
|
||||
public int readKeyboard(IntBuffer buffer, int buffer_position);
|
||||
|
||||
/**
|
||||
* Native method to enable the translation buffer
|
||||
*/
|
||||
public void enableTranslation() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to enable the buffer
|
||||
* @return the event buffer,
|
||||
* or null if no buffer can be allocated
|
||||
*/
|
||||
public void enableKeyboardBuffer() throws LWJGLException;
|
||||
|
||||
public int isStateKeySet(int key);
|
||||
}
|
||||
91
src/java/org/lwjgl/opengl/LinuxDisplay.java
Normal file
91
src/java/org/lwjgl/opengl/LinuxDisplay.java
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2004 LWJGL Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'LWJGL' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
/**
|
||||
* This is the Display implementation interface. Display delegates
|
||||
* to implementors of this interface. There is one DisplayImplementation
|
||||
* for each supported platform.
|
||||
* @author elias_naur
|
||||
*/
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.lwjgl.LWJGLException;
|
||||
|
||||
final class LinuxDisplay implements DisplayImplementation {
|
||||
public native void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException;
|
||||
public native void destroyWindow();
|
||||
public native void switchDisplayMode(DisplayMode mode) throws LWJGLException;
|
||||
public native void resetDisplayMode();
|
||||
public native int getGammaRampLength();
|
||||
public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException;
|
||||
public native String getAdapter();
|
||||
public native String getVersion();
|
||||
public native DisplayMode init();
|
||||
public native void setTitle(String title);
|
||||
public native boolean isCloseRequested();
|
||||
public native boolean isVisible();
|
||||
public native boolean isActive();
|
||||
public native boolean isDirty();
|
||||
public native void swapBuffers();
|
||||
public native void makeCurrent() throws LWJGLException;
|
||||
public native void createContext(PixelFormat pixel_format) throws LWJGLException;
|
||||
public native void destroyContext();
|
||||
public native void update();
|
||||
public native void setVSyncEnabled(boolean sync);
|
||||
public native void reshape(int x, int y, int width, int height);
|
||||
public native DisplayMode[] getAvailableDisplayModes();
|
||||
/* Mouse */
|
||||
public native boolean hasWheel();
|
||||
public native int getButtonCount();
|
||||
public native void createMouse();
|
||||
public native void destroyMouse();
|
||||
public native void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
|
||||
public native void enableMouseBuffer() throws LWJGLException;
|
||||
public native int readMouse(IntBuffer buffer, int buffer_position);
|
||||
public native void grabMouse(boolean grab);
|
||||
public native int getNativeCursorCaps();
|
||||
public native void setNativeCursor(ByteBuffer handle) throws LWJGLException;
|
||||
public native int getMinCursorSize();
|
||||
public native int getMaxCursorSize();
|
||||
/* Keyboard */
|
||||
public native void createKeyboard() throws LWJGLException;
|
||||
public native void destroyKeyboard();
|
||||
public native void pollKeyboard(ByteBuffer keyDownBuffer);
|
||||
public native int readKeyboard(IntBuffer buffer, int buffer_position);
|
||||
public native void enableTranslation() throws LWJGLException;
|
||||
public native void enableKeyboardBuffer() throws LWJGLException;
|
||||
public native int isStateKeySet(int key);
|
||||
}
|
||||
91
src/java/org/lwjgl/opengl/Win32Display.java
Normal file
91
src/java/org/lwjgl/opengl/Win32Display.java
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2004 LWJGL Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* * Neither the name of 'LWJGL' nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
/**
|
||||
* This is the Display implementation interface. Display delegates
|
||||
* to implementors of this interface. There is one DisplayImplementation
|
||||
* for each supported platform.
|
||||
* @author elias_naur
|
||||
*/
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.lwjgl.LWJGLException;
|
||||
|
||||
final class Win32Display implements DisplayImplementation {
|
||||
public native void createWindow(DisplayMode mode, boolean fullscreen, int x, int y) throws LWJGLException;
|
||||
public native void destroyWindow();
|
||||
public native void switchDisplayMode(DisplayMode mode) throws LWJGLException;
|
||||
public native void resetDisplayMode();
|
||||
public native int getGammaRampLength();
|
||||
public native void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException;
|
||||
public native String getAdapter();
|
||||
public native String getVersion();
|
||||
public native DisplayMode init();
|
||||
public native void setTitle(String title);
|
||||
public native boolean isCloseRequested();
|
||||
public native boolean isVisible();
|
||||
public native boolean isActive();
|
||||
public native boolean isDirty();
|
||||
public native void swapBuffers();
|
||||
public native void makeCurrent() throws LWJGLException;
|
||||
public native void createContext(PixelFormat pixel_format) throws LWJGLException;
|
||||
public native void destroyContext();
|
||||
public native void update();
|
||||
public native void setVSyncEnabled(boolean sync);
|
||||
public native void reshape(int x, int y, int width, int height);
|
||||
public native DisplayMode[] getAvailableDisplayModes();
|
||||
/* Mouse */
|
||||
public native boolean hasWheel();
|
||||
public native int getButtonCount();
|
||||
public native void createMouse();
|
||||
public native void destroyMouse();
|
||||
public native void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
|
||||
public native void enableMouseBuffer() throws LWJGLException;
|
||||
public native int readMouse(IntBuffer buffer, int buffer_position);
|
||||
public native void grabMouse(boolean grab);
|
||||
public native int getNativeCursorCaps();
|
||||
public native void setNativeCursor(ByteBuffer handle) throws LWJGLException;
|
||||
public native int getMinCursorSize();
|
||||
public native int getMaxCursorSize();
|
||||
/* Keyboard */
|
||||
public native void createKeyboard() throws LWJGLException;
|
||||
public native void destroyKeyboard();
|
||||
public native void pollKeyboard(ByteBuffer keyDownBuffer);
|
||||
public native int readKeyboard(IntBuffer buffer, int buffer_position);
|
||||
public native void enableTranslation() throws LWJGLException;
|
||||
public native void enableKeyboardBuffer() throws LWJGLException;
|
||||
public native int isStateKeySet(int key);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue