*** empty log message ***
This commit is contained in:
parent
15dafb1c5a
commit
a6c56bd791
|
@ -103,7 +103,8 @@ public class HWCursorTest {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
System.out.println("Maximum native cursor size: " + Mouse.getMaxCursorSize() + ", min size: " + Mouse.getMinCursorSize());
|
System.out.println("Maximum native cursor size: " + Mouse.getMaxCursorSize() + ", min size: " + Mouse.getMinCursorSize());
|
||||||
mouse_x = mouse_y = 0;
|
mouse_x = 400;
|
||||||
|
mouse_y = 300;
|
||||||
int num_images = 3;
|
int num_images = 3;
|
||||||
int image_size = Mouse.getMaxCursorSize()*Mouse.getMaxCursorSize();
|
int image_size = Mouse.getMaxCursorSize()*Mouse.getMaxCursorSize();
|
||||||
IntBuffer cursor_images = ByteBuffer.allocateDirect(num_images*image_size*4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
IntBuffer cursor_images = ByteBuffer.allocateDirect(num_images*image_size*4).order(ByteOrder.nativeOrder()).asIntBuffer();
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class MouseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
position.x += Mouse.dx;
|
position.x += Mouse.dx;
|
||||||
position.y -= Mouse.dy;
|
position.y += Mouse.dy;
|
||||||
|
|
||||||
if(position.x<0) {
|
if(position.x<0) {
|
||||||
position.x = 0;
|
position.x = 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@ void putEventElement(event_queue_t *queue, unsigned char byte) {
|
||||||
int next_index = (queue->list_end + 1)%EVENT_BUFFER_SIZE;
|
int next_index = (queue->list_end + 1)%EVENT_BUFFER_SIZE;
|
||||||
if (next_index == queue->list_start) {
|
if (next_index == queue->list_start) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Keyboard buffer overflow!\n");
|
printf("Event buffer overflow!\n");
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002 Light Weight Java Game Library 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 'Light Weight Java Game Library' 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Linux cursor handling.
|
||||||
|
*
|
||||||
|
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
#include "org_lwjgl_input_Cursor.h"
|
#include "org_lwjgl_input_Cursor.h"
|
||||||
#include "extxcursor.h"
|
#include "extxcursor.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
|
|
@ -11,7 +11,7 @@ NATIVE = \
|
||||||
org_lwjgl_opengl_MacOSX.cpp \
|
org_lwjgl_opengl_MacOSX.cpp \
|
||||||
tools.cpp \
|
tools.cpp \
|
||||||
org_lwjgl_input_Mouse.cpp \
|
org_lwjgl_input_Mouse.cpp \
|
||||||
# org_lwjgl_input_Cursor.cpp \
|
org_lwjgl_input_Cursor.cpp \
|
||||||
org_lwjgl_opengl_Window.cpp
|
org_lwjgl_opengl_Window.cpp
|
||||||
# org_lwjgl_opengl_Pbuffer.cpp
|
# org_lwjgl_opengl_Pbuffer.cpp
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002 Light Weight Java Game Library 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 'Light Weight Java Game Library' 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Mac OS X cursor handling.
|
||||||
|
*
|
||||||
|
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "org_lwjgl_input_Cursor.h"
|
||||||
|
|
||||||
|
JNIEXPORT jlong 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, jint images_offset, jobject delay_buffer, jint delays_offset) {
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Cursor_nDestroyCursor(JNIEnv *env, jclass clazz, jlong cursor_handle) {
|
||||||
|
}
|
|
@ -277,7 +277,7 @@ static bool findDevice(void) {
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("Could not find matching devices\n");
|
printf("Could not find matching devices\n");
|
||||||
#endif
|
#endif
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
while (!success && (hid_device = IOIteratorNext(device_iterator)) != NULL) {
|
while (!success && (hid_device = IOIteratorNext(device_iterator)) != NULL) {
|
||||||
kern_err = IORegistryEntryCreateCFProperties(hid_device, &dev_props, kCFAllocatorDefault, kNilOptions);
|
kern_err = IORegistryEntryCreateCFProperties(hid_device, &dev_props, kCFAllocatorDefault, kNilOptions);
|
||||||
|
@ -301,9 +301,11 @@ static bool findDevice(void) {
|
||||||
|
|
||||||
static void handleButton(unsigned char button_index, unsigned char state) {
|
static void handleButton(unsigned char button_index, unsigned char state) {
|
||||||
button_states[button_index] = state;
|
button_states[button_index] = state;
|
||||||
|
if (buffer_enabled) {
|
||||||
putEventElement(&event_queue, button_index);
|
putEventElement(&event_queue, button_index);
|
||||||
putEventElement(&event_queue, state);
|
putEventElement(&event_queue, state);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void pollDevice() {
|
static void pollDevice() {
|
||||||
IOHIDEventStruct event;
|
IOHIDEventStruct event;
|
||||||
|
@ -388,13 +390,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv * env, jclass c
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CGAssociateMouseAndMouseCursorPosition(FALSE);
|
CGAssociateMouseAndMouseCursorPosition(FALSE);
|
||||||
|
CGDisplayHideCursor(CGMainDisplayID());
|
||||||
created = true;
|
created = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv * env, jclass clazz) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv * env, jclass clazz) {
|
||||||
shutdownDevice();
|
shutdownDevice();
|
||||||
if (!native_cursor)
|
if (!native_cursor) {
|
||||||
CGAssociateMouseAndMouseCursorPosition(TRUE);
|
CGAssociateMouseAndMouseCursorPosition(TRUE);
|
||||||
|
CGDisplayShowCursor(CGMainDisplayID());
|
||||||
|
}
|
||||||
created = false;
|
created = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002 Light Weight Java Game Library 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 'Light Weight Java Game Library' 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* win32 mouse handling.
|
||||||
|
*
|
||||||
|
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||||
|
* @version $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "org_lwjgl_input_Cursor.h"
|
#include "org_lwjgl_input_Cursor.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
|
Loading…
Reference in New Issue