|
From: Elias N. <eli...@us...> - 2003-09-30 10:52:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv26555/src/native/macosx Modified Files: org_lwjgl_input_Keyboard.cpp org_lwjgl_opengl_Window.cpp Log Message: boolean results -> Exceptions Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_input_Keyboard.cpp 1 Jan 2003 03:58:03 -0000 1.4 +++ org_lwjgl_input_Keyboard.cpp 30 Sep 2003 10:52:05 -0000 1.5 @@ -39,11 +39,11 @@ * @version $Revision$ */ -#include <Carbon/Carbon.h> -#include <assert.h> #include "org_lwjgl_input_Keyboard.h" -KeyMap keyMap; +#define KEYBOARD_BUFFER_SIZE 50 +#define KEYBOARD_SIZE 256 +#define KEY_EVENT_BACKLOG 40 /* * Class: org_lwjgl_input_Keyboard @@ -53,32 +53,16 @@ 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 +JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate (JNIEnv * env, jclass clazz) { - -#ifdef _DEBUG - printf("Creating OSX Carbon keyboard interface\n"); -#endif - - return JNI_TRUE; } /* @@ -89,24 +73,16 @@ 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) + (JNIEnv * env, jclass clazz, jobject buffer) { - // get the keymap from the operating system's carbon layer - // - GetKeys( keyMap ); } /* @@ -114,10 +90,18 @@ * Method: nRead * Signature: (I)V */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead - (JNIEnv * env, jclass clazz, jint keys) +JNIEXPORT int JNICALL Java_org_lwjgl_input_Keyboard_nRead + (JNIEnv * env, jclass clazz) +{ + +/* + * Class: org_lwjgl_input_Keyboard + * Method: nEnableTranslation + * Signature: ()I + */ +JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation + (JNIEnv *env, jclass clazz) { - return 0; } /* @@ -128,7 +112,14 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer (JNIEnv * env, jclass clazz) { - printf("Buffered input is currently not available\n"); - - return JNI_FALSE; +} + +/* + * Class: org_lwjgl_input_Keyboard + * Method: nisStateKeySet + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nisStateKeySet(JNIEnv *env, jclass clazz, jint key) +{ + return org_lwjgl_input_Keyboard_STATE_UNKNOWN; } Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- org_lwjgl_opengl_Window.cpp 29 Sep 2003 11:58:35 -0000 1.8 +++ org_lwjgl_opengl_Window.cpp 30 Sep 2003 10:52:05 -0000 1.9 @@ -73,24 +73,22 @@ } static pascal OSStatus doQuit(EventHandlerCallRef next_handler, EventRef event, void *user_data) { -printf("Close requested\n"); close_requested = true; return noErr; } static void registerEventHandlers(JNIEnv *env) { - EventTypeSpec event_type; + EventTypeSpec event_types[2]; OSStatus err; EventHandlerUPP handler_upp = NewEventHandlerUPP(doQuit); - event_type.eventClass = kEventClassWindow; - event_type.eventKind = kEventWindowClose; - err = InstallWindowEventHandler(win_ref, handler_upp, 1, &event_type, NULL, NULL); + event_types[0].eventClass = kEventClassWindow; + event_types[0].eventKind = kEventWindowClose; + err = InstallWindowEventHandler(win_ref, handler_upp, 1, event_types, NULL, NULL); + DisposeEventHandlerUPP(handler_upp); if (noErr != err) { - DisposeEventHandlerUPP(handler_upp); throwException(env, "Could not register window event handler"); return; } - DisposeEventHandlerUPP(handler_upp); } static void destroy(void) { @@ -125,7 +123,6 @@ throwException(env, "Could not create context"); return false; } - //if (aglSetFullScreen(context, 800, 600, 85, 0) == GL_FALSE) { if (aglSetDrawable(context, drawable) == GL_FALSE) { aglDestroyContext(context); throwException(env, "Could not attach context"); @@ -180,15 +177,21 @@ throwException(env, "Could not load gl function pointers"); return; } - TransitionWindow(win_ref, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL); + ShowWindow(win_ref); SelectWindow(win_ref); } JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_update (JNIEnv *env, jclass clazz) { + RunApplicationEventLoop(); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jclass clazz) +{ aglSwapBuffers(context); } + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy (JNIEnv *env, jclass clazz) |