mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-02-02 13:54:36 +01:00
135 lines
3.6 KiB
C++
135 lines
3.6 KiB
C++
/*
|
|
* 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 keyboard handling.
|
|
*
|
|
* @author elias_naur <elias_naur@users.sourceforge.net>
|
|
* @version $Revision$
|
|
*/
|
|
|
|
#include <Carbon/Carbon.h>
|
|
#include <assert.h>
|
|
#include "org_lwjgl_input_Keyboard.h"
|
|
|
|
KeyMap keyMap;
|
|
|
|
/*
|
|
* Class: org_lwjgl_input_Keyboard
|
|
* Method: initIDs
|
|
* Signature: ()V
|
|
*/
|
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_initIDs
|
|
(JNIEnv * env, jclass clazz)
|
|
{
|
|
// Get a global class instance, just to be sure
|
|
static jobject globalClassLock = NULL;
|
|
|
|
if (globalClassLock == NULL) {
|
|
globalClassLock = env->NewGlobalRef(clazz);
|
|
}
|
|
|
|
fid_readBuffer = env->GetStaticFieldID(clazz, "readBuffer", "Ljava/nio/ByteBuffer;");
|
|
fid_readBufferAddress = env->GetStaticFieldID(clazz, "readBufferAddress", "I");
|
|
}
|
|
|
|
|
|
/*
|
|
* Class: org_lwjgl_input_Keyboard
|
|
* Method: nCreate
|
|
* Signature: ()Z
|
|
*/
|
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nCreate
|
|
(JNIEnv * env, jclass clazz)
|
|
{
|
|
|
|
#ifdef _DEBUG
|
|
printf("Creating OSX Carbon keyboard interface\n");
|
|
#endif
|
|
|
|
return JNI_TRUE;
|
|
}
|
|
|
|
/*
|
|
* Class: org_lwjgl_input_Keyboard
|
|
* Method: nDestroy
|
|
* Signature: ()V
|
|
*/
|
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy
|
|
(JNIEnv * env, jclass clazz)
|
|
{
|
|
// no specific methodology for doing this in OSX input system
|
|
#ifdef _DEBUG
|
|
printf("Destroying OSX Carbon keyboard interface\n");
|
|
#endif
|
|
}
|
|
|
|
|
|
/*
|
|
* Class: org_lwjgl_input_Keyboard
|
|
* Method: nPoll
|
|
* Signature: (I)V
|
|
*/
|
|
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll
|
|
(JNIEnv * env, jclass clazz, jint buf)
|
|
{
|
|
// get the keymap from the operating system's carbon layer
|
|
//
|
|
GetKeys( keyMap );
|
|
}
|
|
|
|
/*
|
|
* Class: org_lwjgl_input_Keyboard
|
|
* Method: nRead
|
|
* Signature: (I)V
|
|
*/
|
|
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead
|
|
(JNIEnv * env, jclass clazz, jint keys)
|
|
{
|
|
|
|
}
|
|
|
|
/*
|
|
* Class: org_lwjgl_input_Keyboard
|
|
* Method: nEnableBuffer
|
|
* Signature: ()I
|
|
*/
|
|
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer
|
|
(JNIEnv * env, jclass clazz)
|
|
{
|
|
printf("Buffered input is currently not available\n");
|
|
|
|
return JNI_FALSE;
|
|
}
|