*** empty log message ***

This commit is contained in:
Elias Naur 2003-10-14 14:29:23 +00:00
parent 15dafb1c5a
commit a6c56bd791
8 changed files with 144 additions and 8 deletions

View File

@ -103,7 +103,8 @@ public class HWCursorTest {
System.exit(0);
}
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 image_size = Mouse.getMaxCursorSize()*Mouse.getMaxCursorSize();
IntBuffer cursor_images = ByteBuffer.allocateDirect(num_images*image_size*4).order(ByteOrder.nativeOrder()).asIntBuffer();

View File

@ -132,7 +132,7 @@ public class MouseTest {
}
position.x += Mouse.dx;
position.y -= Mouse.dy;
position.y += Mouse.dy;
if(position.x<0) {
position.x = 0;

View File

@ -48,7 +48,7 @@ void putEventElement(event_queue_t *queue, unsigned char byte) {
int next_index = (queue->list_end + 1)%EVENT_BUFFER_SIZE;
if (next_index == queue->list_start) {
#ifdef _DEBUG
printf("Keyboard buffer overflow!\n");
printf("Event buffer overflow!\n");
#endif
return;
}

View File

@ -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 "extxcursor.h"
#include "Window.h"

View File

@ -11,7 +11,7 @@ NATIVE = \
org_lwjgl_opengl_MacOSX.cpp \
tools.cpp \
org_lwjgl_input_Mouse.cpp \
# org_lwjgl_input_Cursor.cpp \
org_lwjgl_input_Cursor.cpp \
org_lwjgl_opengl_Window.cpp
# org_lwjgl_opengl_Pbuffer.cpp

View File

@ -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) {
}

View File

@ -277,7 +277,7 @@ static bool findDevice(void) {
#ifdef _DEBUG
printf("Could not find matching devices\n");
#endif
return;
return false;
}
while (!success && (hid_device = IOIteratorNext(device_iterator)) != NULL) {
kern_err = IORegistryEntryCreateCFProperties(hid_device, &dev_props, kCFAllocatorDefault, kNilOptions);
@ -301,8 +301,10 @@ static bool findDevice(void) {
static void handleButton(unsigned char button_index, unsigned char state) {
button_states[button_index] = state;
putEventElement(&event_queue, button_index);
putEventElement(&event_queue, state);
if (buffer_enabled) {
putEventElement(&event_queue, button_index);
putEventElement(&event_queue, state);
}
}
static void pollDevice() {
@ -388,13 +390,16 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv * env, jclass c
return;
}
CGAssociateMouseAndMouseCursorPosition(FALSE);
CGDisplayHideCursor(CGMainDisplayID());
created = true;
}
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv * env, jclass clazz) {
shutdownDevice();
if (!native_cursor)
if (!native_cursor) {
CGAssociateMouseAndMouseCursorPosition(TRUE);
CGDisplayShowCursor(CGMainDisplayID());
}
created = false;
}

View File

@ -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 "org_lwjgl_input_Cursor.h"
#include "Window.h"