Initial revision

This commit is contained in:
Caspian Rychlik-Prince 2002-08-11 11:49:32 +00:00
parent 6fe3e3188e
commit 6b87bd6d20
31 changed files with 12092 additions and 0 deletions

View File

@ -0,0 +1,13 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_Audio */
#ifndef _Included_org_lwjgl_Audio
#define _Included_org_lwjgl_Audio
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,42 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_Display */
#ifndef _Included_org_lwjgl_Display
#define _Included_org_lwjgl_Display
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: created */
/* Inaccessible static: mode */
/* Inaccessible static: handle */
/* Inaccessible static: class_000240 */
/*
* Class: org_lwjgl_Display
* Method: getAvailableDisplayModes
* Signature: ()[Lorg/lwjgl/DisplayMode;
*/
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_getAvailableDisplayModes
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_Display
* Method: nCreate
* Signature: (IIIIZ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate
(JNIEnv *, jclass, jint, jint, jint, jint, jboolean);
/*
* Class: org_lwjgl_Display
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Display_nDestroy
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,109 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_Math */
#ifndef _Included_org_lwjgl_Math
#define _Included_org_lwjgl_Math
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_Math_PI
#define org_lwjgl_Math_PI 3.1415927f
#undef org_lwjgl_Math_MATRIXOP_NOOP
#define org_lwjgl_Math_MATRIXOP_NOOP 0L
#undef org_lwjgl_Math_MATRIXOP_NEGATE
#define org_lwjgl_Math_MATRIXOP_NEGATE 1L
#undef org_lwjgl_Math_MATRIXOP_NORMALIZE
#define org_lwjgl_Math_MATRIXOP_NORMALIZE 2L
#undef org_lwjgl_Math_MATRIXOP_INVERT
#define org_lwjgl_Math_MATRIXOP_INVERT 3L
#undef org_lwjgl_Math_MATRIXOP_MULTIPLY
#define org_lwjgl_Math_MATRIXOP_MULTIPLY 4L
#undef org_lwjgl_Math_MATRIXOP_ADD
#define org_lwjgl_Math_MATRIXOP_ADD 5L
#undef org_lwjgl_Math_MATRIXOP_SUBTRACT
#define org_lwjgl_Math_MATRIXOP_SUBTRACT 6L
/*
* Class: org_lwjgl_Math
* Method: random
* Signature: ()F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_random
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_Math
* Method: sin
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_sin
(JNIEnv *, jclass, jfloat);
/*
* Class: org_lwjgl_Math
* Method: cos
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_cos
(JNIEnv *, jclass, jfloat);
/*
* Class: org_lwjgl_Math
* Method: tan
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_tan
(JNIEnv *, jclass, jfloat);
/*
* Class: org_lwjgl_Math
* Method: asin
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_asin
(JNIEnv *, jclass, jfloat);
/*
* Class: org_lwjgl_Math
* Method: acos
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_acos
(JNIEnv *, jclass, jfloat);
/*
* Class: org_lwjgl_Math
* Method: atan
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_atan
(JNIEnv *, jclass, jfloat);
/*
* Class: org_lwjgl_Math
* Method: sqrt
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_sqrt
(JNIEnv *, jclass, jfloat);
/*
* Class: org_lwjgl_Math
* Method: matrixOp
* Signature: (IIIIIIZIIZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Math_matrixOp__IIIIIIZIIZ
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
/*
* Class: org_lwjgl_Math
* Method: matrixOp
* Signature: (IIIIIZIIIIZIIZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Math_matrixOp__IIIIIZIIIIZIIZ
(JNIEnv *, jclass, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jboolean, jint, jint, jboolean);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,69 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_Sys */
#ifndef _Included_org_lwjgl_Sys
#define _Included_org_lwjgl_Sys
#ifdef __cplusplus
extern "C" {
#endif
#undef org_lwjgl_Sys_LOW_PRIORITY
#define org_lwjgl_Sys_LOW_PRIORITY -1L
#undef org_lwjgl_Sys_NORMAL_PRIORITY
#define org_lwjgl_Sys_NORMAL_PRIORITY 0L
#undef org_lwjgl_Sys_HIGH_PRIORITY
#define org_lwjgl_Sys_HIGH_PRIORITY 1L
#undef org_lwjgl_Sys_REALTIME_PRIORITY
#define org_lwjgl_Sys_REALTIME_PRIORITY 2L
/*
* Class: org_lwjgl_Sys
* Method: getDirectBufferAddress
* Signature: (Ljava/nio/Buffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_Sys_getDirectBufferAddress
(JNIEnv *, jclass, jobject);
/*
* Class: org_lwjgl_Sys
* Method: createDirectBuffer
* Signature: (II)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createDirectBuffer
(JNIEnv *, jclass, jint, jint);
/*
* Class: org_lwjgl_Sys
* Method: getTimerResolution
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_Sys
* Method: getTime
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_Sys
* Method: setTime
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime
(JNIEnv *, jclass, jlong);
/*
* Class: org_lwjgl_Sys
* Method: setProcessPriority
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority
(JNIEnv *, jclass, jint);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,68 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_input_Keyboard */
#ifndef _Included_org_lwjgl_input_Keyboard
#define _Included_org_lwjgl_input_Keyboard
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: created */
/* Inaccessible static: keyDownBuffer */
/* Inaccessible static: keyDownAddress */
/* Inaccessible static: readBuffer */
/* Inaccessible static: readBufferAddress */
/* Inaccessible static: class_000240 */
/*
* Class: org_lwjgl_input_Keyboard
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_initIDs
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_input_Keyboard
* Method: nCreate
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nCreate
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_input_Keyboard
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nDestroy
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_input_Keyboard
* Method: nPoll
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll
(JNIEnv *, jclass, jint);
/*
* Class: org_lwjgl_input_Keyboard
* Method: nRead
* Signature: (I)V
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead
(JNIEnv *, jclass, jint);
/*
* Class: org_lwjgl_input_Keyboard
* Method: nEnableBuffer
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,52 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_input_Mouse */
#ifndef _Included_org_lwjgl_input_Mouse
#define _Included_org_lwjgl_input_Mouse
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: created */
/* Inaccessible static: button */
/* Inaccessible static: dx */
/* Inaccessible static: dy */
/* Inaccessible static: dz */
/* Inaccessible static: class_000240 */
/*
* Class: org_lwjgl_input_Mouse
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_initIDs
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_input_Mouse
* Method: nCreate
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nCreate
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_input_Mouse
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy
(JNIEnv *, jclass);
/*
* Class: org_lwjgl_input_Mouse
* Method: nPoll
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,48 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_BaseGL */
#ifndef _Included_org_lwjgl_opengl_BaseGL
#define _Included_org_lwjgl_opengl_BaseGL
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: currentContext */
/* Inaccessible static: class_000240 */
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nCreate
* Signature: (IIII)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
(JNIEnv *, jobject, jint, jint, jint, jint);
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy
(JNIEnv *, jobject);
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: swapBuffers
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers
(JNIEnv *, jobject);
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nMakeCurrent
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nMakeCurrent
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_CoreGL12 */
#ifndef _Included_org_lwjgl_opengl_CoreGL12
#define _Included_org_lwjgl_opengl_CoreGL12
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: currentContext */
/* Inaccessible static: class_000240 */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,16 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_CoreGL13 */
#ifndef _Included_org_lwjgl_opengl_CoreGL13
#define _Included_org_lwjgl_opengl_CoreGL13
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: currentContext */
/* Inaccessible static: class_000240 */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,16 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_CoreGL14 */
#ifndef _Included_org_lwjgl_opengl_CoreGL14
#define _Included_org_lwjgl_opengl_CoreGL14
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: currentContext */
/* Inaccessible static: class_000240 */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,16 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_GL */
#ifndef _Included_org_lwjgl_opengl_GL
#define _Included_org_lwjgl_opengl_GL
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: _00024assertionsDisabled */
/* Inaccessible static: currentContext */
/* Inaccessible static: class_000240 */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,13 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_GLU */
#ifndef _Included_org_lwjgl_opengl_GLU
#define _Included_org_lwjgl_opengl_GLU
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,13 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_lwjgl_opengl_GLUT */
#ifndef _Included_org_lwjgl_opengl_GLUT
#define _Included_org_lwjgl_opengl_GLUT
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,21 @@
/**
* (C) 2002 Shaven Puppy Ltd
*
* LWJGL.cpp Created on Aug 10, 2002 by foo
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
/*
* DLL entry point for Windows. Called when Java loads the .dll
*/
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
)
{
return TRUE; // Success
}

1825
src/native/win32/extgl.c Normal file

File diff suppressed because it is too large Load Diff

3234
src/native/win32/extgl.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
/*
* org_lwjgl_Audio.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_Audio.h"

View File

@ -0,0 +1,201 @@
/*
* org_lwjgl_Display.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_Display.h"
#include <dinput.h>
#define WINDOWCLASSNAME "JGLIBWINDOW"
// Initialise static variables
bool oneShotInitialised = false;
HWND hwnd = NULL; // Handle to the window
HDC hdc = NULL; // Device context
LPDIRECTINPUT lpdi = NULL;
/*
* A dummy WindowProc which does nothing. Used so we can have an invisible OpenGL window
*/
LRESULT CALLBACK WindowProc(HWND hWnd,
UINT msg,
WPARAM wParam,
LPARAM lParam)
{
switch (msg) {
// disable screen saver and monitor power down messages which wreak havoc
case WM_SYSCOMMAND:
{
switch (wParam) {
case SC_SCREENSAVE:
case SC_MONITORPOWER:
return 0;
break;
default:
break;
}
}
}
// default action
return DefWindowProc(hWnd, msg, wParam, lParam);
}
/*
* Sets the fullscreen display mode.
* Returns 1 for success and -1 for failure.
*/
int SetDisplayMode(int width, int height, int bpp, int freq)
{
// Step 2: set display mode using OpenGL friendly tactics
DEVMODE devmode;
devmode.dmSize = sizeof(DEVMODE);
devmode.dmBitsPerPel = bpp;
devmode.dmPelsWidth = width;
devmode.dmPelsHeight = height;
devmode.dmDisplayFlags = 0;
devmode.dmDisplayFrequency = freq;
devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFLAGS | DM_DISPLAYFREQUENCY;
LONG cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN);
switch (cdsret) {
case DISP_CHANGE_BADFLAGS :
printf("Failed to set screen mode: bad flags\n");
return -1;
case DISP_CHANGE_FAILED:
printf("Failed to set screen mode: change failed\n");
return -1;
case DISP_CHANGE_BADMODE:
printf("Failed to set screen mode: bad mode\n");
return -1;
case DISP_CHANGE_SUCCESSFUL :
// Success!
break;
default:
printf("Failed to set screen mode: unknown error\n");
return -1;
}
return 1;
}
/*
* Class: org_lwjgl_Display
* Method: getAvailableDisplayModes
* Signature: ()[Lorg/lwjgl/DisplayMode;
*/
JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_getAvailableDisplayModes
(JNIEnv * env, jclass clazz)
{
return NULL;
}
/*
* Class: org_lwjgl_Display
* Method: nCreate
* Signature: (IIIIZ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate
(JNIEnv * env, jclass clazz, jint width, jint height, jint bpp, jint freq, jboolean debug)
{
#ifdef _DEBUG
printf("Creating display: size %dx%d %dhz %dbpp...\n", width, height, freq, bpp);
#endif
if (!debug && SetDisplayMode(width, height, bpp, freq) != 1)
return JNI_FALSE;
/*
Register a window. This window does nothing, it's just a requirement that we get
a handle to it so we can do other things
*/
if (!oneShotInitialised) {
WNDCLASS windowClass;
windowClass.style = CS_GLOBALCLASS | CS_OWNDC;
windowClass.lpfnWndProc = WindowProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = (HINSTANCE) GetCurrentProcess();
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
windowClass.hCursor = LoadIcon(NULL, IDC_ARROW);
windowClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = WINDOWCLASSNAME;
if (RegisterClass(&windowClass) == 0) {
printf("Failed to register window class\n");
return JNI_FALSE;
}
oneShotInitialised = true;
}
// Create the window now, using that class:
hwnd = CreateWindow(
WINDOWCLASSNAME,
"LWJGL",
WS_POPUP, // | WS_MAXIMIZE,
0, 0,
width, height,
NULL,
NULL,
(HINSTANCE) GetCurrentProcess(),
NULL);
// And we never look at windowClass again...
ShowWindow(hwnd, SW_SHOW);
UpdateWindow(hwnd);
hdc = GetWindowDC(hwnd);
// Success! Now you need to initialize a GL object, which creates a GL rendering context;
// and then to issue commands to it, you need to call gl::makeCurrent().
#ifdef _DEBUG
printf("Created display\n");
#endif
// Hide the mouse
ShowCursor(FALSE);
// Create input
HRESULT ret = DirectInputCreate((HINSTANCE)GetCurrentProcess(), DIRECTINPUT_VERSION, &lpdi, NULL);
if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) {
printf("Failed to create directinput\n");
return JNI_FALSE;
}
return JNI_TRUE;
}
/*
* Class: org_lwjgl_Display
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Display_nDestroy
(JNIEnv * env, jclass clazz)
{
// Reset the display if necessary
ChangeDisplaySettings(NULL, 0);
if (hwnd != NULL) {
// Vape the window
DestroyWindow(hwnd);
hwnd = NULL;
}
#ifdef _DEBUG
printf("Destroyed display\n");
#endif
// Show the mouse
ShowCursor(TRUE);
}

View File

@ -0,0 +1,123 @@
/*
* org_lwjgl_Math.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_Math.h"
#include "math.h"
/*
* Class: org_lwjgl_Math
* Method: random
* Signature: ()F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_random
(JNIEnv * env, jclass clazz)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: sin
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_sin
(JNIEnv * env, jclass clazz, jfloat theta)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: cos
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_cos
(JNIEnv * env, jclass clazz, jfloat theta)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: tan
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_tan
(JNIEnv * env, jclass clazz, jfloat theta)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: asin
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_asin
(JNIEnv * env, jclass clazz, jfloat theta)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: acos
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_acos
(JNIEnv * env, jclass clazz, jfloat theta)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: atan
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_atan
(JNIEnv * env, jclass clazz, jfloat theta)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: sqrt
* Signature: (F)F
*/
JNIEXPORT jfloat JNICALL Java_org_lwjgl_Math_sqrt
(JNIEnv * env, jclass clazz, jfloat value)
{
return 0.0f;
}
/*
* Class: org_lwjgl_Math
* Method: matrixOp
* Signature: (IIIIIIZIIZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Math_matrixOp__IIIIIIZIIZ
(JNIEnv * env, jclass clazz, jint, jint, jint, jint, jint, jint, jboolean, jint, jint, jboolean)
{
}
/*
* Class: org_lwjgl_Math
* Method: matrixOp
* Signature: (IIIIIZIIIIZIIZ)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Math_matrixOp__IIIIIZIIIIZIIZ
(JNIEnv * env, jclass clazz, jint, jint, jint, jint, jint, jboolean, jint, jint, jint, jint, jboolean, jint, jint, jboolean)
{
}

View File

@ -0,0 +1,111 @@
/*
* org_lwjgl_Sys.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_Sys.h"
__int64 hires_timer_freq; // Hires timer frequency
__int64 hires_timer_start; // Hires timer start
__int64 hires_timer; // Hires timer current time
/*
* Class: org_lwjgl_Sys
* Method: getDirectBufferAddress
* Signature: (Ljava/nio/Buffer;)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_Sys_getDirectBufferAddress
(JNIEnv * env, jclass clazz, jobject buf)
{
return (jint) env->GetDirectBufferAddress(buf);
}
/*
* Class: org_lwjgl_Sys
* Method: createDirectBuffer
* Signature: (II)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_Sys_createDirectBuffer
(JNIEnv * env, jclass clazz, jint address, jint length)
{
return env->NewDirectByteBuffer((void *)address, length);
}
/*
* Class: org_lwjgl_Sys
* Method: getTimerResolution
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
(JNIEnv * env, jclass clazz)
{
return hires_timer_freq;
}
/*
* Class: org_lwjgl_Sys
* Method: getTime
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime
(JNIEnv * env, jclass clazz)
{
QueryPerformanceCounter((LARGE_INTEGER*) &hires_timer);
hires_timer -= hires_timer_start;
return hires_timer;
}
/*
* Class: org_lwjgl_Sys
* Method: setTime
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime
(JNIEnv * env, jclass clazz, jlong startTime)
{
QueryPerformanceFrequency((LARGE_INTEGER*) &hires_timer_freq);
QueryPerformanceCounter((LARGE_INTEGER*) &hires_timer_start);
hires_timer_start -= startTime;
}
/*
* Class: org_lwjgl_Sys
* Method: setProcessPriority
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority
(JNIEnv * env, jclass clazz, jint priority)
{
HANDLE me = GetCurrentProcess();
int win32priority;
switch (priority) {
case org_lwjgl_Sys_REALTIME_PRIORITY:
win32priority = REALTIME_PRIORITY_CLASS;
break;
case org_lwjgl_Sys_HIGH_PRIORITY:
win32priority = HIGH_PRIORITY_CLASS;
break;
case org_lwjgl_Sys_NORMAL_PRIORITY:
win32priority = NORMAL_PRIORITY_CLASS;
break;
case org_lwjgl_Sys_LOW_PRIORITY:
win32priority = IDLE_PRIORITY_CLASS;
break;
default:
return;
}
if (!SetPriorityClass(me, win32priority)) {
#ifdef _DEBUG
printf("Failed to set priority class.\n");
#endif
}
}

View File

@ -0,0 +1,233 @@
/*
* org_lwjgl_input_Keyboard.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <dinput.h>
#include "org_lwjgl_input_Keyboard.h"
#define KEYBOARD_BUFFER_SIZE 50
BYTE readBuffer[KEYBOARD_BUFFER_SIZE];
LPDIRECTINPUTDEVICE lpdiKeyboard = NULL;
jfieldID fid_readBuffer;
jfieldID fid_readBufferAddress;
extern LPDIRECTINPUT lpdi;
extern HWND hwnd;
/*
* 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->GetFieldID(clazz, "readBuffer", "Ljava/nio/ByteBuffer;");
fid_readBufferAddress = env->GetFieldID(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)
{
// Check to see if we're already initialized
if (lpdiKeyboard != NULL) {
printf("Keyboard already created.\n");
return 1;
}
if (hwnd == NULL) {
printf("No window\n");
return JNI_FALSE;
}
// Create a keyboard device
if (lpdi->CreateDevice(GUID_SysKeyboard, &lpdiKeyboard, NULL) != DI_OK) {
printf("Failed to create keyboard\n");
return JNI_FALSE;
}
if (lpdiKeyboard->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) {
printf("Failed to keyboard coop\n");
return JNI_FALSE;
}
// Tell 'em wot format to be in (the default "you are a mouse and keyboard" format)
lpdiKeyboard->SetDataFormat(&c_dfDIKeyboard);
DIPROPDWORD dipropdw;
dipropdw.diph.dwSize = sizeof(DIPROPDWORD);
dipropdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
dipropdw.diph.dwObj = 0;
dipropdw.diph.dwHow = DIPH_DEVICE;
dipropdw.dwData = KEYBOARD_BUFFER_SIZE;
lpdiKeyboard->SetProperty(DIPROP_BUFFERSIZE, &dipropdw.diph);
HRESULT ret = lpdiKeyboard->Acquire();
if (ret != DI_OK && ret != S_FALSE) {
printf("Failed to acquire keyboard\n");
}
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)
{
// Release keyboard
if (lpdiKeyboard != NULL) {
lpdiKeyboard->Unacquire();
lpdiKeyboard->Release();
lpdiKeyboard = NULL;
}
// Release directinput if the mouse is not present
if (lpdi != NULL) {
// Release directinput
lpdi->Release();
lpdi = NULL;
}
}
/*
* 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)
{
HRESULT ret;
do {
ret = lpdiKeyboard->Acquire();
if (ret == DIERR_INPUTLOST) {
printf("Input lost\n");
return;
} else if (ret == DIERR_NOTACQUIRED) {
printf("not acquired\n");
return;
} else if (ret == DIERR_INVALIDPARAM) {
printf("invalid parameter\n");
return;
} else if (ret == DIERR_NOTBUFFERED) {
printf("not buffered\n");
return;
} else if (ret == DIERR_NOTINITIALIZED) {
printf("not inited\n");
return;
} else if (ret != DI_OK && ret != S_FALSE) {
//printf("unknown keyboard error\n");
return;
}
} while (ret != DI_OK && ret != S_FALSE);
lpdiKeyboard->GetDeviceState(256, (void *)buf);
}
/*
* 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)
{
static DIDEVICEOBJECTDATA rgdod[KEYBOARD_BUFFER_SIZE];
DWORD bufsize = KEYBOARD_BUFFER_SIZE;
HRESULT ret;
do {
ret = lpdiKeyboard->Acquire();
} while (ret != DI_OK && ret != S_FALSE);
ret = lpdiKeyboard->GetDeviceData(
sizeof(DIDEVICEOBJECTDATA),
rgdod,
&bufsize,
0);
if (ret == DI_OK) {
unsigned char * buf = (unsigned char *) keys;
for (unsigned int i = 0; i < bufsize; i ++) {
*buf++ = (unsigned char) rgdod[i].dwOfs;
*buf++ = (unsigned char) rgdod[i].dwData;
}
return bufsize;
} if (ret == DI_BUFFEROVERFLOW) {
#ifdef _DEBUG
printf("Keyboard buffer overflowed\n");
#endif
return -1;
} else if (ret == DIERR_INPUTLOST) {
#ifdef _DEBUG
printf("Input lost\n");
#endif
return -1;
} else if (ret == DIERR_NOTACQUIRED) {
#ifdef _DEBUG
printf("not acquired\n");
#endif
return -1;
} else if (ret == DIERR_INVALIDPARAM) {
#ifdef _DEBUG
printf("invalid parameter\n");
#endif
return -1;
} else if (ret == DIERR_NOTBUFFERED) {
#ifdef _DEBUG
printf("not buffered\n");
#endif
return -1;
} else if (ret == DIERR_NOTINITIALIZED) {
#ifdef _DEBUG
printf("not inited\n");
#endif
return -1;
} else {
#ifdef _DEBUG
printf("unknown keyboard error\n");
#endif
return -1;
}
}
/*
* Class: org_lwjgl_input_Keyboard
* Method: nEnableBuffer
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nEnableBuffer
(JNIEnv * env, jclass clazz)
{
jobject newBuffer = env->NewDirectByteBuffer(&readBuffer, KEYBOARD_BUFFER_SIZE);
env->SetStaticObjectField(clazz, fid_readBuffer, newBuffer);
env->SetStaticIntField(clazz, fid_readBufferAddress, (jint) (&readBuffer));
return KEYBOARD_BUFFER_SIZE;
}

View File

@ -0,0 +1,169 @@
/*
* org_lwjgl_input_Mouse.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "org_lwjgl_input_Mouse.h"
#undef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0300
#include <dinput.h>
extern LPDIRECTINPUT lpdi;
LPDIRECTINPUTDEVICE lpdiMouse;
extern HWND hwnd; // The display, which must have been created
jfieldID fid_button;
jfieldID fid_dx;
jfieldID fid_dy;
jfieldID fid_dz;
/*
* Class: org_lwjgl_input_Mouse
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_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);
}
// Now cache the field IDs:
if (fid_button == NULL) {
fid_button = env->GetStaticFieldID(clazz, "button", "[Z");
}
if (fid_dx == NULL) {
fid_dx = env->GetStaticFieldID(clazz, "dx", "I");
}
if (fid_dy == NULL) {
fid_dy = env->GetStaticFieldID(clazz, "dy", "I");
}
if (fid_dz == NULL) {
fid_dz = env->GetStaticFieldID(clazz, "dz", "I");
}
}
/*
* Class: org_lwjgl_input_Mouse
* Method: nCreate
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nCreate
(JNIEnv * env, jclass clazz)
{
// Check to see if we're already initialized
if (lpdiMouse != NULL) {
printf("Mouse already created.\n");
return JNI_FALSE;
}
if (hwnd == NULL) {
printf("No window\n");
return JNI_FALSE;
}
// First get reference to directinput:
if (lpdi == NULL) {
HRESULT ret = DirectInputCreate((HINSTANCE)GetCurrentProcess(), DIRECTINPUT_VERSION, &lpdi, NULL);
if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) {
printf("Failed to create directinput\n");
return JNI_FALSE;
}
}
// Get mouse device
if (lpdi->CreateDevice(GUID_SysMouse, &lpdiMouse, NULL) != DI_OK) {
printf("Failed to create mouse\n");
return JNI_FALSE;
}
// Grab non-exclusive foreground access to device
if (lpdiMouse->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) {
printf("Failed to set mouse coop\n");
return JNI_FALSE;
}
// Tell 'em wot format to be in (the default "you are a mouse and keyboard" format)
lpdiMouse->SetDataFormat(&c_dfDIMouse);
HRESULT ret = lpdiMouse->Acquire();
if (ret != DI_OK && ret != S_FALSE) {
#ifdef _DEBUG
printf("Failed to acquire mouse\n");
#endif
}
return JNI_TRUE;
}
/*
* Class: org_lwjgl_input_Mouse
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy
(JNIEnv * env, jclass clazz)
{
// Release mouse
if (lpdiMouse != NULL) {
lpdiMouse->Unacquire();
lpdiMouse->Release();
lpdiMouse = NULL;
}
// Release directinput
if (lpdi != NULL) {
// Release directinput
lpdi->Release();
lpdi = NULL;
}
}
/*
* Class: org_lwjgl_input_Mouse
* Method: nPoll
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll
(JNIEnv * env, jclass clazz)
{
DIMOUSESTATE diMouseState;
HRESULT ret;
while (ret = lpdiMouse->GetDeviceState(sizeof(diMouseState), &diMouseState) != DI_OK) {
ret = lpdiMouse->Acquire();
if (ret != DI_OK && ret != S_FALSE) {
#ifdef _DEBUG
printf("Failed to acquire mouse\n");
#endif
return;
}
}
if (ret == DI_OK) {
env->SetStaticIntField(clazz, fid_dx, (jint)diMouseState.lX);
env->SetStaticIntField(clazz, fid_dy, (jint)diMouseState.lY);
env->SetStaticIntField(clazz, fid_dz, (jint)diMouseState.lZ);
jbooleanArray buttonsArray = (jbooleanArray) env->GetStaticObjectField(clazz, fid_button);
BYTE * buttons = (BYTE *) env->GetPrimitiveArrayCritical(buttonsArray, NULL);
memcpy(buttons, diMouseState.rgbButtons, 4);
env->ReleasePrimitiveArrayCritical(buttonsArray, buttons, 0);
} else {
#ifdef _DEBUG
printf("Failed to get mouse device state\n");
#endif
}
}

View File

@ -0,0 +1,138 @@
/*
* org_lwjgl_opengl_BaseGL.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_opengl_BaseGL.h"
#include "extgl.h"
HGLRC hglrc = NULL; // OpenGL rendering context
extern HDC hdc;
extern HWND hwnd;
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nCreate
* Signature: (IIII)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate
(JNIEnv * env, jobject obj, jint colorBits, jint alphaBits, jint depthBits, jint stencilBits)
{
if (!hwnd) {
printf("No window handle\n");
return JNI_FALSE;
}
PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd
1, // version number
PFD_DRAW_TO_WINDOW | // support window
PFD_SUPPORT_OPENGL | // support OpenGL
PFD_GENERIC_ACCELERATED |
PFD_DOUBLEBUFFER, // double buffered
PFD_TYPE_RGBA, // RGBA type
(BYTE)colorBits,
0, 0, 0, 0, 0, 0, // color bits ignored
(BYTE)alphaBits,
0, // shift bit ignored
0, // no accumulation buffer
0, 0, 0, 0, // accum bits ignored
(BYTE)depthBits,
(BYTE)stencilBits,
0, // One auxiliary buffer
PFD_MAIN_PLANE, // main layer
0, // reserved
0, 0, 0 // layer masks ignored
};
// Ensure desktop color depth is adequate
int availableBitDepth = GetDeviceCaps(hdc, BITSPIXEL);
if (availableBitDepth < colorBits) {
printf("This application requires a greater colour depth.");
return JNI_FALSE;
};
int iPixelFormat;
// get the best available match of pixel format for the device context
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
if (iPixelFormat == 0) {
printf("Failed to choose pixel format.\n");
return JNI_FALSE;
}
#ifdef _DEBUG
printf("Pixel format is %d\n", iPixelFormat);
#endif
// make that the pixel format of the device context
if (SetPixelFormat(hdc, iPixelFormat, &pfd) == FALSE) {
printf("Failed to set pixel format\n");
return JNI_FALSE;
}
_wglSetDC(hdc);
if (!glInitialize()) {
printf("Failed to initialize GL\n");
return JNI_FALSE;
}
// Create a rendering context
hglrc = wglCreateContext(hdc);
if (hglrc == NULL) {
printf("Failed to create device context.\n");
return JNI_FALSE;
}
// Automatically make it the current context
Java_org_lwjgl_opengl_BaseGL_nMakeCurrent(env, obj);
return JNI_TRUE;
}
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy
(JNIEnv * env, jobject obj)
{
wglMakeCurrent(NULL, NULL);
// Delete the rendering context
if (hglrc != NULL)
wglDeleteContext(hglrc);
}
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: swapBuffers
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers
(JNIEnv *, jobject)
{
wglSwapLayerBuffers(hdc, WGL_SWAP_MAIN_PLANE);
}
/*
* Class: org_lwjgl_opengl_BaseGL
* Method: nMakeCurrent
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nMakeCurrent
(JNIEnv * env, jobject obj)
{
wglMakeCurrent(hdc, hglrc);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
/*
* org_lwjgl_opengl_CoreGL12.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_opengl_CoreGL12.h"

View File

@ -0,0 +1,13 @@
/*
* org_lwjgl_opengl_CoreGL13.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_opengl_CoreGL13.h"

View File

@ -0,0 +1,13 @@
/*
* org_lwjgl_opengl_CoreGL14.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_opengl_CoreGL14.h"

View File

@ -0,0 +1,13 @@
/*
* org_lwjgl_opengl_GL.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_opengl_GL.h"

View File

@ -0,0 +1,13 @@
/*
* org_lwjgl_opengl_GLU.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_opengl_GLU.h"

View File

@ -0,0 +1,13 @@
/*
* org_lwjgl_opengl_GLUT.cpp
*
* Win32 specific library
*
* (C) 2002 Shaven Puppy Ltd
*
* Created 10 August 2002 by foo
*
*/
#include <windows.h>
#include "org_lwjgl_opengl_GLUT.h"