Added buffer positions to Cursor
This commit is contained in:
parent
a62ebc2c3b
commit
683991fe79
|
@ -74,7 +74,7 @@ public class Cursor {
|
||||||
*/
|
*/
|
||||||
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception {
|
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws Exception {
|
||||||
assert Mouse.isCreated();
|
assert Mouse.isCreated();
|
||||||
nativeHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, delays);
|
nativeHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images, images.position(), delays, delays != null ? delays.position() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,7 +94,7 @@ public class Cursor {
|
||||||
/**
|
/**
|
||||||
* Native method to create a native cursor
|
* Native method to create a native cursor
|
||||||
*/
|
*/
|
||||||
private static native int nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays);
|
private static native int nCreateCursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, int images_offset, IntBuffer delays, int delays_offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Native method to destroy a native cursor
|
* Native method to destroy a native cursor
|
||||||
|
|
|
@ -12,10 +12,10 @@ extern "C" {
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_input_Cursor
|
* Class: org_lwjgl_input_Cursor
|
||||||
* Method: nCreateCursor
|
* Method: nCreateCursor
|
||||||
* Signature: (IIIIILjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
|
* Signature: (IIIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
|
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
|
||||||
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jobject);
|
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jobject, jint, jobject, jint);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_lwjgl_input_Cursor
|
* Class: org_lwjgl_input_Cursor
|
||||||
|
|
|
@ -51,8 +51,8 @@ if test "x$JAVA_HOME" = x; then
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT($JAVA_HOME)
|
AC_MSG_RESULT($JAVA_HOME)
|
||||||
JAVA_HOME="$JAVA_HOME"
|
JAVA_HOME="$JAVA_HOME"
|
||||||
CPPFLAGS="$CPPFLAGS -D_DEBUG -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
CPPFLAGS="$CPPFLAGS -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
||||||
CFLAGS="$CFLAGS -D_DEBUG -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
CFLAGS="$CFLAGS -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
* Signature: (IIIIIII)I
|
* Signature: (IIIIIII)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
|
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
|
||||||
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jobject delay_buffer)
|
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
|
||||||
{
|
{
|
||||||
const int *delays = NULL;
|
const int *delays = NULL;
|
||||||
if (delay_buffer != NULL)
|
if (delay_buffer != NULL)
|
||||||
delays = (const int *)env->GetDirectBufferAddress(delay_buffer);
|
delays = (const int *)env->GetDirectBufferAddress(delay_buffer) + delays_offset;
|
||||||
XcursorPixel *pixels = (XcursorPixel *)env->GetDirectBufferAddress(image_buffer);
|
XcursorPixel *pixels = (XcursorPixel *)env->GetDirectBufferAddress(image_buffer) + images_offset;
|
||||||
int stride = width*height;
|
int stride = width*height;
|
||||||
XcursorImages *cursor_images = XcursorImagesCreate(num_images);
|
XcursorImages *cursor_images = XcursorImagesCreate(num_images);
|
||||||
if (cursor_images == NULL)
|
if (cursor_images == NULL)
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
* Signature: (IIIIIIIII)I
|
* Signature: (IIIIIIIII)I
|
||||||
*/
|
*/
|
||||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
|
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Cursor_nCreateCursor
|
||||||
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jobject delay_buffer)
|
(JNIEnv *env, jclass clazz, jint width, jint height, jint x_hotspot, jint y_hotspot, jint num_images, jobject image_buffer, jint images_offset, jobject delay_buffer, jint delays_offset)
|
||||||
{
|
{
|
||||||
int *pixels = (int *)env->GetDirectBufferAddress(image_buffer);
|
int *pixels = (int *)env->GetDirectBufferAddress(image_buffer) + images_offset;
|
||||||
|
|
||||||
BITMAPINFO bitmapInfo;
|
BITMAPINFO bitmapInfo;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue