mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-05 14:35:58 +00:00
Moved Mouse.getNativeCursorCaps() to Cursor.getCapabilities()
Renamed Pbuffer.getPbufferCaps() to Pbuffer.getCapabilities()
This commit is contained in:
parent
9d770148ca
commit
fbcd19698b
16 changed files with 138 additions and 138 deletions
|
|
@ -50,6 +50,15 @@ import org.lwjgl.opengl.Display;
|
|||
*/
|
||||
|
||||
public class Cursor {
|
||||
/** 1 bit transparency for native cursor */
|
||||
public static final int CURSOR_ONE_BIT_TRANSPARENCY = 1;
|
||||
|
||||
/** 8 bit alhpa native cursor */
|
||||
public static final int CURSOR_8_BIT_ALPHA = 2;
|
||||
|
||||
/** animation native cursor */
|
||||
public static final int CURSOR_ANIMATION = 4;
|
||||
|
||||
/** First element to display */
|
||||
private final CursorElement[] cursors;
|
||||
|
||||
|
|
@ -72,6 +81,8 @@ public class Cursor {
|
|||
* @throws LWJGLException 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 LWJGLException {
|
||||
if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0)
|
||||
throw new IllegalStateException("Native cursors not supported");
|
||||
BufferChecks.checkBuffer(images, width*height*numImages);
|
||||
if (!Mouse.isCreated())
|
||||
throw new IllegalStateException("Mouse must be created before creating cursor objects");
|
||||
|
|
@ -92,7 +103,41 @@ public class Cursor {
|
|||
// create cursor (or cursors if multiple images supplied)
|
||||
cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the minimum size of a native cursor. Can only be called if
|
||||
* The Mouse is created and cursor caps includes at least
|
||||
* CURSOR_ONE_BIT_TRANSPARANCY.
|
||||
*
|
||||
* @return the maximum size of a native cursor
|
||||
*/
|
||||
public static int getMinCursorSize() {
|
||||
return Display.getImplementation().getMinCursorSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum size of a native cursor. Can only be called if
|
||||
* The Mouse is created and cursor caps includes at least
|
||||
* CURSOR_ONE_BIT_TRANSPARANCY.
|
||||
*
|
||||
* @return the maximum size of a native cursor
|
||||
*/
|
||||
public static int getMaxCursorSize() {
|
||||
return Display.getImplementation().getMaxCursorSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the capabilities of the native cursor. Return a bit mask of the native cursor capabilities.
|
||||
* The CURSOR_ONE_BIT_TRANSPARANCY indicates support for cursors with one bit transparancy,
|
||||
* the CURSOR_8_BIT_ALPHA indicates support for 8 bit alpha and CURSOR_ANIMATION indicates
|
||||
* support for cursor animations.
|
||||
*
|
||||
* @return A bit mask with native cursor capabilities.
|
||||
*/
|
||||
public static int getCapabilities() {
|
||||
return Display.getImplementation().getNativeCursorCapabilities();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the actual cursor, using a platform specific class
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -58,16 +58,6 @@ import org.lwjgl.opengl.Display;
|
|||
* @version $Revision$
|
||||
*/
|
||||
public class Mouse {
|
||||
|
||||
/** 1 bit transparency for native cursor */
|
||||
public static final int CURSOR_ONE_BIT_TRANSPARENCY = 1;
|
||||
|
||||
/** 8 bit alhpa native cursor */
|
||||
public static final int CURSOR_8_BIT_ALPHA = 2;
|
||||
|
||||
/** animation native cursor */
|
||||
public static final int CURSOR_ANIMATION = 4;
|
||||
|
||||
/** Mouse constraint */
|
||||
private static int width, height;
|
||||
|
||||
|
|
@ -155,18 +145,6 @@ public class Mouse {
|
|||
return currentCursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the capabilities of the native cursor. Return a bit mask of the native cursor capabilities.
|
||||
* The CURSOR_ONE_BIT_TRANSPARANCY indicates support for cursors with one bit transparancy,
|
||||
* the CURSOR_8_BIT_ALPHA indicates support for 8 bit alpha and CURSOR_ANIMATION indicates
|
||||
* support for cursor animations.
|
||||
*
|
||||
* @return A bit mask with native cursor capabilities.
|
||||
*/
|
||||
public static int getNativeCursorCaps() {
|
||||
return Display.getImplementation().getNativeCursorCaps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds a native cursor. If the cursor argument is null, the
|
||||
* native cursor is disabled, as if native cursors were not supported.
|
||||
|
|
@ -183,7 +161,7 @@ public class Mouse {
|
|||
* @throws LWJGLException if the cursor could not be set for any reason
|
||||
*/
|
||||
public static Cursor setNativeCursor(Cursor cursor) throws LWJGLException {
|
||||
if ((getNativeCursorCaps() & CURSOR_ONE_BIT_TRANSPARENCY) == 0)
|
||||
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0)
|
||||
throw new IllegalStateException("Mouse doesn't support native cursors");
|
||||
Cursor oldCursor = currentCursor;
|
||||
currentCursor = cursor;
|
||||
|
|
@ -198,28 +176,6 @@ public class Mouse {
|
|||
return oldCursor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the minimum size of a native cursor. Can only be called if
|
||||
* The Mouse is created and cursor caps includes at least
|
||||
* CURSOR_ONE_BIT_TRANSPARANCY.
|
||||
*
|
||||
* @return the maximum size of a native cursor
|
||||
*/
|
||||
public static int getMinCursorSize() {
|
||||
return Display.getImplementation().getMinCursorSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximum size of a native cursor. Can only be called if
|
||||
* The Mouse is created and cursor caps includes at least
|
||||
* CURSOR_ONE_BIT_TRANSPARANCY.
|
||||
*
|
||||
* @return the maximum size of a native cursor
|
||||
*/
|
||||
public static int getMaxCursorSize() {
|
||||
return Display.getImplementation().getMaxCursorSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Static initialization
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public interface DisplayImplementation {
|
|||
int getGammaRampLength();
|
||||
|
||||
/**
|
||||
* Native method to set the gamma ramp.
|
||||
* Method to set the gamma ramp.
|
||||
*/
|
||||
void setGammaRamp(FloatBuffer gammaRamp) throws LWJGLException;
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ public interface DisplayImplementation {
|
|||
DisplayMode init();
|
||||
|
||||
/**
|
||||
* Native implementation of setTitle(). This will read the window's title member
|
||||
* Implementation of setTitle(). This will read the window's title member
|
||||
* and stash it in the native title of the window.
|
||||
*/
|
||||
void setTitle(String title);
|
||||
|
|
@ -131,41 +131,41 @@ public interface DisplayImplementation {
|
|||
void reshape(int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* Native method for getting displaymodes
|
||||
* Method for getting displaymodes
|
||||
*/
|
||||
DisplayMode[] getAvailableDisplayModes();
|
||||
|
||||
/*
|
||||
* Mouse methods
|
||||
*/
|
||||
/** Native query of wheel support */
|
||||
/** Query of wheel support */
|
||||
boolean hasWheel();
|
||||
|
||||
/** Native query of button count */
|
||||
/** Query of button count */
|
||||
int getButtonCount();
|
||||
|
||||
/**
|
||||
* Native method to create the mouse.
|
||||
* Method to create the mouse.
|
||||
*/
|
||||
void createMouse();
|
||||
|
||||
/**
|
||||
* Native method the destroy the mouse
|
||||
* Method the destroy the mouse
|
||||
*/
|
||||
void destroyMouse();
|
||||
|
||||
/**
|
||||
* Native method to poll the mouse
|
||||
* Method to poll the mouse
|
||||
*/
|
||||
void pollMouse(IntBuffer coord_buffer, ByteBuffer buttons);
|
||||
|
||||
/**
|
||||
* Native method to enable the buffer
|
||||
* Method to enable the buffer
|
||||
*/
|
||||
void enableMouseBuffer() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to read the keyboard buffer
|
||||
* Method to read the keyboard buffer
|
||||
*
|
||||
* @return the total number of events read.
|
||||
*/
|
||||
|
|
@ -175,17 +175,17 @@ public interface DisplayImplementation {
|
|||
void grabMouse(boolean grab);
|
||||
|
||||
/**
|
||||
* Native function to determine native cursor support
|
||||
* Function to determine native cursor support
|
||||
*/
|
||||
int getNativeCursorCaps();
|
||||
int getNativeCursorCapabilities();
|
||||
|
||||
/** Native method to set the native cursor */
|
||||
/** Method to set the native cursor */
|
||||
void setNativeCursor(Object handle) throws LWJGLException;
|
||||
|
||||
/** Native method returning the minimum cursor size */
|
||||
/** Method returning the minimum cursor size */
|
||||
int getMinCursorSize();
|
||||
|
||||
/** Native method returning the maximum cursor size */
|
||||
/** Method returning the maximum cursor size */
|
||||
int getMaxCursorSize();
|
||||
|
||||
/*
|
||||
|
|
@ -193,17 +193,17 @@ public interface DisplayImplementation {
|
|||
*/
|
||||
|
||||
/**
|
||||
* Native method to create the keyboard
|
||||
* Method to create the keyboard
|
||||
*/
|
||||
void createKeyboard() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to destroy the keyboard
|
||||
* Method to destroy the keyboard
|
||||
*/
|
||||
void destroyKeyboard();
|
||||
|
||||
/**
|
||||
* Native method to poll the keyboard.
|
||||
* Method to poll the keyboard.
|
||||
*
|
||||
* @param keyDownBuffer the address of a 256-byte buffer to place
|
||||
* key states in.
|
||||
|
|
@ -211,18 +211,18 @@ public interface DisplayImplementation {
|
|||
void pollKeyboard(ByteBuffer keyDownBuffer);
|
||||
|
||||
/**
|
||||
* Native method to read the keyboard buffer
|
||||
* Method to read the keyboard buffer
|
||||
* @return the total number of events read.
|
||||
*/
|
||||
int readKeyboard(IntBuffer buffer, int buffer_position);
|
||||
|
||||
/**
|
||||
* Native method to enable the translation buffer
|
||||
* Method to enable the translation buffer
|
||||
*/
|
||||
void enableTranslation() throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to enable the buffer
|
||||
* Method to enable the buffer
|
||||
*/
|
||||
void enableKeyboardBuffer() throws LWJGLException;
|
||||
|
||||
|
|
@ -234,7 +234,7 @@ public interface DisplayImplementation {
|
|||
void destroyCursor(Object cursor_handle);
|
||||
|
||||
/* Pbuffer */
|
||||
int getPbufferCaps();
|
||||
int getPbufferCapabilities();
|
||||
|
||||
/**
|
||||
* Method to test for buffer integrity
|
||||
|
|
|
|||
|
|
@ -269,13 +269,13 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
}
|
||||
public native void nGrabMouse(boolean grab);
|
||||
|
||||
public int getNativeCursorCaps() {
|
||||
public int getNativeCursorCapabilities() {
|
||||
lockAWT();
|
||||
int caps = nGetNativeCursorCaps();
|
||||
int caps = nGetNativeCursorCapabilities();
|
||||
unlockAWT();
|
||||
return caps;
|
||||
}
|
||||
public native int nGetNativeCursorCaps();
|
||||
public native int nGetNativeCursorCapabilities();
|
||||
|
||||
public void setNativeCursor(Object handle) throws LWJGLException {
|
||||
lockAWT();
|
||||
|
|
@ -365,13 +365,13 @@ final class LinuxDisplay implements DisplayImplementation {
|
|||
}
|
||||
public native void nDestroyCursor(Object cursorHandle);
|
||||
|
||||
public int getPbufferCaps() {
|
||||
public int getPbufferCapabilities() {
|
||||
lockAWT();
|
||||
int caps = nGetPbufferCaps();
|
||||
int caps = nGetPbufferCapabilities();
|
||||
unlockAWT();
|
||||
return caps;
|
||||
}
|
||||
public native int nGetPbufferCaps();
|
||||
public native int nGetPbufferCapabilities();
|
||||
|
||||
public boolean isBufferLost(ByteBuffer handle) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ final class MacOSXDisplay implements DisplayImplementation {
|
|||
|
||||
private native void nGrabMouse(boolean grab);
|
||||
|
||||
public int getNativeCursorCaps() {
|
||||
public int getNativeCursorCapabilities() {
|
||||
/*
|
||||
int cursor_colors = Toolkit.getDefaultToolkit().getMaximumCursorColors();
|
||||
boolean supported = cursor_colors >= Short.MAX_VALUE && getMaxCursorSize() > 0;
|
||||
|
|
@ -373,7 +373,7 @@ final class MacOSXDisplay implements DisplayImplementation {
|
|||
public void destroyCursor(Object cursor_handle) {
|
||||
}
|
||||
|
||||
public int getPbufferCaps() {
|
||||
public int getPbufferCapabilities() {
|
||||
return GL11.glGetString(GL11.GL_EXTENSIONS).indexOf("GL_APPLE_pixel_buffer") != -1 ? Pbuffer.PBUFFER_SUPPORTED : 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ public final class Pbuffer {
|
|||
* with the Display context (if created).
|
||||
*/
|
||||
public Pbuffer(int width, int height, PixelFormat pixel_format, RenderTexture renderTexture, Pbuffer shared_context) throws LWJGLException {
|
||||
if ((getPbufferCaps() & PBUFFER_SUPPORTED) == 0)
|
||||
if ((getCapabilities() & PBUFFER_SUPPORTED) == 0)
|
||||
throw new IllegalStateException("Pbuffers are not supported");
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
|
@ -223,8 +223,8 @@ public final class Pbuffer {
|
|||
*
|
||||
* @return a bitmask of Pbuffer capabilities.
|
||||
*/
|
||||
public static int getPbufferCaps() {
|
||||
return Display.getImplementation().getPbufferCaps();
|
||||
public static int getCapabilities() {
|
||||
return Display.getImplementation().getPbufferCapabilities();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import java.nio.IntBuffer;
|
|||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.input.Cursor;
|
||||
|
||||
final class Win32Display implements DisplayImplementation {
|
||||
private static final int CURSOR_HANDLE_SIZE = 8;
|
||||
|
|
@ -81,7 +82,10 @@ final class Win32Display implements DisplayImplementation {
|
|||
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 int getNativeCursorCapabilities() {
|
||||
return Cursor.CURSOR_ONE_BIT_TRANSPARENCY;
|
||||
}
|
||||
|
||||
public native void setNativeCursor(Object handle) throws LWJGLException;
|
||||
public native int getMinCursorSize();
|
||||
public native int getMaxCursorSize();
|
||||
|
|
@ -104,7 +108,7 @@ final class Win32Display implements DisplayImplementation {
|
|||
}
|
||||
|
||||
public native void destroyCursor(Object cursorHandle);
|
||||
public native int getPbufferCaps();
|
||||
public native int getPbufferCapabilities();
|
||||
public native boolean isBufferLost(ByteBuffer handle);
|
||||
public native void makePbufferCurrent(ByteBuffer handle) throws LWJGLException;
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class HWCursorTest {
|
|||
}
|
||||
|
||||
private static void initNativeCursors() throws Exception {
|
||||
if ((Mouse.getNativeCursorCaps() & Mouse.CURSOR_ONE_BIT_TRANSPARENCY) == 0) {
|
||||
if ((Cursor.getCapabilities() & Cursor.CURSOR_ONE_BIT_TRANSPARENCY) == 0) {
|
||||
System.out.println("No HW cursor support!");
|
||||
System.exit(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public class PbufferTest {
|
|||
// start of in windowed mode
|
||||
Display.create();
|
||||
// gl = new GLWindow("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0);
|
||||
if ((Pbuffer.getPbufferCaps() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
|
||||
if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
|
||||
System.out.println("No Pbuffer support!");
|
||||
System.exit(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public final class PbufferTest {
|
|||
|
||||
glInit();
|
||||
|
||||
if ( (Pbuffer.getPbufferCaps() & Pbuffer.PBUFFER_SUPPORTED) == 0 ) {
|
||||
if ( (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0 ) {
|
||||
System.out.println("No Pbuffer support!");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue