mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-02-28 18:44:13 +01:00
*** empty log message ***
This commit is contained in:
parent
a6c56bd791
commit
6b9b2d302f
|
|
@ -6,7 +6,7 @@ INCLUDES = -I../common
|
|||
NATIVE = \
|
||||
org_lwjgl_Display.cpp \
|
||||
org_lwjgl_Sys.cpp \
|
||||
# org_lwjgl_input_Controller.cpp \
|
||||
org_lwjgl_input_Controller.cpp \
|
||||
org_lwjgl_input_Keyboard.cpp \
|
||||
org_lwjgl_opengl_MacOSX.cpp \
|
||||
tools.cpp \
|
||||
|
|
|
|||
|
|
@ -47,6 +47,6 @@
|
|||
extern void setQuitRequested(void);
|
||||
extern bool registerKeyboardHandler(JNIEnv* env, WindowRef win_ref);
|
||||
// extern bool registerMouseHandler(JNIEnv* env, WindowRef win_ref);
|
||||
extern bool isMouseCreatedAndNotNativeCursor(void);
|
||||
extern bool isMouseCreated(void);
|
||||
|
||||
#endif /* _LWJGL_WINDOW_H_INCLUDED_ */
|
||||
|
|
|
|||
56
src/native/macosx/org_lwjgl_input_Controller.cpp
Normal file
56
src/native/macosx/org_lwjgl_input_Controller.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2002 Lightweight 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 controller handling.
|
||||
*
|
||||
* @author Elias Naur <brian@matzon.com>
|
||||
* @version $Revision$
|
||||
*/
|
||||
|
||||
#include "org_lwjgl_input_Controller.h"
|
||||
#include "common_tools.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_initIDs(JNIEnv * env, jclass clazz) {
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) {
|
||||
throwException(env, "Controller not implemented");
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nDestroy(JNIEnv *env, jclass clazz) {
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nPoll(JNIEnv * env, jclass clazz) {
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ static jfieldID fid_buttons;
|
|||
static unsigned char button_states[NUM_BUTTONS];
|
||||
/*static int last_x;
|
||||
static int last_y;*/
|
||||
static bool native_cursor;
|
||||
//static bool native_cursor;
|
||||
static bool created;
|
||||
static bool buffer_enabled;
|
||||
static IOHIDDeviceInterface **device_interface;
|
||||
|
|
@ -79,8 +79,8 @@ static int last_dz;
|
|||
static void searchDictionary(CFDictionaryRef dict);
|
||||
static void searchObject(CFTypeRef object);
|
||||
|
||||
bool isMouseCreatedAndNotNativeCursor(void) {
|
||||
return created && !native_cursor;
|
||||
bool isMouseCreated(void) {
|
||||
return created/* && !native_cursor*/;
|
||||
}
|
||||
|
||||
/*static pascal OSStatus doMouseMoved(EventHandlerCallRef next_handler, EventRef event, void *user_data) {
|
||||
|
|
@ -362,19 +362,22 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_initIDs(JNIEnv * env, jclass c
|
|||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps(JNIEnv *env, jclass clazz) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor(JNIEnv *env, jclass clazz, jlong cursor_handle) {
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize(JNIEnv *env, jclass clazz) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMaxCursorSize(JNIEnv *env, jclass clazz) {
|
||||
return 16;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv * env, jclass clazz) {
|
||||
native_cursor = false;
|
||||
// native_cursor = false;
|
||||
buffer_enabled = false;
|
||||
x_axis_cookie = NULL;
|
||||
y_axis_cookie = NULL;
|
||||
|
|
@ -396,10 +399,10 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv * env, jclass c
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -407,17 +410,17 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll(JNIEnv * env, jclass cla
|
|||
int dx, dy, dz;
|
||||
pollDevice();
|
||||
dz = last_dz;
|
||||
if (!native_cursor) {
|
||||
//if (!native_cursor) {
|
||||
dx = last_dx;
|
||||
dy = -last_dy;
|
||||
} else {
|
||||
/* Point cursor_pos;
|
||||
/*} else {
|
||||
Point cursor_pos;
|
||||
GetMouse(&cursor_pos);
|
||||
dx = cursor_pos.v - last_x;
|
||||
dy = cursor_pos.h - last_y;
|
||||
last_x += dx;
|
||||
last_y += dy;*/
|
||||
}
|
||||
last_y += dy;
|
||||
}*/
|
||||
env->SetStaticIntField(clazz, fid_dx, (jint)dx);
|
||||
env->SetStaticIntField(clazz, fid_dy, (jint)dy);
|
||||
env->SetStaticIntField(clazz, fid_dwheel, (jint)dz);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ static pascal OSStatus doActivate(EventHandlerCallRef next_handler, EventRef eve
|
|||
lock();
|
||||
miniaturized = false;
|
||||
activated = true;
|
||||
if (isMouseCreatedAndNotNativeCursor())
|
||||
if (isMouseCreated())
|
||||
warpCursorToCenter();
|
||||
unlock();
|
||||
return eventNotHandledErr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue