You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(1) |
|
2
(6) |
3
(8) |
4
(1) |
5
|
6
(6) |
7
(3) |
8
(2) |
|
9
|
10
|
11
|
12
|
13
(4) |
14
|
15
|
|
16
(12) |
17
(4) |
18
(1) |
19
(8) |
20
|
21
(12) |
22
(4) |
|
23
(4) |
24
(14) |
25
|
26
|
27
(20) |
28
(31) |
29
(3) |
|
30
(13) |
31
(1) |
|
|
|
|
|
|
From: Elias N. <eli...@us...> - 2003-03-31 10:57:21
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv6811/src/native/linux Modified Files: org_lwjgl_Window.cpp Log Message: Minor linux fix Index: org_lwjgl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Window.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Window.cpp 30 Mar 2003 19:26:39 -0000 1.1 +++ org_lwjgl_Window.cpp 31 Mar 2003 10:56:41 -0000 1.2 @@ -103,6 +103,7 @@ break; case UnmapNotify: env->SetBooleanField(window_obj, env->GetFieldID(env->GetObjectClass(window_obj), "minimized", "Z"), JNI_TRUE); + break; case Expose: env->SetBooleanField(window_obj, env->GetFieldID(env->GetObjectClass(window_obj), "dirty", "Z"), JNI_TRUE); break; |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:53:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv507/src/native/win32 Modified Files: org_lwjgl_Window.cpp Log Message: Minor win32 fix Index: org_lwjgl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_Window.cpp 30 Mar 2003 19:26:39 -0000 1.6 +++ org_lwjgl_Window.cpp 30 Mar 2003 19:53:39 -0000 1.7 @@ -386,6 +386,8 @@ TranslateMessage(&msg); DispatchMessage(&msg); }; + environment = NULL; + window = NULL; } /* |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:40:38
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv25128/src/native/win32 Modified Files: org_lwjgl_opengl_BaseGL.cpp Log Message: I like those makeContextCurrent/releaseContext... Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- org_lwjgl_opengl_BaseGL.cpp 30 Mar 2003 19:26:39 -0000 1.18 +++ org_lwjgl_opengl_BaseGL.cpp 30 Mar 2003 19:40:35 -0000 1.19 @@ -218,4 +218,25 @@ { SwapBuffers(wglGetCurrentDC()); } - + +/* + * Class: org_lwjgl_opengl_BaseGL + * Method: nMakeCurrent + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_makeContextCurrent + (JNIEnv * env, jobject obj) +{ + wglMakeCurrent(hdc, hglrc); +} + +/* + * * Class: org_lwjgl_opengl_BaseGL + * * Method: nFreeContext + * * Signature: ()V + * */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_releaseContext + (JNIEnv *, jobject) +{ + wglMakeCurrent(NULL, NULL); +} |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:40:38
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv25128/src/native/linux Modified Files: org_lwjgl_opengl_BaseGL.cpp Log Message: I like those makeContextCurrent/releaseContext... Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- org_lwjgl_opengl_BaseGL.cpp 30 Mar 2003 19:26:39 -0000 1.13 +++ org_lwjgl_opengl_BaseGL.cpp 30 Mar 2003 19:40:35 -0000 1.14 @@ -190,7 +190,7 @@ * Method: nMakeCurrent * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nMakeCurrent +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_makeContextCurrent (JNIEnv * env, jobject obj) { makeCurrent(); @@ -201,7 +201,7 @@ * Method: nFreeContext * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nReleaseContext +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_releaseContext (JNIEnv *, jobject) { releaseContext(); |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:40:37
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv25128/src/native/common Modified Files: org_lwjgl_opengl_BaseGL.h Log Message: I like those makeContextCurrent/releaseContext... Index: org_lwjgl_opengl_BaseGL.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_BaseGL.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_BaseGL.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_opengl_BaseGL.h 30 Mar 2003 19:26:38 -0000 1.7 +++ org_lwjgl_opengl_BaseGL.h 30 Mar 2003 19:40:35 -0000 1.8 @@ -32,6 +32,22 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroyGL (JNIEnv *, jobject); +/* + * Class: org_lwjgl_opengl_BaseGL + * Method: makeContextCurrent + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_makeContextCurrent + (JNIEnv *, jobject); + +/* + * Class: org_lwjgl_opengl_BaseGL + * Method: releaseContext + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_releaseContext + (JNIEnv *, jobject); + #ifdef __cplusplus } #endif |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:40:37
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv25128/src/java/org/lwjgl/opengl Modified Files: BaseGL.java Log Message: I like those makeContextCurrent/releaseContext... Index: BaseGL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- BaseGL.java 30 Mar 2003 19:26:38 -0000 1.15 +++ BaseGL.java 30 Mar 2003 19:40:35 -0000 1.16 @@ -170,4 +170,14 @@ */ private native void nDestroyGL(); + /** + * Make the GL context current to the current thread + */ + public native void makeContextCurrent(); + + /** + * Release the GL context + */ + public native void releaseContext(); + } |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:26:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv14073/src/native/win32 Modified Files: org_lwjgl_Window.cpp org_lwjgl_opengl_BaseGL.cpp Log Message: Linux/win32 changes for 0.6 Index: org_lwjgl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_Window.cpp 29 Mar 2003 21:52:14 -0000 1.5 +++ org_lwjgl_Window.cpp 30 Mar 2003 19:26:39 -0000 1.6 @@ -178,15 +178,15 @@ case SC_MONITORPOWER: return 0L; case SC_MINIMIZE: - environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), true); + environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_TRUE); appActivate(true); break; case SC_RESTORE: - environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), false); + environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_FALSE); appActivate(false); break; case SC_CLOSE: - environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "closeRequested", "Z"), true); + environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "closeRequested", "Z"), JNI_TRUE); //don't continue processing this command since this //would shutdown the window, which the application might not want to return 0L; @@ -198,11 +198,11 @@ switch(LOWORD(wParam)) { case WA_ACTIVE: case WA_CLICKACTIVE: - environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), false); + environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_FALSE); isMinimized = false; break; case WA_INACTIVE: - environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), true); + environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_TRUE); isMinimized = true; break; } @@ -211,12 +211,12 @@ break; case WM_QUIT: { - environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "closeRequested", "Z"), true); + environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "closeRequested", "Z"), JNI_TRUE); return 0L; } case WM_PAINT: { - environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "dirty", "Z"), true); + environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "dirty", "Z"), JNI_TRUE); } } @@ -353,40 +353,11 @@ * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_Window_nSetTitle - (JNIEnv * env, jobject obj) + (JNIEnv * env, jobject obj, jstring title_obj) { - const char * title = env->GetStringUTFChars((jstring) obj, NULL); + const char * title = env->GetStringUTFChars(title_obj, NULL); SetWindowText(hwnd, title); - env->ReleaseStringUTFChars((jstring) obj, title); -} - -/* - * Class: org_lwjgl_Window - * Method: swapBuffers - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Window_swapBuffers - (JNIEnv * env, jobject obj) -{ - SwapBuffers(hdc); -} - -/* - * Class: org_lwjgl_Window - * Method: nDestroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Window_nDestroy - (JNIEnv * env, jobject obj) -{ - // Cache env and obj - environment = env; - window = obj; - - closeWindow(); - - environment = NULL; - window = NULL; + env->ReleaseStringUTFChars(title_obj, title); } /* @@ -426,4 +397,4 @@ (JNIEnv * env, jobject obj) { handleMessages(env, obj); -} \ No newline at end of file +} Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- org_lwjgl_opengl_BaseGL.cpp 28 Mar 2003 23:16:13 -0000 1.17 +++ org_lwjgl_opengl_BaseGL.cpp 30 Mar 2003 19:26:39 -0000 1.18 @@ -204,6 +204,18 @@ wglDeleteContext(hglrc); hglrc = NULL; } - + closeWindow(); extgl_Close(); } + +/* + * Class: org_lwjgl_opengl_BaseGL + * Method: swapBuffers + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers + (JNIEnv *, jobject) +{ + SwapBuffers(wglGetCurrentDC()); +} + |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:26:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv14073/src/native/linux Modified Files: Makefile.am org_lwjgl_Display.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_BaseGL.cpp Added Files: Window.h org_lwjgl_Window.cpp Log Message: Linux/win32 changes for 0.6 --- NEW FILE: Window.h --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/Window.h /* * 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: Window.h,v 1.1 2003/03/30 19:26:39 elias_naur Exp $ * * Include file to access public window features * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #ifndef _LWJGL_WINDOW_H_INCLUDED_ #define _LWJGL_WINDOW_H_INCLUDED_ #include <jni.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> /* * release input (keyboard, mouse) */ extern bool releaseInput(void); /* * Various functions to release/acquire keyboard and mouse */ extern void handlePointerMotion(XMotionEvent *); extern void handleButtonPress(XButtonEvent *); extern void handleButtonRelease(XButtonEvent *); extern void handleKeyEvent(XKeyEvent *); extern void releaseKeyboard(void); extern void releasePointer(void); extern void acquireKeyboard(void); extern void acquirePointer(void); /* * destroy the window */ extern void destroyWindow(void); /* * create a new X window with the specified visual */ extern void createWindow(JNIEnv *env, Display *disp, int screen, XVisualInfo *vis_info, jstring title, int x, int y, int width, int height, bool fullscreen); /* * get the current window width */ extern int getWindowWidth(void); /* * get the current window height */ extern int getWindowHeight(void); /* * get the current display */ extern Display *getCurrentDisplay(void); /* * get the current screen */ extern int getCurrentScreen(void); /* * get the current window */ extern Window getCurrentWindow(void); /* * Utility function to throw an Exception */ extern void throwException(JNIEnv * env, const char * err); /* * Utility function to throw a RuntimeException */ extern void throwRuntimeException(JNIEnv * env, const char * err); #endif /* _LWJGL_WINDOW_H_INCLUDED_ */ --- NEW FILE: org_lwjgl_Window.cpp --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Window.cpp /* * 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: org_lwjgl_Window.cpp,v 1.1 2003/03/30 19:26:39 elias_naur Exp $ * * Linux specific window functions. * * @author elias_naur <eli...@us...> * @version $Revision: 1.1 $ */ #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <jni.h> #include <Window.h> #include "org_lwjgl_Window.h" static Atom delete_atom; static Display *current_disp; static Window current_win; static int current_screen; static bool current_fullscreen; static int current_height; static int current_width; static bool input_released; static void waitMapped(Display *disp, Window win) { XEvent event; do { XMaskEvent(disp, StructureNotifyMask, &event); } while ((event.type != MapNotify) || (event.xmap.event != win)); } bool releaseInput(void) { if (current_fullscreen) return false; releaseKeyboard(); releasePointer(); input_released = true; return true; } static void acquireInput(void) { if (input_released) { acquireKeyboard(); acquirePointer(); input_released = false; } } static void handleMessages(JNIEnv *env, jobject window_obj) { XEvent event; while (XPending(current_disp) > 0) { XNextEvent(current_disp, &event); switch (event.type) { case ClientMessage: if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == delete_atom)) env->SetBooleanField(window_obj, env->GetFieldID(env->GetObjectClass(window_obj), "closeRequested", "Z"), JNI_TRUE); break; case FocusIn: acquireInput(); break; case MapNotify: env->SetBooleanField(window_obj, env->GetFieldID(env->GetObjectClass(window_obj), "dirty", "Z"), JNI_TRUE); env->SetBooleanField(window_obj, env->GetFieldID(env->GetObjectClass(window_obj), "minimized", "Z"), JNI_FALSE); break; case UnmapNotify: env->SetBooleanField(window_obj, env->GetFieldID(env->GetObjectClass(window_obj), "minimized", "Z"), JNI_TRUE); case Expose: env->SetBooleanField(window_obj, env->GetFieldID(env->GetObjectClass(window_obj), "dirty", "Z"), JNI_TRUE); break; case ButtonPress: handleButtonPress(&(event.xbutton)); break; case ButtonRelease: handleButtonRelease(&(event.xbutton)); break; case MotionNotify: handlePointerMotion(&(event.xmotion)); break; case KeyPress: case KeyRelease: handleKeyEvent(&(event.xkey)); break; } } } static void setWindowTitle(const char *title) { XStoreName(current_disp, current_win, title); } JNIEXPORT void JNICALL Java_org_lwjgl_Window_nSetTitle (JNIEnv * env, jobject obj, jstring title_obj) { const char * title = env->GetStringUTFChars(title_obj, NULL); setWindowTitle(title); env->ReleaseStringUTFChars(title_obj, title); } void createWindow(JNIEnv* env, Display *disp, int screen, XVisualInfo *vis_info, jstring title, int x, int y, int width, int height, bool fullscreen) { Window root_win; Window win; XSetWindowAttributes attribs; Colormap cmap; int attribmask; current_disp = disp; current_screen = screen; input_released = false; current_fullscreen = fullscreen; current_width = width; current_height = height; root_win = RootWindow(disp, screen); cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone); attribs.colormap = cmap; attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask| StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; attribs.background_pixel = 0xFF000000; attribmask = CWColormap | CWBackPixel | CWEventMask; if (fullscreen) { attribmask |= CWOverrideRedirect; attribs.override_redirect = True; } win = XCreateWindow(disp, root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); XFreeColormap(disp, cmap); #ifdef _DEBUG printf("Created window\n"); #endif current_win = win; Java_org_lwjgl_Window_nSetTitle(env, NULL, title); XSizeHints * size_hints = XAllocSizeHints(); size_hints->flags = PMinSize | PMaxSize; size_hints->min_width = width; size_hints->max_width = width; size_hints->min_height = height; size_hints->max_height = height; XSetWMNormalHints(disp, win, size_hints); XFree(size_hints); delete_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False); XSetWMProtocols(disp, win, &delete_atom, 1); XMapRaised(disp, win); waitMapped(disp, win); XClearWindow(disp, win); XSync(disp, True); } void destroyWindow() { XDestroyWindow(current_disp, current_win); current_disp = NULL; } Display *getCurrentDisplay(void) { return current_disp; } int getCurrentScreen(void) { return current_screen; } Window getCurrentWindow(void) { return current_win; } int getWindowWidth(void) { return current_width; } int getWindowHeight(void) { return current_height; } /* * Class: org_lwjgl_Window * Method: tick * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_Window_tick (JNIEnv *env, jobject obj) { handleMessages(env, obj); } /* * Utility function to throw an Exception */ void throwException(JNIEnv * env, const char * err) { jclass cls = env->FindClass("java/lang/Exception"); env->ThrowNew(cls, err); env->DeleteLocalRef(cls); } /* * Utility function to throw a RuntimeException */ void throwRuntimeException(JNIEnv * env, const char * err) { jclass cls = env->FindClass("java/lang/RuntimeException"); env->ThrowNew(cls, err); env->DeleteLocalRef(cls); } Index: Makefile.am CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/Makefile.am =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 11 Jan 2003 21:03:22 -0000 1.2 +++ Makefile.am 30 Mar 2003 19:26:39 -0000 1.3 @@ -9,6 +9,7 @@ org_lwjgl_input_Controller.cpp \ org_lwjgl_input_Keyboard.cpp \ org_lwjgl_input_Mouse.cpp \ - org_lwjgl_opengl_BaseGL.cpp + org_lwjgl_opengl_BaseGL.cpp \ + org_lwjgl_Window.cpp Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- org_lwjgl_Display.cpp 27 Mar 2003 18:27:35 -0000 1.31 +++ org_lwjgl_Display.cpp 30 Mar 2003 19:26:39 -0000 1.32 @@ -51,155 +51,8 @@ #include <jni.h> #include "org_lwjgl_Display.h" -Display * disp; -int screen; -Window win; - -static jfieldID fid_close; -static bool current_fullscreen; -static bool current_minimized; -static bool input_released; -static int win_width; -static int win_height; -static XF86VidModeModeInfo **avail_modes; -static XVisualInfo * vis_info; -static Atom delete_atom; -static jclass saved_clazz; - -extern void handlePointerMotion(XMotionEvent *); -extern void handleButtonPress(XButtonEvent *); -extern void handleButtonRelease(XButtonEvent *); -extern void handleKeyEvent(XKeyEvent *); -extern void releaseKeyboard(void); -extern void releasePointer(void); -extern void acquireKeyboard(void); -extern void acquirePointer(void); - -struct pixelformat { - int bpp; - int depth; - int alpha; - int stencil; -}; - -static XVisualInfo *chooseVisual(Display *disp, int screen, int bpp, int depth, int alpha, int stencil) { - int bpe; - switch (bpp) { - case 32: - case 24: - bpe = 8; - break; - case 16: - bpe = 4; - break; - default: - return JNI_FALSE; - } - - int attriblist[] = { GLX_RGBA, - GLX_DOUBLEBUFFER, - GLX_DEPTH_SIZE, depth, - GLX_RED_SIZE, bpe, - GLX_GREEN_SIZE, bpe, - GLX_BLUE_SIZE, bpe, - GLX_ALPHA_SIZE, alpha, - GLX_STENCIL_SIZE, stencil, - None }; - return glXChooseVisual(disp, screen, attriblist); -} - -static void dumpVisualInfo(Display *disp, XVisualInfo *vis_info) { - int alpha, depth, stencil, r, g, b; - glXGetConfig(disp, vis_info, GLX_RED_SIZE, &r); - glXGetConfig(disp, vis_info, GLX_GREEN_SIZE, &g); - glXGetConfig(disp, vis_info, GLX_BLUE_SIZE, &b); - glXGetConfig(disp, vis_info, GLX_ALPHA_SIZE, &alpha); - glXGetConfig(disp, vis_info, GLX_DEPTH_SIZE, &depth); - glXGetConfig(disp, vis_info, GLX_STENCIL_SIZE, &stencil); - printf("Pixel format chosen sizes: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d\n", r, g, b, alpha, depth, stencil); -} - -static void waitMapped(Display *disp, Window win) { - XEvent event; - - do { - XMaskEvent(disp, StructureNotifyMask, &event); - } while ((event.type != MapNotify) || (event.xmap.event != win)); -} - -static void setRepeatMode(int mode) { - XKeyboardControl repeat_mode; - repeat_mode.auto_repeat_mode = mode; - XChangeKeyboardControl(disp, KBAutoRepeatMode, &repeat_mode); -} - -bool releaseInput(void) { - if (current_fullscreen) - return false; - releaseKeyboard(); - releasePointer(); - input_released = true; - setRepeatMode(AutoRepeatModeDefault); - return true; -} - -static void acquireInput(void) { - if (input_released) { - setRepeatMode(AutoRepeatModeOff); - acquireKeyboard(); - acquirePointer(); - input_released = false; - } -} - -void handleMessages(JNIEnv *env) { - XEvent event; - while (XPending(disp) > 0) { - XNextEvent(disp, &event); - switch (event.type) { - case ClientMessage: - if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == delete_atom)) - env->SetStaticBooleanField(saved_clazz, fid_close, JNI_TRUE); - break; - case FocusIn: - acquireInput(); - break; - case MapNotify: - current_minimized = false; - break; - case UnmapNotify: - current_minimized = true; - break; - case ButtonPress: - handleButtonPress(&(event.xbutton)); - break; - case ButtonRelease: - handleButtonRelease(&(event.xbutton)); - break; - case MotionNotify: - handlePointerMotion(&(event.xmotion)); - break; - case KeyPress: - case KeyRelease: - handleKeyEvent(&(event.xkey)); - break; - } - } -} - -static bool loadGL(Display *disp, int screen) { - if (extgl_Open(disp, screen) != 0) { -#ifdef _DEBUG - printf("Could not load gl libs\n"); -#endif - return false; - } - return true; -} - -static void closeGL(void) { - extgl_Close(); -} +static int saved_width; +static int saved_height; static int getDisplayModes(Display *disp, int screen, int *num_modes, XF86VidModeModeInfo ***avail_modes) { int event_base, error_base, xvid_ver, xvid_rev; @@ -218,170 +71,101 @@ return 1; } -static bool isMinimized(JNIEnv *env, jclass clazz) { - handleMessages(env); - return current_minimized; -} - -int getWindowHeight(void) { - return win_height; -} - -int getWindowWidth(void) { - return win_width; -} - -XVisualInfo *getVisualInfo(void) { - return vis_info; -} - -/* - * Class: org_lwjgl_Display - * Method: isMinimized - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_isMinimized(JNIEnv *env, jclass clazz) { - return isMinimized(env, clazz) ? JNI_TRUE : JNI_FALSE; -} - -JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_nCreate(JNIEnv * env, jclass clazz, jint width, jint height, jint bpp, jint freq, jint alpha_bits, jint depth_bits, jint stencil_bits, jboolean fullscreen, jstring title) { - // Get a global class instance, just to be sure - static jobject globalClassLock = NULL; - - if (globalClassLock == NULL) { - globalClassLock = env->NewGlobalRef(clazz); - } - - saved_clazz = clazz; - - fid_close = env->GetStaticFieldID(clazz, "closeRequested", "Z"); - - Window root_win; - XSetWindowAttributes attribs; - Colormap cmap; - int attribmask; +static bool setMode(int width, int height, bool lock_mode) { int num_modes, i; + XF86VidModeModeInfo **avail_modes; + int screen; + Display *disp = XOpenDisplay(NULL); - win_width = width; - win_height = height; - if (fullscreen == JNI_TRUE) - current_fullscreen = true; - else - current_fullscreen = false; - current_minimized = false; - input_released = false; - disp = XOpenDisplay(NULL); if (disp == NULL) { #ifdef _DEBUG printf("Could not open X connection\n"); #endif - return JNI_FALSE; + return false; } screen = DefaultScreen(disp); - if (!loadGL(disp, screen)) { - XCloseDisplay(disp); -#ifdef _DEBUG - printf("Could not load GL libs\n"); -#endif - return JNI_FALSE; - } if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { XCloseDisplay(disp); #ifdef _DEBUG printf("Could not get display modes\n"); #endif - return JNI_FALSE; - } - root_win = RootWindow(disp, screen); - vis_info = chooseVisual(disp, screen, bpp, depth_bits, alpha_bits, stencil_bits); - if (vis_info == NULL) { - XCloseDisplay(disp); -#ifdef _DEBUG - printf("Could not choose glx visual\n"); -#endif - return JNI_FALSE; - } -#ifdef _DEBUG - dumpVisualInfo(disp, vis_info); -#endif - cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone); - attribs.colormap = cmap; - attribs.event_mask = FocusChangeMask | VisibilityChangeMask| StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; - attribs.background_pixel = 0xFF000000; - attribmask = CWColormap | CWBackPixel | CWEventMask; - if (fullscreen) { - attribmask |= CWOverrideRedirect; - attribs.override_redirect = True; + return false; } - win = XCreateWindow(disp, root_win, 0, 0, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); - XFreeColormap(disp, cmap); -#ifdef _DEBUG - printf("Created window\n"); -#endif - const char * title_str = env->GetStringUTFChars(title, NULL); - XStoreName(disp, win, title_str); - env->ReleaseStringUTFChars(title, title_str); - XSizeHints * size_hints = XAllocSizeHints(); - size_hints->flags = PMinSize | PMaxSize; - size_hints->min_width = width; - size_hints->max_width = width; - size_hints->min_height = height; - size_hints->max_height = height; - XSetWMNormalHints(disp, win, size_hints); - XFree(size_hints); - delete_atom = XInternAtom(disp, "WM_DELETE_WINDOW", False); - XSetWMProtocols(disp, win, &delete_atom, 1); - XMapRaised(disp, win); - waitMapped(disp, win); - if (fullscreen) { - for ( i = 0; i < num_modes; ++i ) { + XF86VidModeLockModeSwitch(disp, screen, 0); + for ( i = 0; i < num_modes; ++i ) { #ifdef _DEBUG - printf("Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); + printf("Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); #endif - if (avail_modes[i]->hdisplay == width && avail_modes[i]->vdisplay == height) { - if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[i])) { - XFree(vis_info); - XFree(avail_modes); - XDestroyWindow(disp, win); - XCloseDisplay(disp); + if (avail_modes[i]->hdisplay == width && avail_modes[i]->vdisplay == height) { + if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[i])) { #ifdef _DEBUG - printf("Could not switch mode\n"); + printf("Could not switch mode\n"); #endif - return JNI_FALSE; - } - XF86VidModeLockModeSwitch(disp, screen, 1); break; } +// XF86VidModeSetViewPort(disp, screen, 0, 0); + if (lock_mode) + XF86VidModeLockModeSwitch(disp, screen, 1); + XFree(avail_modes); + XCloseDisplay(disp); + return true; } - XF86VidModeSetViewPort(disp, screen, 0, 0); } - XClearWindow(disp, win); - setRepeatMode(AutoRepeatModeOff); - XSync(disp, True); - return JNI_TRUE; + XFree(avail_modes); + XCloseDisplay(disp); + return false; } -JNIEXPORT void JNICALL Java_org_lwjgl_Display_nDestroy(JNIEnv * env, jclass clazz) { - setRepeatMode(AutoRepeatModeDefault); - XDestroyWindow(disp, win); - if (current_fullscreen) { - XF86VidModeLockModeSwitch(disp, screen, 0); - if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[0])) { +JNIEXPORT void JNICALL Java_org_lwjgl_Display_init + (JNIEnv * env, jclass clazz) +{ + int num_modes; + XF86VidModeModeInfo **avail_modes; + int screen; + Display *disp = XOpenDisplay(NULL); + if (disp == NULL) { #ifdef _DEBUG - printf("Could not switch mode\n"); + printf("Could not open X connection\n"); +#endif + return; + } + screen = DefaultScreen(disp); + + if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { +#ifdef _DEBUG + printf("Could not get display modes\n"); #endif - } } - XFree(avail_modes); - avail_modes = NULL; - XFree(vis_info); - vis_info = NULL; - XCloseDisplay(disp); - disp = NULL; - closeGL(); + saved_width = avail_modes[0]->hdisplay; + saved_height = avail_modes[0]->vdisplay; + int bpp = XDefaultDepth(disp, screen); #ifdef _DEBUG - printf("Closed X connection\n"); + printf("Saved width, height %d, %d\n", saved_width, saved_height); #endif + jclass jclass_DisplayMode = env->FindClass("org/lwjgl/DisplayMode"); + jmethodID ctor = env->GetMethodID(jclass_DisplayMode, "<init>", "(IIII)V"); + jobject newMode = env->NewObject(jclass_DisplayMode, ctor, saved_width, saved_height, bpp, 0); + jfieldID fid_initialMode = env->GetStaticFieldID(clazz, "mode", "Lorg/lwjgl/DisplayMode;"); + env->SetStaticObjectField(clazz, fid_initialMode, newMode); + + XFree(avail_modes); + XCloseDisplay(disp); +} + +JNIEXPORT void JNICALL Java_org_lwjgl_Display_setDisplayMode(JNIEnv * env, jclass clazz, jobject mode) { + jclass cls_displayMode = env->FindClass("org/lwjgl/DisplayMode"); + jfieldID fid_width = env->GetFieldID(cls_displayMode, "width", "I"); + jfieldID fid_height = env->GetFieldID(cls_displayMode, "height", "I"); + int width = env->GetIntField(mode, fid_width); + int height = env->GetIntField(mode, fid_height); + if (setMode(width, height, true)) { + jfieldID fid_initialMode = env->GetStaticFieldID(clazz, "mode", "Lorg/lwjgl/DisplayMode;"); + env->SetStaticObjectField(clazz, fid_initialMode, mode); + } +} + +JNIEXPORT void JNICALL Java_org_lwjgl_Display_resetDisplayMode(JNIEnv * env, jclass clazz) { + setMode(saved_width, saved_height, false); } /* @@ -393,7 +177,6 @@ (JNIEnv * env, jclass clazz) { int num_modes, i; - Display *disp = XOpenDisplay(NULL); int screen; XF86VidModeModeInfo **avail_modes; @@ -402,7 +185,6 @@ #ifdef _DEBUG printf("Could not open X connection\n"); #endif - XCloseDisplay(disp); return NULL; } Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- org_lwjgl_input_Keyboard.cpp 27 Mar 2003 15:16:35 -0000 1.19 +++ org_lwjgl_input_Keyboard.cpp 30 Mar 2003 19:26:39 -0000 1.20 @@ -44,6 +44,7 @@ #include <X11/Xutil.h> #include <string.h> #include <assert.h> +#include <Window.h> #include "org_lwjgl_input_Keyboard.h" #define KEYBOARD_BUFFER_SIZE 50 @@ -65,12 +66,6 @@ static bool created = false; static bool should_grab = false; -extern Display *disp; -extern Window win; - -extern bool releaseInput(void); -extern void handleMessages(JNIEnv *env); - /* * Class: org_lwjgl_input_Keyboard * Method: initIDs @@ -82,16 +77,25 @@ fid_readBuffer = env->GetStaticFieldID(clazz, "readBuffer", "Ljava/nio/ByteBuffer;"); } +static void setRepeatMode(int mode) { + XKeyboardControl repeat_mode; + repeat_mode.auto_repeat_mode = mode; + XChangeKeyboardControl(getCurrentDisplay(), KBAutoRepeatMode, &repeat_mode); +} + static int grabKeyboard(void) { - int result = XGrabKeyboard(disp, win, False, GrabModeAsync, GrabModeAsync, CurrentTime); - if (result == GrabSuccess) + int result = XGrabKeyboard(getCurrentDisplay(), getCurrentWindow(), False, GrabModeAsync, GrabModeAsync, CurrentTime); + if (result == GrabSuccess) { keyboard_grabbed = true; + setRepeatMode(AutoRepeatModeOff); + } return result; } static void ungrabKeyboard(void) { keyboard_grabbed = false; - XUngrabKeyboard(disp, CurrentTime); + XUngrabKeyboard(getCurrentDisplay(), CurrentTime); + setRepeatMode(AutoRepeatModeDefault); } void acquireKeyboard(void) { @@ -257,7 +261,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll (JNIEnv * env, jclass clazz, jint buf) { - handleMessages(env); updateGrab(); memcpy((unsigned char*)buf, key_buf, KEYBOARD_SIZE*sizeof(unsigned char)); } @@ -274,7 +277,6 @@ int buf_count = 0; int num_events = 0; - handleMessages(env); updateGrab(); while (buf_count < KEYBOARD_BUFFER_SIZE * 2 && (key_event = nextEventElement()) != NULL) { num_events++; Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- org_lwjgl_input_Mouse.cpp 24 Mar 2003 18:10:04 -0000 1.20 +++ org_lwjgl_input_Mouse.cpp 30 Mar 2003 19:26:39 -0000 1.21 @@ -45,6 +45,7 @@ #include <X11/extensions/xf86vmode.h> #include <assert.h> #include <string.h> +#include <Window.h> #include "org_lwjgl_input_Mouse.h" #define NUM_BUTTONS 3 @@ -54,13 +55,6 @@ // scale the mouse wheel according to win32 #define WHEEL_SCALE 120 -extern Display *disp; -extern Window win; -extern int screen; -extern int getWindowWidth(void); -extern int getWindowHeight(void); -extern void handleMessages(JNIEnv* env); - static bool pointer_grabbed; static bool created = false; static bool should_grab = false; @@ -106,30 +100,30 @@ static int blankCursor(void) { unsigned int best_width, best_height; - if (XQueryBestCursor(disp, win, 1, 1, &best_width, &best_height) == 0) { + if (XQueryBestCursor(getCurrentDisplay(), getCurrentWindow(), 1, 1, &best_width, &best_height) == 0) { #ifdef _DEBUG printf("Could not query best cursor size\n"); #endif return 0; } - Pixmap mask = XCreatePixmap(disp, win, best_width, best_height, 1); + Pixmap mask = XCreatePixmap(getCurrentDisplay(), getCurrentWindow(), best_width, best_height, 1); XGCValues gc_values; gc_values.foreground = 0; - GC gc = XCreateGC(disp, mask, GCForeground, &gc_values); - XFillRectangle(disp, mask, gc, 0, 0, best_width, best_height); - XFreeGC(disp, gc); + GC gc = XCreateGC(getCurrentDisplay(), mask, GCForeground, &gc_values); + XFillRectangle(getCurrentDisplay(), mask, gc, 0, 0, best_width, best_height); + XFreeGC(getCurrentDisplay(), gc); XColor dummy_color; - blank_cursor = XCreatePixmapCursor(disp, mask, mask, &dummy_color, &dummy_color, 0, 0); - XFreePixmap(disp, mask); + blank_cursor = XCreatePixmapCursor(getCurrentDisplay(), mask, mask, &dummy_color, &dummy_color, 0, 0); + XFreePixmap(getCurrentDisplay(), mask); return 1; } static int grabPointer(void) { int result; int mask = FocusChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask; - result = XGrabPointer(disp, win, False, mask, GrabModeAsync, GrabModeAsync, win, blank_cursor, CurrentTime); - XWarpPointer(disp, None, win, 0, 0, 0, 0, current_x, current_y); - XF86VidModeSetViewPort(disp, screen, 0, 0); // make sure we have a centered window + result = XGrabPointer(getCurrentDisplay(), getCurrentWindow(), False, mask, GrabModeAsync, GrabModeAsync, getCurrentWindow(), blank_cursor, CurrentTime); + XWarpPointer(getCurrentDisplay(), None, getCurrentWindow(), 0, 0, 0, 0, current_x, current_y); + XF86VidModeSetViewPort(getCurrentDisplay(), getCurrentScreen(), 0, 0); // make sure we have a centered window if (result == GrabSuccess) pointer_grabbed = true; return result; @@ -137,7 +131,7 @@ static void ungrabPointer(void) { pointer_grabbed = false; - XUngrabPointer(disp, CurrentTime); + XUngrabPointer(getCurrentDisplay(), CurrentTime); } void acquirePointer(void) { @@ -200,7 +194,7 @@ { if (pointer_grabbed) ungrabPointer(); - XFreeCursor(disp, blank_cursor); + XFreeCursor(getCurrentDisplay(), blank_cursor); created = false; should_grab = false; } @@ -258,11 +252,11 @@ current_x > getWindowWidth() - POINTER_WARP_BORDER || current_y > getWindowHeight() - POINTER_WARP_BORDER) { current_x = last_x = getWindowWidth()/2; current_y = last_y = getWindowHeight()/2; - XWarpPointer(disp, None, win, 0, 0, 0, 0, current_x, current_y); + XWarpPointer(getCurrentDisplay(), None, getCurrentWindow(), 0, 0, 0, 0, current_x, current_y); XEvent event; // Try to catch the warp pointer event for (i = 0; i < WARP_RETRY; i++) { - XMaskEvent(disp, PointerMotionMask, &event); + XMaskEvent(getCurrentDisplay(), PointerMotionMask, &event); if (event.xmotion.x > current_x - POINTER_WARP_BORDER && event.xmotion.x < current_x + POINTER_WARP_BORDER && event.xmotion.y > current_y - POINTER_WARP_BORDER && @@ -287,7 +281,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll (JNIEnv * env, jclass clazz) { - handleMessages(env); updateGrab(); int moved_x = current_x - last_x; int moved_y = current_y - last_y; Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_BaseGL.cpp 27 Mar 2003 18:28:05 -0000 1.12 +++ org_lwjgl_opengl_BaseGL.cpp 30 Mar 2003 19:26:39 -0000 1.13 @@ -40,21 +40,64 @@ */ #include "extgl.h" +#include "Window.h" #include "org_lwjgl_opengl_BaseGL.h" static GLXContext context = NULL; // OpenGL rendering context -extern XVisualInfo * getVisualInfo(void); -extern Window win; -extern Display * disp; - -extern void handleMessages(JNIEnv* env); static void makeCurrent(void) { - glXMakeCurrent(disp, win, context); + glXMakeCurrent(getCurrentDisplay(), getCurrentWindow(), context); } static void releaseContext(void) { - glXMakeCurrent(disp, None, NULL); + glXMakeCurrent(getCurrentDisplay(), None, NULL); +} + +static XVisualInfo *chooseVisual(Display *disp, int screen, int bpp, int depth, int alpha, int stencil) { + int bpe; + switch (bpp) { + case 32: + case 24: + bpe = 8; + break; + case 16: + bpe = 4; + break; + default: + return JNI_FALSE; + } + + int attriblist[] = { GLX_RGBA, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, depth, + GLX_RED_SIZE, bpe, + GLX_GREEN_SIZE, bpe, + GLX_BLUE_SIZE, bpe, + GLX_ALPHA_SIZE, alpha, + GLX_STENCIL_SIZE, stencil, + None }; + return glXChooseVisual(disp, screen, attriblist); +} + +static void dumpVisualInfo(Display *disp, XVisualInfo *vis_info) { + int alpha, depth, stencil, r, g, b; + glXGetConfig(disp, vis_info, GLX_RED_SIZE, &r); + glXGetConfig(disp, vis_info, GLX_GREEN_SIZE, &g); + glXGetConfig(disp, vis_info, GLX_BLUE_SIZE, &b); + glXGetConfig(disp, vis_info, GLX_ALPHA_SIZE, &alpha); + glXGetConfig(disp, vis_info, GLX_DEPTH_SIZE, &depth); + glXGetConfig(disp, vis_info, GLX_STENCIL_SIZE, &stencil); + printf("Pixel format chosen sizes: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d\n", r, g, b, alpha, depth, stencil); +} + +static void destroy(void) { + releaseContext(); + glXDestroyContext(getCurrentDisplay(), context); + context = NULL; + Display *disp = getCurrentDisplay(); + destroyWindow(); + XCloseDisplay(disp); + extgl_Close(); } /* @@ -62,41 +105,63 @@ * Method: nCreate * Signature: (IIII)Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate - (JNIEnv * env, jobject obj) +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate + (JNIEnv * env, jobject obj, jstring title, jint x, jint y, jint width, jint height, jint bpp, jint alpha, jint depth, jint stencil, jboolean fullscreen) { + int screen; + Display *disp; + XVisualInfo *vis_info; + bool fscreen = false; + if (fullscreen == JNI_TRUE) + fscreen = true; + + if (extgl_Open() != 0) { + throwException(env, "Could not load gl libs"); + return; + } + disp = XOpenDisplay(NULL); if (disp == NULL) { -#ifdef _DEBUG - printf("No display\n"); -#endif - return JNI_FALSE; + XCloseDisplay(disp); + throwException(env, "Could not open X display"); + return; } - if (getVisualInfo() == NULL) { -#ifdef _DEBUG - printf("No visual info\n"); -#endif - return JNI_FALSE; + screen = XDefaultScreen(disp); + if (extgl_InitGLX(disp, screen) != 0) { + XCloseDisplay(disp); + extgl_Close(); + throwException(env, "Could not init GLX"); + return; + } + vis_info = chooseVisual(disp, screen, bpp, depth, alpha, stencil); + if (vis_info == NULL) { + XCloseDisplay(disp); + extgl_Close(); + throwException(env, "Could not find a matching pixel format"); + return; } - context = glXCreateContext(disp, getVisualInfo(), NULL, True); - if (context == NULL) { #ifdef _DEBUG - printf("Could not create context\n"); + dumpVisualInfo(disp, vis_info); #endif - return JNI_FALSE; + context = glXCreateContext(disp, vis_info, NULL, True); + if (context == NULL) { + XFree(vis_info); + XCloseDisplay(disp); + extgl_Close(); + throwException(env, "Could not create a GLX context"); + return; } - + createWindow(env, disp, screen, vis_info, title, x, y, width, height, fscreen); + XFree(vis_info); makeCurrent(); if (extgl_Initialize() != 0) { -#ifdef _DEBUG - printf("Could not init gl function pointers\n"); -#endif - return JNI_FALSE; + destroy(); + throwException(env, "Could not init gl function pointers"); + return; } #ifdef _DEBUG const GLubyte * extensions = glGetString(GL_EXTENSIONS); printf("Supported extensions: %s\n", extensions); #endif - return JNI_TRUE; } /* @@ -104,12 +169,10 @@ * Method: nDestroy * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroy +JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nDestroyGL (JNIEnv * env, jobject obj) { - releaseContext(); - glXDestroyContext(disp, context); - context = NULL; + destroy(); } /* @@ -119,8 +182,7 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers(JNIEnv * env, jobject obj) { - handleMessages(env); - glXSwapBuffers(disp, win); + glXSwapBuffers(getCurrentDisplay(), getCurrentWindow()); } /* |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:26:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv14073/src/native/common Modified Files: extgl.c extgl.h org_lwjgl_Window.h org_lwjgl_opengl_BaseGL.h Log Message: Linux/win32 changes for 0.6 Index: extgl.c CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- extgl.c 27 Mar 2003 15:28:57 -0000 1.9 +++ extgl.c 30 Mar 2003 19:26:38 -0000 1.10 @@ -2498,7 +2498,6 @@ glXGetProcAddressARB = (glXGetProcAddressARBPROC) dlsym(lib_gl_handle, "glXGetProcAddressARB"); if (glXGetProcAddressARB == NULL) return 1; - if (extgl_InitGLX12() != 0) return 1; extgl_InitGLXSupportedExtensions(disp, screen); @@ -3235,19 +3234,17 @@ } #ifdef _X11 -int extgl_Open(Display *disp, int screen) +int extgl_Open() { lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_gl_handle == NULL) return 1; - lib_glu_handle = dlopen("libGLU.so", RTLD_LAZY | RTLD_GLOBAL); if (lib_glu_handle == NULL) return 1; - if (extgl_InitGLX(disp, screen) != 0) - return 1; return 0; } + #endif /* X11 */ #ifdef _WIN32 Index: extgl.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- extgl.h 2 Jan 2003 05:44:16 -0000 1.9 +++ extgl.h 30 Mar 2003 19:26:38 -0000 1.10 @@ -5861,7 +5861,8 @@ /* initializes everything, call this right after the rc is created. the function returns 0 if successful */ int extgl_Initialize(); #ifdef _X11 -int extgl_Open(Display *disp, int screen); +int extgl_Open(void); +int extgl_InitGLX(Display *disp, int screen); #endif #ifdef _WIN32 Index: org_lwjgl_Window.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Window.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- org_lwjgl_Window.h 28 Mar 2003 01:28:04 -0000 1.1 +++ org_lwjgl_Window.h 30 Mar 2003 19:26:38 -0000 1.2 @@ -1,46 +1,30 @@ /* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> +#include <jni.h> /* Header for class org_lwjgl_Window */ #ifndef _Included_org_lwjgl_Window -#define _Included_org_lwjgl_Window +#define _Included_org_lwjgl_Window #ifdef __cplusplus extern "C" { -#endif -/* Inaccessible static: currentWindow */ -/* - * Class: org_lwjgl_Window - * Method: nSetTitle - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Window_nSetTitle - (JNIEnv *, jobject); - -/* - * Class: org_lwjgl_Window - * Method: swapBuffers - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Window_swapBuffers - (JNIEnv *, jobject); - -/* - * Class: org_lwjgl_Window - * Method: nDestroy - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Window_nDestroy - (JNIEnv *, jobject); - -/* - * Class: org_lwjgl_Window - * Method: tick - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Window_tick +#endif +/* Inaccessible static: currentWindow */ +/* + * Class: org_lwjgl_Window + * Method: nSetTitle + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_Window_nSetTitle + (JNIEnv *, jobject, jstring); + +/* + * Class: org_lwjgl_Window + * Method: tick + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_Window_tick (JNIEnv *, jobject); - + #ifdef __cplusplus } -#endif -#endif +#endif +#endif Index: org_lwjgl_opengl_BaseGL.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_BaseGL.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_opengl_BaseGL.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_opengl_BaseGL.h 28 Mar 2003 21:04:32 -0000 1.6 +++ org_lwjgl_opengl_BaseGL.h 30 Mar 2003 19:26:38 -0000 1.7 @@ -10,6 +10,14 @@ /* Inaccessible static: currentWindow */ /* * 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: nCreate * Signature: (Ljava/lang/String;IIIIIIIIZ)V */ |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:26:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1:/tmp/cvs-serv14073/src/native Modified Files: config.h.in configure.in Log Message: Linux/win32 changes for 0.6 Index: config.h.in CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/config.h.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/config.h.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- config.h.in 27 Mar 2003 15:16:33 -0000 1.3 +++ config.h.in 30 Mar 2003 19:26:38 -0000 1.4 @@ -6,6 +6,9 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have the `pthread' library (-lpthread). */ +#undef HAVE_LIBPTHREAD + /* Define to 1 if you have the `X11' library (-lX11). */ #undef HAVE_LIBX11 Index: configure.in CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/configure.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/configure.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- configure.in 27 Mar 2003 15:16:34 -0000 1.10 +++ configure.in 30 Mar 2003 19:26:38 -0000 1.11 @@ -51,8 +51,8 @@ else AC_MSG_RESULT($JAVA_HOME) JAVA_HOME="$JAVA_HOME" - CPPFLAGS="$CPPFLAGS -D_DEBUG -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" - CFLAGS="$CFLAGS -D_DEBUG -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" + CPPFLAGS="$CPPFLAGS -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" + CFLAGS="$CFLAGS -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" fi dnl Checks for libraries. @@ -64,6 +64,8 @@ AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required)) dnl Replace `main' with a function in -lXxf86vm: AC_CHECK_LIB(Xxf86vm, main,, AC_MSG_ERROR(Xxf86vm is required)) +dnl Replace `main' with a function in -tpthread: +AC_CHECK_LIB(pthread, main,, AC_MSG_ERROR(pthread is required)) dnl Checks for header files. |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:26:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv14073/src/java/org/lwjgl/opengl Modified Files: BaseGL.java Log Message: Linux/win32 changes for 0.6 Index: BaseGL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- BaseGL.java 28 Mar 2003 21:03:30 -0000 1.14 +++ BaseGL.java 30 Mar 2003 19:26:38 -0000 1.15 @@ -133,6 +133,15 @@ protected void doCreate() throws Exception { nCreate(getTitle(), x, y, getWidth(), getHeight(), color, alpha, depth, stencil, fullscreen); } + + protected void doPaint() { + swapBuffers(); + } + + /** + * Swap the buffers. + */ + private native void swapBuffers(); /** * Native method to create a windowed GL |
|
From: Elias N. <eli...@us...> - 2003-03-30 19:26:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv14073/src/java/org/lwjgl Modified Files: Window.java Log Message: Linux/win32 changes for 0.6 Index: Window.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Window.java 28 Mar 2003 23:15:53 -0000 1.6 +++ Window.java 30 Mar 2003 19:26:38 -0000 1.7 @@ -114,14 +114,14 @@ */ public final void setTitle(String newTitle) { title = newTitle; - nSetTitle(); + nSetTitle(title); } /** * Native implementation of setTitle(). This will read the window's title member * and stash it in the native title of the window. */ - private native void nSetTitle(); + private native void nSetTitle(String title); /** * @return true if the user or operating system has asked the window to close @@ -156,13 +156,10 @@ */ public final void paint() { dirty = false; - swapBuffers(); + doPaint(); } - - /** - * Swap the buffers. - */ - private native void swapBuffers(); + + protected abstract void doPaint(); /** * Create the window. @@ -188,7 +185,6 @@ if (!created) return; doDestroy(); - nDestroy(); currentWindow = null; created = false; } @@ -198,10 +194,6 @@ */ protected abstract void doDestroy(); - /** - * Natively destroy the window - */ - private native void nDestroy(); /** * @return the native window handle |
|
From: Brian M. <ma...@us...> - 2003-03-30 13:31:18
|
Update of /cvsroot/java-game-lib/LWJGL/website/documents/tutorials In directory sc8-pr-cvs1:/tmp/cvs-serv10992 Modified Files: intro.html Log Message: fix: remove platform specific wording Index: intro.html CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/website/documents/tutorials/intro.html =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/website/documents/tutorials/intro.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- intro.html 20 Dec 2002 21:23:31 -0000 1.1 +++ intro.html 30 Mar 2003 13:31:15 -0000 1.2 @@ -28,8 +28,7 @@ <p>The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. This tutorial is nonetheless aimed at <i>experienced -</i>programmers and won't be explaining some obvious techniques. Currently the -LWJGL supports only the Win32 platform, and JDK1.4. </p> +</i>programmers and won't be explaining some obvious techniques.</p> <p>LWJGL is not meant to make writing games particularly <i>easy;</i> it is primarily an <i>enabling technology </i>which allows developers to get at resources that are simply otherwise unavailable or poorly implemented on the @@ -56,11 +55,6 @@ by compilers such as GNU's GCJ and Excelsior's JET. We have done this by implementing the library in such a way that <i>no dependencies </i>on Sun's proprietry JRE binaries are present in the library.</p> -<p>The final aim of LWJGL is to make the library available for Win32 systems -above all others, for that is what most commercial programmers need.</p> -<p>Linuxians and Macophiles do not despair! There's nothing inherently -non-portable about the LWJGL - we just don't have the time and expertise to do -it yet. But it will happen.</p> <p>3.1 General API</p> <p>The general API gives us the foundations of game programming: we have a Display class, for initialising the display and querying its available modes; we @@ -111,7 +105,7 @@ <p>3.3 Sounds</p> <p>Sound is based on the latest OpenAL1.0 specification, which comes with but one extension, EAX, for interesting environmental effects. The LWJGL binary -distribution includes the OpenAL .dlls for Win32.</p> +distribution includes the OpenAL libraries.</p> <p>3.4 Input</p> <p>Input can be a complicated topic. A user can have all sorts of strange fancy force-feedback hardware installed on their systems, with scrolly knobs and |
|
From: Brian M. <ma...@us...> - 2003-03-30 13:30:31
|
Update of /cvsroot/java-game-lib/LWJGL/doc/tutorial In directory sc8-pr-cvs1:/tmp/cvs-serv10630 Modified Files: intro.html Log Message: fix: remove platform specific wording Index: intro.html CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/tutorial/intro.html =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/doc/tutorial/intro.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- intro.html 5 Sep 2002 15:43:33 -0000 1.1 +++ intro.html 30 Mar 2003 13:30:28 -0000 1.2 @@ -28,8 +28,7 @@ <p>The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. This tutorial is nonetheless aimed at <i>experienced -</i>programmers and won't be explaining some obvious techniques. Currently the -LWJGL supports only the Win32 platform, and JDK1.4. </p> +</i>programmers and won't be explaining some obvious techniques.</p> <p>LWJGL is not meant to make writing games particularly <i>easy;</i> it is primarily an <i>enabling technology </i>which allows developers to get at resources that are simply otherwise unavailable or poorly implemented on the @@ -56,11 +55,6 @@ by compilers such as GNU's GCJ and Excelsior's JET. We have done this by implementing the library in such a way that <i>no dependencies </i>on Sun's proprietry JRE binaries are present in the library.</p> -<p>The final aim of LWJGL is to make the library available for Win32 systems -above all others, for that is what most commercial programmers need.</p> -<p>Linuxians and Macophiles do not despair! There's nothing inherently -non-portable about the LWJGL - we just don't have the time and expertise to do -it yet. But it will happen.</p> <p>3.1 General API</p> <p>The general API gives us the foundations of game programming: we have a Display class, for initialising the display and querying its available modes; we @@ -111,7 +105,7 @@ <p>3.3 Sounds</p> <p>Sound is based on the latest OpenAL1.0 specification, which comes with but one extension, EAX, for interesting environmental effects. The LWJGL binary -distribution includes the OpenAL .dlls for Win32.</p> +distribution includes the OpenAL libraries.</p> <p>3.4 Input</p> <p>Input can be a complicated topic. A user can have all sorts of strange fancy force-feedback hardware installed on their systems, with scrolly knobs and |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-29 21:52:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv10824/src/native/win32 Modified Files: org_lwjgl_Display.cpp Window.h org_lwjgl_Window.cpp Log Message: Stuff for 0.6 Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- org_lwjgl_Display.cpp 28 Mar 2003 23:16:14 -0000 1.36 +++ org_lwjgl_Display.cpp 29 Mar 2003 21:52:13 -0000 1.37 @@ -47,6 +47,7 @@ jobjectArray GetAvailableDisplayModesNT(JNIEnv * env); jobjectArray GetAvailableDisplayModes9x(JNIEnv * env); bool modeSet = false; // Whether we've done a display mode change +WORD* originalGamma = new WORD[256 * 3]; // Original gamma settings /* @@ -238,7 +239,7 @@ // class's mode instance variable. // Get the screen - HDC screenDC = CreateCompatibleDC(NULL); + HDC screenDC = GetDC(NULL); // Get the device caps width = GetDeviceCaps(screenDC, HORZRES); height = GetDeviceCaps(screenDC, VERTRES); @@ -246,7 +247,7 @@ freq = GetDeviceCaps(screenDC, VREFRESH); if (freq <= 1) freq = 0; // Unknown - DeleteDC(screenDC); + ReleaseDC(NULL, screenDC); jmethodID ctor = env->GetMethodID(cls_displayMode, "<init>", "(IIII)V"); jobject newMode = env->NewObject(cls_displayMode, ctor, width, height, bpp, freq); @@ -265,6 +266,12 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_resetDisplayMode (JNIEnv * env, jclass clazz) { + + // Return device gamma to normal + HDC screenDC = GetDC(NULL); + SetDeviceGammaRamp(screenDC, originalGamma); + ReleaseDC(NULL, screenDC); + if (modeSet) { modeSet = false; // Under Win32, all we have to do is: @@ -280,20 +287,127 @@ * Method: getGammaRamp * Signature: ()[I */ -JNIEXPORT jintArray JNICALL Java_org_lwjgl_Display_getGammaRamp - (JNIEnv * env, jclass clazz) +JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_getGammaRamp + (JNIEnv * env, jclass clazz, jintArray red, jintArray green, jintArray blue) { - return NULL; +#ifdef _DEBUG + if (red == NULL) { + throwRuntimeException(env, "Null red array."); + return JNI_FALSE; + } + if (green == NULL) { + throwRuntimeException(env, "Null green array."); + return JNI_FALSE; + } + if (blue == NULL) { + throwRuntimeException(env, "Null blue array."); + return JNI_FALSE; + } + if (env->GetArrayLength(red) != 256) { + throwRuntimeException(env, "Red array is not 256 long."); + return JNI_FALSE; + } + if (env->GetArrayLength(green) != 256) { + throwRuntimeException(env, "Green array is not 256 long."); + return JNI_FALSE; + } + if (env->GetArrayLength(blue) != 256) { + throwRuntimeException(env, "Blue array is not 256 long."); + return JNI_FALSE; + } +#endif + + jint * redPtr = env->GetIntArrayElements(red, NULL); + jint * greenPtr = env->GetIntArrayElements(green, NULL); + jint * bluePtr = env->GetIntArrayElements(blue, NULL); + + WORD currentGamma[768]; + HDC screenDC = GetDC(NULL); + if (GetDeviceGammaRamp(screenDC, currentGamma) == FALSE) { +#ifdef _DEBUG + printf("Failed to get device gamma\n"); +#endif + env->ReleaseIntArrayElements(red, redPtr, JNI_ABORT); + env->ReleaseIntArrayElements(green, greenPtr, JNI_ABORT); + env->ReleaseIntArrayElements(blue, bluePtr, JNI_ABORT); + ReleaseDC(NULL, screenDC); + return JNI_FALSE; + } + ReleaseDC(NULL, screenDC); + for (int i = 0; i < 256; i ++) { + redPtr[i] = (jint) currentGamma[i]; + greenPtr[i] = (jint) currentGamma[i + 256]; + bluePtr[i] = (jint) currentGamma[i + 512]; + } + env->ReleaseIntArrayElements(red, redPtr, 0); + env->ReleaseIntArrayElements(green, greenPtr, 0); + env->ReleaseIntArrayElements(blue, bluePtr, 0); + return JNI_TRUE; } /* * Class: org_lwjgl_Display * Method: setGammaRamp - * Signature: ([I)V + * Signature: ([I[I[I)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_Display_setGammaRamp - (JNIEnv * env, jclass clazz, jintArray gamma) +JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_setGammaRamp + (JNIEnv * env, jclass clazz, jintArray red, jintArray green, jintArray blue) { +#ifdef _DEBUG + if (red == NULL) { + throwRuntimeException(env, "Null red array."); + return JNI_FALSE; + } + if (green == NULL) { + throwRuntimeException(env, "Null green array."); + return JNI_FALSE; + } + if (blue == NULL) { + throwRuntimeException(env, "Null blue array."); + return JNI_FALSE; + } + if (env->GetArrayLength(red) != 256) { + throwRuntimeException(env, "Red array is not 256 long."); + return JNI_FALSE; + } + if (env->GetArrayLength(green) != 256) { + throwRuntimeException(env, "Green array is not 256 long."); + return JNI_FALSE; + } + if (env->GetArrayLength(blue) != 256) { + throwRuntimeException(env, "Blue array is not 256 long."); + return JNI_FALSE; + } +#endif + + jint * redPtr = env->GetIntArrayElements(red, NULL); + jint * greenPtr = env->GetIntArrayElements(green, NULL); + jint * bluePtr = env->GetIntArrayElements(blue, NULL); + + // Turn array of ints into array of RGB WORDs + WORD newGamma[768]; + for (int i = 0; i < 256; i ++) { + newGamma[i] = (WORD)(min(0x00010000, redPtr[i])); + newGamma[i + 256] = (WORD)(min(0x00010000, greenPtr[i])); + newGamma[i + 512] = (WORD)(min(0x00010000, bluePtr[i])); + } + jboolean ret; + HDC screenDC = GetDC(NULL); + if (SetDeviceGammaRamp(screenDC, newGamma) == FALSE) { +#ifdef _DEBUG + printf("Failed to set device gamma\n"); +#endif + ret = JNI_FALSE; + } else { + ret = JNI_TRUE; + } + ReleaseDC(NULL, screenDC); + + env->ReleaseIntArrayElements(red, redPtr, JNI_ABORT); + env->ReleaseIntArrayElements(green, greenPtr, JNI_ABORT); + env->ReleaseIntArrayElements(blue, bluePtr, JNI_ABORT); + + return ret; } @@ -307,7 +421,7 @@ { // Determine the current screen resolution // Get the screen - HDC screenDC = CreateCompatibleDC(NULL); + HDC screenDC = GetDC(NULL); if (!screenDC) { printf("Couldn't get screen DC!\n"); return; @@ -319,7 +433,6 @@ int freq = GetDeviceCaps(screenDC, VREFRESH); if (freq <= 1) freq = 0; // Unknown - DeleteDC(screenDC); jclass jclass_DisplayMode = env->FindClass("org/lwjgl/DisplayMode"); jmethodID ctor = env->GetMethodID(jclass_DisplayMode, "<init>", "(IIII)V"); @@ -327,6 +440,14 @@ jfieldID fid_initialMode = env->GetStaticFieldID(clazz, "mode", "Lorg/lwjgl/DisplayMode;"); env->SetStaticObjectField(clazz, fid_initialMode, newMode); env->DeleteLocalRef(newMode); + + // Get the default gamma ramp + if (GetDeviceGammaRamp(screenDC, originalGamma) == FALSE) { +#ifdef _DEBUG + printf("Failed to get initial device gamma\n"); +#endif + } + ReleaseDC(NULL, screenDC); } Index: Window.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/Window.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Window.h 28 Mar 2003 19:01:55 -0000 1.2 +++ Window.h 29 Mar 2003 21:52:14 -0000 1.3 @@ -88,4 +88,9 @@ */ WINDOW_H_API void throwException(JNIEnv * env, const char * err); + /* + * Utility function to throw a RuntimeException + */ + WINDOW_H_API void throwRuntimeException(JNIEnv * env, const char * err); + #endif /* _LWJGL_WINDOW_H_INCLUDED_ */ Index: org_lwjgl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_Window.cpp 28 Mar 2003 23:16:15 -0000 1.4 +++ org_lwjgl_Window.cpp 29 Mar 2003 21:52:14 -0000 1.5 @@ -66,6 +66,16 @@ } /* + * Utility function to throw a RuntimeException + */ +void throwRuntimeException(JNIEnv * env, const char * err) +{ + jclass cls = env->FindClass("java/lang/RuntimeException"); + env->ThrowNew(cls, err); + env->DeleteLocalRef(cls); +} + +/* * Create DirectInput. * Returns true for success, or false for failure */ |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-29 21:52:05
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv10714/src/native/common Modified Files: org_lwjgl_Display.h Log Message: Stuff for 0.6 Index: org_lwjgl_Display.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Display.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Display.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_Display.h 28 Mar 2003 01:28:04 -0000 1.10 +++ org_lwjgl_Display.h 29 Mar 2003 21:52:00 -0000 1.11 @@ -62,18 +62,18 @@ /* * Class: org_lwjgl_Display * Method: getGammaRamp - * Signature: ()[I + * Signature: ([I[I[I)Z */ -JNIEXPORT jintArray JNICALL Java_org_lwjgl_Display_getGammaRamp - (JNIEnv *, jclass); +JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_getGammaRamp + (JNIEnv *, jclass, jintArray, jintArray, jintArray); /* * Class: org_lwjgl_Display * Method: setGammaRamp - * Signature: ([I)V + * Signature: ([I[I[I)Z */ -JNIEXPORT void JNICALL Java_org_lwjgl_Display_setGammaRamp - (JNIEnv *, jclass, jintArray); +JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_setGammaRamp + (JNIEnv *, jclass, jintArray, jintArray, jintArray); #ifdef __cplusplus } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-29 21:51:46
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv10572/src/java/org/lwjgl Modified Files: Display.java Log Message: Stuff for 0.6 Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Display.java 28 Mar 2003 23:15:51 -0000 1.23 +++ Display.java 29 Mar 2003 21:51:43 -0000 1.24 @@ -201,19 +201,34 @@ /** * Obtains the display's gamma ramp. The gamma ramp returned is an array of - * integers in the range 0..255. If gamma is not supported by the underlying - * hardware then null is returned. - * @return an array of ints, or null + * 16:16 fixed point values representing 0.0...1.0. The gamma ramp consists of three consecutive + * arrays, one for red, one for green, and one for blue. The length of the + * array is 768 values (so red will be 0..255, green 256...511, and blue 512..767) + * + * If gamma is not supported by the underlying hardware then false is returned. + * + * @param red[] An array of ints to store red gamma in. Must be 256 in length. + * @param green[] An array of ints to store green gamma in. Must be 256 in length. + * @param blue[] An array of ints to store blue gamma in. Must be 256 in length. + * @return true if it succeeds, false if it fails */ - public static native int[] getGammaRamp(); + public static native boolean getGammaRamp(int[] red, int[] green, int[] blue); /** * Sets the display's gamma ramp. The gamma ramp should be an array of ints - * in the range 0...255. The length of the array should match the length of the - * array returned by getGammaRamp(). + * in 16:16 fixed point format, arranged as for getGammaRamp(). + * The length of the array must be 768. * * If the underlying hardware does not support gamma then this command is a no-op. + * + * When LWJGL exits, any gamma changes are automatically undone. + * + * @param red[] An array of ints to store red gamma in. Must be 256 in length. + * @param green[] An array of ints to store green gamma in. Must be 256 in length. + * @param blue[] An array of ints to store blue gamma in. Must be 256 in length. + * + * @return true if it succeeds, false if it fails */ - public static native void setGammaRamp(int[] gamma); + public static native boolean setGammaRamp(int[] red, int[] green, int[] blue); } |
|
From: Brian M. <ma...@us...> - 2003-03-28 23:59:01
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1:/tmp/cvs-serv2086/test/input Modified Files: ControllerCreationTest.java MouseTest.java Log Message: fix: go for 16 bit mode instead of 32 Index: ControllerCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ControllerCreationTest.java 28 Mar 2003 22:12:38 -0000 1.4 +++ ControllerCreationTest.java 28 Mar 2003 23:58:54 -0000 1.5 @@ -83,7 +83,7 @@ private void setupDisplay(boolean fullscreen) { try { - gl = new GL("ControllerCreationTest", 50, 50, 640, 480, 32, 0, 0, 0); + gl = new GL("ControllerCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); gl.create(); glu = new GLU(gl); Index: MouseTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- MouseTest.java 28 Mar 2003 23:46:29 -0000 1.10 +++ MouseTest.java 28 Mar 2003 23:58:55 -0000 1.11 @@ -78,7 +78,7 @@ private void setupDisplay(boolean fullscreen) { try { - gl = new GL("MouseTest", 50, 50, 640, 480, 32, 0, 0, 0); + gl = new GL("MouseTest", 50, 50, 640, 480, 16, 0, 0, 0); gl.create(); glu = new GLU(gl); |
|
From: Brian M. <ma...@us...> - 2003-03-28 23:59:00
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test In directory sc8-pr-cvs1:/tmp/cvs-serv2086/test Modified Files: WindowCreationTest.java Log Message: fix: go for 16 bit mode instead of 32 Index: WindowCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- WindowCreationTest.java 28 Mar 2003 22:12:38 -0000 1.3 +++ WindowCreationTest.java 28 Mar 2003 23:58:54 -0000 1.4 @@ -21,7 +21,7 @@ System.out.println("Found " + modes.length + " display modes"); try { - gl = new GL("WindowCreationTest", 50, 50, 320, 240, 32, 0, 0, 0); + gl = new GL("WindowCreationTest", 50, 50, 320, 240, 16, 0, 0, 0); } catch (Exception e) { e.printStackTrace(); } |
|
From: Brian M. <ma...@us...> - 2003-03-28 23:57:54
|
Update of /cvsroot/java-game-lib/LWJGL/examples In directory sc8-pr-cvs1:/tmp/cvs-serv1657 Modified Files: BaseWindow.java Log Message: fix: lets keep it at 640*480 Index: BaseWindow.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/examples/BaseWindow.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/examples/BaseWindow.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- BaseWindow.java 19 Mar 2003 12:41:27 -0000 1.9 +++ BaseWindow.java 28 Mar 2003 23:57:45 -0000 1.10 @@ -66,7 +66,7 @@ gl.loadIdentity(); /* Calculate The Aspect Ratio Of The Window */ - glu.perspective(45.0f, ((float) Display.getWidth()) / ((float) Display.getHeight()), 0.1f, 100.0f); + glu.perspective(45.0f, ((float) width) / ((float) height), 0.1f, 100.0f); /* Select The Modelview Matrix */ gl.matrixMode(GL.MODELVIEW); @@ -104,7 +104,6 @@ Mouse.destroy(); Keyboard.destroy(); gl.destroy(); - Display.destroy(); } protected void createGLWindow(int width, int height, int bits, boolean fullscreenflag) throws Exception { @@ -121,8 +120,7 @@ } } - Display.create(modes[mode], 0, 16, 0, fullscreenflag, "LWJGL Example"); - gl = new GL(); + gl = new GL("LWJGL Example", 50, 50, width, height, bits, 0, 0, 0); gl.create(); glu = new GLU(gl); Keyboard.create(); @@ -130,7 +128,7 @@ Mouse.create(); //Mouse.enableBuffer(); - resizeGLScene(Display.getWidth(), Display.getHeight()); + resizeGLScene(width, height); initGL(); } @@ -151,6 +149,7 @@ createGLWindow(width, height, bpp, fullscreen); do { + gl.tick(); /* The frameTime is how much time it takes to draw a single frame. * We use this so we can animate things in real time. * @@ -178,7 +177,7 @@ return true; } - gl.swapBuffers(); + gl.paint(); input(frameTime); return done; |
|
From: Brian M. <ma...@us...> - 2003-03-28 23:47:24
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1:/tmp/cvs-serv30307 Modified Files: MouseCreationTest.java Log Message: fix: rewritten windowed/fullscreen selection Index: MouseCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- MouseCreationTest.java 28 Mar 2003 22:12:39 -0000 1.7 +++ MouseCreationTest.java 28 Mar 2003 23:47:20 -0000 1.8 @@ -65,7 +65,7 @@ public MouseCreationTest() { } - private void initialize() { + private void initialize(boolean fullscreen) { // find first display mode that allows us 640*480*16 DisplayMode[] modes = Display.getAvailableDisplayModes(); for (int i = 0; i < modes.length; i++) { @@ -78,7 +78,12 @@ } try { - gl = new GL("MouseCreationTest", 50, 50, 640, 480, 32, 0, 0, 0); + if(fullscreen) { + Display.setDisplayMode(displayMode); + gl = new GL("MouseCreationTest", 16, 0, 0, 0); + } else { + gl = new GL("MouseCreationTest", 50, 50, 640, 480, 16, 0, 0, 0); + } gl.create(); glu = new GLU(gl); @@ -96,7 +101,7 @@ } public void executeTest() { - initialize(); + initialize(false); System.out.println("Test ready:\n"); @@ -118,7 +123,7 @@ System.out.print("Entering fullscreen mode..."); try { gl.destroy(); - initialize(); + initialize(true); Display.setDisplayMode(displayMode); } catch (Exception e) { e.printStackTrace(); |
|
From: Brian M. <ma...@us...> - 2003-03-28 23:46:34
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1:/tmp/cvs-serv29908 Modified Files: MouseTest.java Log Message: fix: make certain that gl.tick is always called Index: MouseTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- MouseTest.java 28 Mar 2003 22:12:40 -0000 1.9 +++ MouseTest.java 28 Mar 2003 23:46:29 -0000 1.10 @@ -118,11 +118,16 @@ private void wiggleMouse() { while (!gl.isCloseRequested()) { + gl.tick(); + if(gl.isMinimized()) { + try { + Thread.sleep(100); + } catch (InterruptedException inte) { + inte.printStackTrace(); + } continue; } - - gl.tick(); Mouse.poll(); Keyboard.poll(); |
|
From: Brian M. <ma...@us...> - 2003-03-28 23:40:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv27609 Modified Files: Game.java Log Message: fix: removed double Keyboard.read Index: Game.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Game.java 28 Mar 2003 19:17:38 -0000 1.12 +++ Game.java 28 Mar 2003 23:40:45 -0000 1.13 @@ -108,7 +108,6 @@ System.exit(0); Keyboard.poll(); - Keyboard.read(); mainLoop(); render(); gl.paint(); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-28 23:16:21
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv18020/src/native/win32 Modified Files: org_lwjgl_opengl_BaseGL.cpp org_lwjgl_Display.cpp org_lwjgl_Window.cpp Log Message: Big changes for the new 0.6 LWJGL release Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_opengl_BaseGL.cpp 28 Mar 2003 19:01:48 -0000 1.16 +++ org_lwjgl_opengl_BaseGL.cpp 28 Mar 2003 23:16:13 -0000 1.17 @@ -198,6 +198,9 @@ // Delete the rendering context if (hglrc != NULL) { +#ifdef _DEBUG + printf("Delete GL context\n"); +#endif wglDeleteContext(hglrc); hglrc = NULL; } Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- org_lwjgl_Display.cpp 28 Mar 2003 19:01:50 -0000 1.35 +++ org_lwjgl_Display.cpp 28 Mar 2003 23:16:14 -0000 1.36 @@ -46,7 +46,7 @@ jobjectArray GetAvailableDisplayModesNT(JNIEnv * env); jobjectArray GetAvailableDisplayModes9x(JNIEnv * env); - +bool modeSet = false; // Whether we've done a display mode change /* @@ -254,6 +254,7 @@ env->SetStaticObjectField(clazz, fid_initialMode, newMode); env->DeleteLocalRef(newMode); + modeSet = true; } /* @@ -264,11 +265,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_resetDisplayMode (JNIEnv * env, jclass clazz) { - // Under Win32, all we have to do is: - ChangeDisplaySettings(NULL, 0); + if (modeSet) { + modeSet = false; + // Under Win32, all we have to do is: + ChangeDisplaySettings(NULL, 0); - // And we'll call init() again to put the correct mode back in Display - Java_org_lwjgl_Display_init(env, clazz); + // And we'll call init() again to put the correct mode back in Display + Java_org_lwjgl_Display_init(env, clazz); + } } /* Index: org_lwjgl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Window.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_Window.cpp 28 Mar 2003 21:04:32 -0000 1.3 +++ org_lwjgl_Window.cpp 28 Mar 2003 23:16:15 -0000 1.4 @@ -101,19 +101,31 @@ { // Release DirectInput if (lpdi != NULL) { +#ifdef _DEBUG + printf("Destroying directinput\n"); +#endif lpdi->Release(); lpdi = NULL; } // Release device context if (hdc != NULL && hwnd != NULL) { +#ifdef _DEBUG + printf("Releasing DC\n"); +#endif ReleaseDC(hwnd, hdc); } // Close the window if (hwnd != NULL) { +#ifdef _DEBUG + printf("Destroy window\n"); +#endif // Vape the window DestroyWindow(hwnd); +#ifdef _DEBUG + printf("Destroyed window\n"); +#endif hwnd = NULL; } @@ -144,7 +156,6 @@ LPARAM lParam) { if (environment == NULL) { - printf("No environment!\n"); return DefWindowProc(hWnd, msg, wParam, lParam); } @@ -227,7 +238,9 @@ printf("Failed to register window class\n"); return false; } +#ifdef _DEBUG printf("Window registered\n"); +#endif oneShotInitialised = true; } @@ -308,7 +321,7 @@ // and then to issue commands to it, you need to call gl::makeCurrent(). // 3. Hide the mouse if necessary - isFullScreen = fullscreen; + isFullScreen = fullscreen == JNI_TRUE; if (isFullScreen) { ShowCursor(FALSE); } @@ -356,7 +369,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Window_nDestroy (JNIEnv * env, jobject obj) { + // Cache env and obj + environment = env; + window = obj; + closeWindow(); + + environment = NULL; + window = NULL; } /* |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-28 23:16:03
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv17848/src/java/org/lwjgl Modified Files: Display.java Window.java Log Message: Big changes for the new 0.6 LWJGL release Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Display.java 28 Mar 2003 19:00:52 -0000 1.22 +++ Display.java 28 Mar 2003 23:15:51 -0000 1.23 @@ -139,7 +139,7 @@ * Reset the display mode to whatever it was when LWJGL was initialized. * Fails silently. */ - public static native void resetDisplayMode() throws Exception; + public static native void resetDisplayMode(); /** * Retrieves the width of the created display Index: Window.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Window.java 28 Mar 2003 19:00:53 -0000 1.5 +++ Window.java 28 Mar 2003 23:15:53 -0000 1.6 @@ -184,7 +184,7 @@ /** * Destroy the window. */ - public final void destroy() { + public final synchronized void destroy() { if (!created) return; doDestroy(); @@ -239,4 +239,10 @@ return "Window["+title+"]"; } + /** + * @return the current window, or null, if there is no current window + */ + public static Window getCurrentWindow() { + return currentWindow; + } } |