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
(6) |
2
|
3
|
4
(3) |
5
|
6
|
7
(11) |
|
8
(2) |
9
|
10
|
11
|
12
(6) |
13
|
14
|
|
15
(1) |
16
(4) |
17
(8) |
18
|
19
|
20
|
21
|
|
22
|
23
|
24
(17) |
25
|
26
|
27
|
28
|
|
29
|
30
|
|
|
|
|
|
|
From: Elias N. <eli...@us...> - 2003-06-16 17:07:38
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv20221/src/java/org/lwjgl/opengl Modified Files: CoreGL.java Log Message: Index: CoreGL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- CoreGL.java 16 Jun 2003 17:05:48 -0000 1.14 +++ CoreGL.java 16 Jun 2003 17:07:35 -0000 1.15 @@ -32,8 +32,6 @@ package org.lwjgl.opengl; -import java.nio.ByteBuffer; - /** * $Id$ * |
|
From: Elias N. <eli...@us...> - 2003-06-16 17:05:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv19798/src/java/org/lwjgl/openal Modified Files: BaseAL.java Log Message: Cleaned up JWS openal loading Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- BaseAL.java 16 Jun 2003 16:57:25 -0000 1.13 +++ BaseAL.java 16 Jun 2003 17:05:48 -0000 1.14 @@ -94,8 +94,8 @@ // try to get path from JWS (if possible) String jwsLibname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) - ? "openal.so" - : "OpenAL32.dll"; + ? "openal" + : "OpenAL32"; String jwsPath = getPathFromJWS(jwsLibname); if (jwsPath != null) { @@ -135,7 +135,6 @@ */ private String getPathFromJWS(String libname) { try { - libname = libname.substring(0, libname.lastIndexOf(".")); if(Sys.DEBUG) { System.out.println("JWS Classloader looking for: " + libname); @@ -180,4 +179,4 @@ * Native method the destroy the AL */ protected native void nDestroy(); -} \ No newline at end of file +} |
|
From: Elias N. <eli...@us...> - 2003-06-16 17:05:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv19798/src/java/org/lwjgl/opengl Modified Files: CoreGL.java Log Message: Cleaned up JWS openal loading Index: CoreGL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/CoreGL.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- CoreGL.java 28 Mar 2003 19:18:23 -0000 1.13 +++ CoreGL.java 16 Jun 2003 17:05:48 -0000 1.14 @@ -32,6 +32,8 @@ package org.lwjgl.opengl; +import java.nio.ByteBuffer; + /** * $Id$ * |
|
From: Brian M. <ma...@us...> - 2003-06-16 16:57:29
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv18560 Modified Files: BaseAL.java Log Message: fix: linux findLibrary failed because invalid lib name was passed Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- BaseAL.java 15 Jun 2003 22:35:27 -0000 1.12 +++ BaseAL.java 16 Jun 2003 16:57:25 -0000 1.13 @@ -92,7 +92,12 @@ : "OpenAL32.dll"; // try to get path from JWS (if possible) - String jwsPath = getPathFromJWS(libname); + String jwsLibname = + (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) + ? "openal.so" + : "OpenAL32.dll"; + + String jwsPath = getPathFromJWS(jwsLibname); if (jwsPath != null) { libpath += seperator + jwsPath.substring(0, jwsPath.lastIndexOf(File.separator)); |
|
From: Brian M. <ma...@us...> - 2003-06-15 22:35:30
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv15045 Modified Files: BaseAL.java Log Message: fix: Java Web Start loading of OpenAL Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- BaseAL.java 12 Jun 2003 15:19:05 -0000 1.11 +++ BaseAL.java 15 Jun 2003 22:35:27 -0000 1.12 @@ -33,6 +33,9 @@ import java.io.File; import java.util.StringTokenizer; +import java.lang.reflect.Method; + +import org.lwjgl.Sys; /** * $Id$ @@ -72,38 +75,82 @@ * * @throws Exception if a failiure occured in the AL creation process */ - public void create() throws OpenALException { - if (created) { - return; - } + public void create() throws OpenALException { + if (created) { + return; + } - // need to pass path of possible locations of OAL to native side - String libpath = System.getProperty("java.library.path"); - String seperator = System.getProperty("path.separator"); - String libname; + // need to pass path of possible locations of OAL to native side + String libpath = System.getProperty("java.library.path"); + String seperator = System.getProperty("path.separator"); + String libname; - // libname is hardcoded atm - this will change in a near future... - libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) ? "libopenal.so" : "OpenAL32.dll"; + // libname is hardcoded atm - this will change in a near future... + libname = + (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) + ? "libopenal.so" + : "OpenAL32.dll"; - StringTokenizer st = new StringTokenizer(libpath, seperator); + // try to get path from JWS (if possible) + String jwsPath = getPathFromJWS(libname); + if (jwsPath != null) { + libpath += seperator + + jwsPath.substring(0, jwsPath.lastIndexOf(File.separator)); + } - //create needed string array - String[] oalPaths = new String[st.countTokens() + 1]; + StringTokenizer st = new StringTokenizer(libpath, seperator); - //build paths - for (int i = 0; i < oalPaths.length - 1; i++) { - oalPaths[i] = st.nextToken() + File.separator + libname; - } + //create needed string array + String[] oalPaths = new String[st.countTokens() + 1]; - //add cwd path - oalPaths[oalPaths.length - 1] = libname; - if (!nCreate(oalPaths)) { - throw new OpenALException("AL instance could not be created."); - } + //build paths + for (int i = 0; i < oalPaths.length - 1; i++) { + oalPaths[i] = st.nextToken() + File.separator + libname; + } - init(); - created = true; - } + //add cwd path + oalPaths[oalPaths.length - 1] = libname; + if (!nCreate(oalPaths)) { + throw new OpenALException("AL instance could not be created."); + } + + init(); + created = true; + } + + /** + * Tries to locate OpenAL from the JWS Library path + * This method exists because OpenAL is loaded from native code, and as such + * is exempt from JWS library loading rutines. OpenAL therefore always fails. + * We therefore invoke the protected method of the JWS classloader to see if it can + * locate it. + * + * @param libname Name of library to search for + * @return Absolute path to library if found, otherwise null + */ + private String getPathFromJWS(String libname) { + try { + libname = libname.substring(0, libname.lastIndexOf(".")); + + if(Sys.DEBUG) { + System.out.println("JWS Classloader looking for: " + libname); + } + + Object o = BaseAL.class.getClassLoader(); + Class c = o.getClass(); + Method findLibrary = + c.getMethod("findLibrary", new Class[] { String.class }); + Object[] arguments = new Object[] { libname }; + return (String) findLibrary.invoke(o, arguments); + + } catch (Exception e) { + if(Sys.DEBUG) { + System.out.println("Failure locating OpenAL using classloader:"); + e.printStackTrace(); + } + } + return null; + } /** * Native method to create AL instance |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-12 15:19:36
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv6869/src/native/common Modified Files: extal.cpp Log Message: Index: extal.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extal.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- extal.cpp 12 Jun 2003 14:08:10 -0000 1.4 +++ extal.cpp 12 Jun 2003 15:19:31 -0000 1.5 @@ -175,22 +175,6 @@ */ void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { - /* - * CAS: Experimental new code for loading OpenAL. We're ignoring the paths - * and just trying to load it once. - */ - -#ifdef _WIN32 - handleOAL = LoadLibrary("OpenAL32.dll"); -#endif -#ifdef _X11 - handleOAL = dlopen("libopenal.so", RTLD_LAZY); -#endif -#ifdef TARGET_OS_MAC - oalInitEntryPoints(); -#endif - - /* jsize pathcount = env->GetArrayLength(oalPaths); #ifdef _DEBUG printf("Found %d OpenAL paths\n", pathcount); @@ -218,7 +202,7 @@ break; } env->ReleaseStringUTFChars(path, path_str); - */ + } } /** |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-12 15:19:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv6574/src/java/org/lwjgl/openal Modified Files: BaseAL.java Log Message: Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- BaseAL.java 12 Jun 2003 14:07:35 -0000 1.10 +++ BaseAL.java 12 Jun 2003 15:19:05 -0000 1.11 @@ -65,11 +65,6 @@ */ private static void initialize() { System.loadLibrary(org.lwjgl.Sys.getLibraryName()); - try { - System.loadLibrary("OpenAL32"); - } catch (Exception e) { - System.loadLibrary("openal"); - } } /** |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-12 14:08:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv29251/src/native/common Modified Files: extal.cpp Log Message: Index: extal.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extal.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- extal.cpp 17 May 2003 02:50:51 -0000 1.3 +++ extal.cpp 12 Jun 2003 14:08:10 -0000 1.4 @@ -174,7 +174,24 @@ * Loads the OpenAL Library */ void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { - jsize pathcount = env->GetArrayLength(oalPaths); + + /* + * CAS: Experimental new code for loading OpenAL. We're ignoring the paths + * and just trying to load it once. + */ + +#ifdef _WIN32 + handleOAL = LoadLibrary("OpenAL32.dll"); +#endif +#ifdef _X11 + handleOAL = dlopen("libopenal.so", RTLD_LAZY); +#endif +#ifdef TARGET_OS_MAC + oalInitEntryPoints(); +#endif + + /* + jsize pathcount = env->GetArrayLength(oalPaths); #ifdef _DEBUG printf("Found %d OpenAL paths\n", pathcount); #endif @@ -201,7 +218,7 @@ break; } env->ReleaseStringUTFChars(path, path_str); - } + */ } /** |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-12 14:08:03
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv29147/src/native/win32 Modified Files: org_lwjgl_Window.cpp Log Message: 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.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_Window.cpp 7 Jun 2003 19:28:53 -0000 1.12 +++ org_lwjgl_Window.cpp 12 Jun 2003 14:07:56 -0000 1.13 @@ -149,12 +149,18 @@ */ void appActivate(bool active) { + if (!active) { + tempResetDisplayMode(); + } if (active) { SetForegroundWindow(hwnd); ShowWindow(hwnd, SW_RESTORE); } else if (isFullScreen) { ShowWindow(hwnd, SW_MINIMIZE); } + if (active) { + tempRestoreDisplayMode(); + } } /* @@ -200,15 +206,11 @@ case WA_CLICKACTIVE: environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_FALSE); isMinimized = false; - // Change to game display settings - tempRestoreDisplayMode(); break; case WA_INACTIVE: environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_TRUE); isMinimized = true; - // Restore display settings - tempResetDisplayMode(); break; } @@ -413,7 +415,7 @@ if (isMinimized) return; ShowWindow(hwnd, SW_MINIMIZE); -// tempResetDisplayMode(); + tempResetDisplayMode(); } /* @@ -427,6 +429,6 @@ if (!isMinimized) return; -// tempRestoreDisplayMode(); + tempRestoreDisplayMode(); ShowWindow(hwnd, SW_RESTORE); } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-12 14:07:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv29031/src/java/org/lwjgl/openal Modified Files: BaseAL.java Log Message: Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- BaseAL.java 27 Apr 2003 18:37:37 -0000 1.9 +++ BaseAL.java 12 Jun 2003 14:07:35 -0000 1.10 @@ -47,87 +47,90 @@ * @version $Revision$ */ public abstract class BaseAL { - /** Have we been created? */ - protected static boolean created; - - static { - initialize(); - } - - /** - * Override to provide any initialization code after creation. - */ - protected void init() throws OpenALException { - } - - /** - * Static initialization - */ - private static void initialize() { - System.loadLibrary(org.lwjgl.Sys.getLibraryName()); - } - - /** - * Creates the AL instance - * - * @throws Exception if a failiure occured in the AL creation process - */ - public void create() throws OpenALException { - if (created) { - return; - } + /** Have we been created? */ + protected static boolean created; - // need to pass path of possible locations of OAL to native side - String libpath = System.getProperty("java.library.path"); - String seperator = System.getProperty("path.separator"); - String libname; + static { + initialize(); + } - // libname is hardcoded atm - this will change in a near future... - libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) - ? "libopenal.so" - : "OpenAL32.dll"; + /** + * Override to provide any initialization code after creation. + */ + protected void init() throws OpenALException { + } - StringTokenizer st = new StringTokenizer(libpath, seperator); - - //create needed string array - String[] oalPaths = new String[st.countTokens()+1]; + /** + * Static initialization + */ + private static void initialize() { + System.loadLibrary(org.lwjgl.Sys.getLibraryName()); + try { + System.loadLibrary("OpenAL32"); + } catch (Exception e) { + System.loadLibrary("openal"); + } + } - //build paths - for(int i=0;i<oalPaths.length - 1;i++) { - oalPaths[i] = st.nextToken() + File.separator + libname; - } + /** + * Creates the AL instance + * + * @throws Exception if a failiure occured in the AL creation process + */ + public void create() throws OpenALException { + if (created) { + return; + } - //add cwd path - oalPaths[oalPaths.length-1] = libname; - if (!nCreate(oalPaths)) { - throw new OpenALException("AL instance could not be created."); - } - - init(); - created = true; - } - - /** - * Native method to create AL instance - * - * @param oalPaths Array of strings containing paths to search for OpenAL library - * @return true if the AL creation process succeeded - */ - protected native boolean nCreate(String[] oalPaths); - - /** - * Calls whatever destruction rutines that are needed - */ - public void destroy() { - if (!created) { - return; - } - created = false; - nDestroy(); - } - - /** - * Native method the destroy the AL - */ - protected native void nDestroy(); + // need to pass path of possible locations of OAL to native side + String libpath = System.getProperty("java.library.path"); + String seperator = System.getProperty("path.separator"); + String libname; + + // libname is hardcoded atm - this will change in a near future... + libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) ? "libopenal.so" : "OpenAL32.dll"; + + StringTokenizer st = new StringTokenizer(libpath, seperator); + + //create needed string array + String[] oalPaths = new String[st.countTokens() + 1]; + + //build paths + for (int i = 0; i < oalPaths.length - 1; i++) { + oalPaths[i] = st.nextToken() + File.separator + libname; + } + + //add cwd path + oalPaths[oalPaths.length - 1] = libname; + if (!nCreate(oalPaths)) { + throw new OpenALException("AL instance could not be created."); + } + + init(); + created = true; + } + + /** + * Native method to create AL instance + * + * @param oalPaths Array of strings containing paths to search for OpenAL library + * @return true if the AL creation process succeeded + */ + protected native boolean nCreate(String[] oalPaths); + + /** + * Calls whatever destruction rutines that are needed + */ + public void destroy() { + if (!created) { + return; + } + created = false; + nDestroy(); + } + + /** + * Native method the destroy the AL + */ + protected native void nDestroy(); } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-12 14:07:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv29031/src/java/org/lwjgl Modified Files: Sys.java Window.java Log Message: Index: Sys.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Sys.java 3 Apr 2003 21:02:23 -0000 1.18 +++ Sys.java 12 Jun 2003 14:07:36 -0000 1.19 @@ -107,6 +107,7 @@ } } + /** * @return the name of the native library to load 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.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Window.java 7 Jun 2003 12:47:08 -0000 1.11 +++ Window.java 12 Jun 2003 14:07:36 -0000 1.12 @@ -149,7 +149,7 @@ /** * Minimize the game and allow the operating system's default display to become - * visible. It is NOT the responsibility of LWJGL's native code to restore the display + * visible. It is the responsibility of LWJGL's native code to restore the display * to its normal display settings. * * If the display is already minimized then this is a no-op. @@ -157,7 +157,7 @@ public final native void minimize(); /** - * Restore the game and hide the operating system away. It is NOT the responsibility of + * Restore the game and hide the operating system away. It is the responsibility of * LWJGL's native code to restore the display to its game display settings. * * If the display is not minimized then this is a no-op/ |
|
From: Elias N. <eli...@us...> - 2003-06-08 14:32:34
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv17743/linux Modified Files: org_lwjgl_input_Mouse.cpp Log Message: Try to return a better minimum cursor size 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.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- org_lwjgl_input_Mouse.cpp 8 Jun 2003 14:30:53 -0000 1.27 +++ org_lwjgl_input_Mouse.cpp 8 Jun 2003 14:32:30 -0000 1.28 @@ -229,7 +229,7 @@ unsigned int width_return = 0; unsigned int height_return = 0; XQueryBestCursor(getCurrentDisplay(), getCurrentWindow(), 1, 1, &width_return, &height_return); - return width_return > height_return ? height_return : width_return; + return width_return > height_return ? width_return : height_return; } /* |
|
From: Elias N. <eli...@us...> - 2003-06-08 14:30:58
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv17036/linux Modified Files: org_lwjgl_input_Mouse.cpp Log Message: Try to return a better minimum cursor size 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.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- org_lwjgl_input_Mouse.cpp 1 Jun 2003 17:20:03 -0000 1.26 +++ org_lwjgl_input_Mouse.cpp 8 Jun 2003 14:30:53 -0000 1.27 @@ -226,7 +226,10 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize (JNIEnv *env, jclass clazz) { - return 1; + unsigned int width_return = 0; + unsigned int height_return = 0; + XQueryBestCursor(getCurrentDisplay(), getCurrentWindow(), 1, 1, &width_return, &height_return); + return width_return > height_return ? height_return : width_return; } /* |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-07 19:28:57
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv25045/src/native/win32 Modified Files: org_lwjgl_Display.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_Window.cpp Log Message: We now restore display settings on minimize. Hurrah! 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.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- org_lwjgl_Display.cpp 27 May 2003 14:12:10 -0000 1.39 +++ org_lwjgl_Display.cpp 7 Jun 2003 19:28:52 -0000 1.40 @@ -39,7 +39,7 @@ * @version $Revision$ */ -#include "Window.h" +#include "Window.h" #include "org_lwjgl_Display.h" #define WINDOWCLASSNAME "LWJGLWINDOW" @@ -48,6 +48,8 @@ jobjectArray GetAvailableDisplayModes9x(JNIEnv * env); bool modeSet = false; // Whether we've done a display mode change WORD* originalGamma = new WORD[256 * 3]; // Original gamma settings +WORD* currentGamma = new WORD[256 * 3]; // Current gamma settings +DEVMODE devmode; // Now we'll remember this value for the future /* @@ -206,7 +208,6 @@ int bpp = env->GetIntField(mode, fid_bpp); int freq = env->GetIntField(mode, fid_freq); - DEVMODE devmode; devmode.dmSize = sizeof(DEVMODE); devmode.dmBitsPerPel = bpp; devmode.dmPelsWidth = width; @@ -272,10 +273,10 @@ // Return device gamma to normal HDC screenDC = GetDC(NULL); - if (!SetDeviceGammaRamp(screenDC, originalGamma)) { -#ifdef _DEBUG - printf("Could not reset device gamma\n"); -#endif + if (!SetDeviceGammaRamp(screenDC, originalGamma)) { +#ifdef _DEBUG + printf("Could not reset device gamma\n"); +#endif } ReleaseDC(NULL, screenDC); @@ -287,18 +288,71 @@ // And we'll call init() again to put the correct mode back in Display Java_org_lwjgl_Display_init(env, clazz); } -} - -/* - * Class: org_lwjgl_Display - * Method: getGammaRampLength - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getGammaRampLength - (JNIEnv *env, jclass clazz) -{ - return 256; -} +} + +/* + * Temporarily reset display settings. This is called when the window is minimized. + */ +void tempResetDisplayMode() { + // Return device gamma to normal + HDC screenDC = GetDC(NULL); + if (!SetDeviceGammaRamp(screenDC, originalGamma)) { +#ifdef _DEBUG + printf("Could not reset device gamma\n"); +#endif + } + ReleaseDC(NULL, screenDC); + + if (modeSet) { +#ifdef _DEBUG + printf("Attempting to temporarily reset the display mode\n"); +#endif + modeSet = false; + // Under Win32, all we have to do is: + ChangeDisplaySettings(NULL, 0); + } +} + +/* + * Put display settings back to what they were when the window is maximized. + */ +void tempRestoreDisplayMode() { + // Restore gamma + HDC screenDC = GetDC(NULL); + if (!SetDeviceGammaRamp(screenDC, currentGamma)) { +#ifdef _DEBUG + printf("Could not restore device gamma\n"); +#endif + } + ReleaseDC(NULL, screenDC); + + if (!modeSet) { + +#ifdef _DEBUG + printf("Attempting to restore the display mode\n"); +#endif + modeSet = true; + LONG cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); + +#ifdef _DEBUG + if (cdsret != DISP_CHANGE_SUCCESSFUL) { + printf("Failed to restore display mode\n"); + } +#endif + } +} + + +/* + * Class: org_lwjgl_Display + * Method: getGammaRampLength + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getGammaRampLength + (JNIEnv *env, jclass clazz) +{ + return 256; +} /* * Class: org_lwjgl_Display @@ -307,20 +361,20 @@ */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_Display_setGammaRamp (JNIEnv * env, jclass clazz, jint gammaRampAddress) -{ +{ float *gammaRamp = (float *)gammaRampAddress; // Turn array of floats into array of RGB WORDs - WORD newGamma[768]; - for (int i = 0; i < 256; i ++) { - float scaledRampEntry = gammaRamp[i]*0xffff; - WORD rampEntry = (WORD)scaledRampEntry; - newGamma[i] = rampEntry; - newGamma[i + 256] = rampEntry; - newGamma[i + 512] = rampEntry; + + for (int i = 0; i < 256; i ++) { + float scaledRampEntry = gammaRamp[i]*0xffff; + WORD rampEntry = (WORD)scaledRampEntry; + currentGamma[i] = rampEntry; + currentGamma[i + 256] = rampEntry; + currentGamma[i + 512] = rampEntry; } jboolean ret; HDC screenDC = GetDC(NULL); - if (SetDeviceGammaRamp(screenDC, newGamma) == FALSE) { + if (SetDeviceGammaRamp(screenDC, currentGamma) == FALSE) { #ifdef _DEBUG printf("Failed to set device gamma\n"); #endif Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- org_lwjgl_input_Mouse.cpp 7 Jun 2003 12:49:55 -0000 1.22 +++ org_lwjgl_input_Mouse.cpp 7 Jun 2003 19:28:53 -0000 1.23 @@ -397,7 +397,7 @@ if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { mDIDevice->Acquire(); #if _DEBUG - printf("DIERR_INPUTLOST, reaquiring input : mCreate_success=%d\n", mCreate_success); + //printf("DIERR_INPUTLOST, reaquiring input : mCreate_success=%d\n", mCreate_success); #endif } else { #if _DEBUG 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.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_Window.cpp 7 Jun 2003 12:48:21 -0000 1.11 +++ org_lwjgl_Window.cpp 7 Jun 2003 19:28:53 -0000 1.12 @@ -54,6 +54,9 @@ extern HINSTANCE dll_handle; // Handle to the LWJGL dll RECT clientSize; +extern void tempRestoreDisplayMode(); +extern void tempResetDisplayMode(); + #define WINDOWCLASSNAME "LWJGL" /* @@ -197,10 +200,16 @@ case WA_CLICKACTIVE: environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_FALSE); isMinimized = false; + // Change to game display settings + tempRestoreDisplayMode(); + break; case WA_INACTIVE: environment->SetBooleanField(window, environment->GetFieldID(environment->GetObjectClass(window), "minimized", "Z"), JNI_TRUE); isMinimized = true; + // Restore display settings + tempResetDisplayMode(); + break; } appActivate(!isMinimized); @@ -404,6 +413,7 @@ if (isMinimized) return; ShowWindow(hwnd, SW_MINIMIZE); +// tempResetDisplayMode(); } /* @@ -417,5 +427,6 @@ if (!isMinimized) return; +// tempRestoreDisplayMode(); ShowWindow(hwnd, SW_RESTORE); } |
|
From: Elias N. <eli...@us...> - 2003-06-07 13:56:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1:/tmp/cvs-serv23382 Modified Files: configure.in Log Message: Fixed win9x keyboard translation 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.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- configure.in 1 Jun 2003 17:20:03 -0000 1.12 +++ configure.in 7 Jun 2003 13:56:05 -0000 1.13 @@ -51,8 +51,8 @@ else AC_MSG_RESULT($JAVA_HOME) JAVA_HOME="$JAVA_HOME" - CPPFLAGS="$CPPFLAGS -D_DEBUG -fno-rtti -fno-exceptions -pthread -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" - CFLAGS="$CFLAGS -D_DEBUG -pthread -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. |
|
From: Elias N. <eli...@us...> - 2003-06-07 13:56:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv23382/win32 Modified Files: org_lwjgl_input_Keyboard.cpp Log Message: Fixed win9x keyboard translation Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- org_lwjgl_input_Keyboard.cpp 7 Jun 2003 12:47:35 -0000 1.18 +++ org_lwjgl_input_Keyboard.cpp 7 Jun 2003 13:56:06 -0000 1.19 @@ -52,7 +52,8 @@ static BYTE readBuffer[KEYBOARD_BUFFER_SIZE*4]; static LPDIRECTINPUTDEVICE lpdiKeyboard = NULL; static jfieldID fid_readBuffer; -static bool translationEnabled; +static bool translationEnabled; +static bool useUnicode; /* @@ -177,7 +178,7 @@ lpdiKeyboard->GetDeviceState(256, (void *)buf); } - + /* * Class: org_lwjgl_input_Keyboard * Method: nRead @@ -188,7 +189,8 @@ { static DIDEVICEOBJECTDATA rgdod[KEYBOARD_BUFFER_SIZE]; - wchar_t transBuf[KEYBOARD_BUFFER_SIZE]; + wchar_t transBufUnicode[KEYBOARD_BUFFER_SIZE]; + WORD transBufAscii[KEYBOARD_BUFFER_SIZE]; BYTE state[256]; DWORD bufsize = KEYBOARD_BUFFER_SIZE; @@ -220,28 +222,35 @@ *buf++ = (unsigned char) rgdod[i].dwData; if (translationEnabled) { UINT virt_key = MapVirtualKey(rgdod[i].dwOfs, 1); - if (virt_key != 0) { - if (!GetKeyboardState(state)) { - *buf++ = 0; - *buf++ = 0; - continue; - } - num_chars = ToUnicode(virt_key, - rgdod[i].dwOfs, - state, - transBuf, - KEYBOARD_BUFFER_SIZE, 0); - if (num_chars > 0) { - wchar_t ch = transBuf[0]; - *buf++ = (unsigned char) (ch & 0xff); - *buf++ = (unsigned char) ((ch & 0xff00) >> 8); - for (int i = 1; i < num_chars; i++) { - num_events++; - ch = transBuf[i]; - *buf++ = 0; - *buf++ = 0; - *buf++ = (unsigned char) (ch & 0xff); - *buf++ = (unsigned char) ((ch & 0xff00) >> 8); + if (virt_key != 0 && GetKeyboardState(state)) { + if (useUnicode) { + num_chars = ToUnicode(virt_key, + rgdod[i].dwOfs, + state, + transBufUnicode, + KEYBOARD_BUFFER_SIZE, 0); + } else { + num_chars = ToAscii(virt_key, + rgdod[i].dwOfs, + state, + transBufAscii, + 0); + } + if (num_chars > 0) { + for (int i = 0; i < num_chars; i++) { + if (i >= 1) { + num_events++; + *buf++ = 0; + *buf++ = 0; + } + if (useUnicode) { + wchar_t ch = transBufUnicode[i]; + *buf++ = (unsigned char) (ch & 0xff); + *buf++ = (unsigned char) ((ch & 0xff00) >> 8); + } else { + *buf++ = (unsigned char)transBufAscii[0]; + *buf++ = 0; + } } } else { *buf++ = 0; @@ -300,13 +309,13 @@ osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionEx(&osvi); - if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { - translationEnabled = true; - return JNI_TRUE; + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { + useUnicode = true; } else { - translationEnabled = false; - return JNI_FALSE; + useUnicode = false; } + translationEnabled = true; + return JNI_TRUE; } /* |
|
From: Elias N. <eli...@us...> - 2003-06-07 13:56:09
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv23382/linux Modified Files: org_lwjgl_input_Keyboard.cpp Log Message: Fixed win9x keyboard translation 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.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- org_lwjgl_input_Keyboard.cpp 1 Jun 2003 17:20:03 -0000 1.23 +++ org_lwjgl_input_Keyboard.cpp 7 Jun 2003 13:56:05 -0000 1.24 @@ -299,10 +299,11 @@ * Method: nEnableTranslation * Signature: ()I */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation +JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation (JNIEnv *env, jclass clazz) { translation_enabled = true; + return JNI_TRUE; } /* |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-07 12:49:59
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv1905/src/native/win32 Modified Files: org_lwjgl_input_Mouse.cpp Log Message: Early exit on failed mouse read. Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- org_lwjgl_input_Mouse.cpp 20 May 2003 12:20:13 -0000 1.21 +++ org_lwjgl_input_Mouse.cpp 7 Jun 2003 12:49:55 -0000 1.22 @@ -61,10 +61,10 @@ static jfieldID fidMDX; static jfieldID fidMDY; static jfieldID fidMDWheel; -static jfieldID fidMHasWheel; - -static POINT cursorPos; -static RECT windowRect; +static jfieldID fidMHasWheel; + +static POINT cursorPos; +static RECT windowRect; static bool usingNativeCursor; // Function prototypes (defined in the cpp file, since header file is generic across platforms @@ -78,16 +78,16 @@ void UpdateMouseFields(); void SetMouseCapabilities(); -static void getScreenClientRect(RECT* clientRect, RECT* windowRect) -{ - GetClientRect(hwnd, clientRect); - // transform clientRect to screen coordinates - clientRect->top = -clientSize.top + windowRect->top; - clientRect->left = -clientSize.left + windowRect->left; - clientRect->bottom += clientRect->top; - clientRect->right += clientRect->left; -} - +static void getScreenClientRect(RECT* clientRect, RECT* windowRect) +{ + GetClientRect(hwnd, clientRect); + // transform clientRect to screen coordinates + clientRect->top = -clientSize.top + windowRect->top; + clientRect->left = -clientSize.left + windowRect->left; + clientRect->bottom += clientRect->top; + clientRect->right += clientRect->left; +} + /** * Initializes any field ids */ @@ -103,12 +103,12 @@ * Called when the Mouse instance is to be created */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv *env, jclass clazz) { - HRESULT hr; + HRESULT hr; mEnvironment = env; clsMouse = clazz; - - ShowCursor(FALSE); + + ShowCursor(FALSE); CacheMouseFields(); /* skip enumeration, since we only want system mouse */ @@ -126,7 +126,7 @@ ShutdownMouse(); return JNI_FALSE; } - /* Do setup of Mouse */ + /* Do setup of Mouse */ SetupMouse(); /* Set capabilities */ @@ -143,94 +143,94 @@ #if _DEBUG printf("Failed to acquire mouse\n"); #endif - } + } return mCreate_success ? JNI_TRUE : JNI_FALSE; } -/* - * Class: org_lwjgl_input_Mouse - * Method: nIsNativeCursorSupported - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps - (JNIEnv *env, jclass clazz) -{ - return org_lwjgl_input_Mouse_CURSOR_ONE_BIT_TRANSPARANCY; -} - -/* - * Class: org_lwjgl_input_Mouse - * Method: nSetNativeCursor - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor - (JNIEnv *env, jclass clazz, jint cursor_handle) -{ - if (cursor_handle != NULL) { - if (mDIDevice == NULL) - throwException(env, "null device!"); - mDIDevice->Unacquire(); - if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { -#if _DEBUG - printf("SetCooperativeLevel failed\n"); -#endif - throwException(env, "Could not set the CooperativeLevel."); - return; - } - HCURSOR cursor = (HCURSOR)cursor_handle; - SetClassLong(hwnd, GCL_HCURSOR, (LONG)cursor); - SetCursor(cursor); - if (!usingNativeCursor) { - /* Reset cursor position to 0, 0 */ - RECT clientRect; - GetWindowRect(hwnd, &windowRect); - getScreenClientRect(&clientRect, &windowRect); - SetCursorPos(clientRect.left, clientRect.top); - cursorPos.x = clientRect.left; - cursorPos.y = clientRect.top; - ShowCursor(TRUE); - usingNativeCursor = true; - } - } else { - if (usingNativeCursor) { - SetClassLong(hwnd, GCL_HCURSOR, (LONG)NULL); - SetCursor(NULL); - mDIDevice->Unacquire(); - if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { -#if _DEBUG - printf("SetCooperativeLevel failed\n"); -#endif - throwException(env, "Could not set the CooperativeLevel."); - return; - } - ShowCursor(FALSE); - usingNativeCursor = false; - } - } -} - -/* - * Class: org_lwjgl_input_Mouse - * Method: nGetMaxCursorSize - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMaxCursorSize - (JNIEnv *env, jclass clazz) -{ - return GetSystemMetrics(SM_CXCURSOR); -} - -/* - * Class: org_lwjgl_input_Mouse - * Method: nGetMaxCursorSize - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize - (JNIEnv *env, jclass clazz) -{ - return GetSystemMetrics(SM_CXCURSOR); -} - +/* + * Class: org_lwjgl_input_Mouse + * Method: nIsNativeCursorSupported + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps + (JNIEnv *env, jclass clazz) +{ + return org_lwjgl_input_Mouse_CURSOR_ONE_BIT_TRANSPARANCY; +} + +/* + * Class: org_lwjgl_input_Mouse + * Method: nSetNativeCursor + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor + (JNIEnv *env, jclass clazz, jint cursor_handle) +{ + if (cursor_handle != NULL) { + if (mDIDevice == NULL) + throwException(env, "null device!"); + mDIDevice->Unacquire(); + if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { +#if _DEBUG + printf("SetCooperativeLevel failed\n"); +#endif + throwException(env, "Could not set the CooperativeLevel."); + return; + } + HCURSOR cursor = (HCURSOR)cursor_handle; + SetClassLong(hwnd, GCL_HCURSOR, (LONG)cursor); + SetCursor(cursor); + if (!usingNativeCursor) { + /* Reset cursor position to 0, 0 */ + RECT clientRect; + GetWindowRect(hwnd, &windowRect); + getScreenClientRect(&clientRect, &windowRect); + SetCursorPos(clientRect.left, clientRect.top); + cursorPos.x = clientRect.left; + cursorPos.y = clientRect.top; + ShowCursor(TRUE); + usingNativeCursor = true; + } + } else { + if (usingNativeCursor) { + SetClassLong(hwnd, GCL_HCURSOR, (LONG)NULL); + SetCursor(NULL); + mDIDevice->Unacquire(); + if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { +#if _DEBUG + printf("SetCooperativeLevel failed\n"); +#endif + throwException(env, "Could not set the CooperativeLevel."); + return; + } + ShowCursor(FALSE); + usingNativeCursor = false; + } + } +} + +/* + * Class: org_lwjgl_input_Mouse + * Method: nGetMaxCursorSize + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMaxCursorSize + (JNIEnv *env, jclass clazz) +{ + return GetSystemMetrics(SM_CXCURSOR); +} + +/* + * Class: org_lwjgl_input_Mouse + * Method: nGetMaxCursorSize + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize + (JNIEnv *env, jclass clazz) +{ + return GetSystemMetrics(SM_CXCURSOR); +} + /* * Class: org_lwjgl_input_Mouse * Method: nDestroy @@ -239,7 +239,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv *env, jclass clazz) { mEnvironment = env; clsMouse = clazz; - ShowCursor(FALSE); + ShowCursor(FALSE); ShutdownMouse(); } @@ -350,40 +350,40 @@ return; } mCreate_success = true; -} - -static void getGDICursorDelta(int* return_dx, int* return_dy) { - int dx = 0; - int dy = 0; - - POINT newCursorPos; - GetCursorPos(&newCursorPos); - RECT clientRect; - RECT newWindowRect; - GetWindowRect(hwnd, &newWindowRect); - cursorPos.x += newWindowRect.left - windowRect.left; - cursorPos.y += newWindowRect.top - windowRect.top; - windowRect = newWindowRect; - getScreenClientRect(&clientRect, &windowRect); - // Clip the position to the client rect - if (newCursorPos.x < clientRect.right && newCursorPos.x >= clientRect.left && - newCursorPos.y < clientRect.bottom && newCursorPos.y >= clientRect.top) { - dx = newCursorPos.x - cursorPos.x; - dy = newCursorPos.y - cursorPos.y; - cursorPos.x += dx; - cursorPos.y += dy; - } - *return_dx = dx; - *return_dy = dy; -} - +} + +static void getGDICursorDelta(int* return_dx, int* return_dy) { + int dx = 0; + int dy = 0; + + POINT newCursorPos; + GetCursorPos(&newCursorPos); + RECT clientRect; + RECT newWindowRect; + GetWindowRect(hwnd, &newWindowRect); + cursorPos.x += newWindowRect.left - windowRect.left; + cursorPos.y += newWindowRect.top - windowRect.top; + windowRect = newWindowRect; + getScreenClientRect(&clientRect, &windowRect); + // Clip the position to the client rect + if (newCursorPos.x < clientRect.right && newCursorPos.x >= clientRect.left && + newCursorPos.y < clientRect.bottom && newCursorPos.y >= clientRect.top) { + dx = newCursorPos.x - cursorPos.x; + dy = newCursorPos.y - cursorPos.y; + cursorPos.x += dx; + cursorPos.y += dy; + } + *return_dx = dx; + *return_dy = dy; +} + /** * Updates the fields on the Mouse */ void UpdateMouseFields() { HRESULT hRes; - DIMOUSESTATE diMouseState; // State of Mouse - int dx, dy; + DIMOUSESTATE diMouseState; // State of Mouse + int dx, dy; // get data from the Mouse hRes = mDIDevice->GetDeviceState(sizeof(DIMOUSESTATE), &diMouseState); @@ -404,15 +404,18 @@ printf("Error getting mouse state: %d\n", hRes); #endif } - } - - if (usingNativeCursor) { - getGDICursorDelta(&dx, &dy); - } else { - dx = diMouseState.lX; - dy = diMouseState.lY; - } - + + // Leave anyway and come back next time + return; + } + + if (usingNativeCursor) { + getGDICursorDelta(&dx, &dy); + } else { + dx = diMouseState.lX; + dy = diMouseState.lY; + } + mEnvironment->SetStaticIntField(clsMouse, fidMDX, (jint)dx); mEnvironment->SetStaticIntField(clsMouse, fidMDY, (jint)dy); mEnvironment->SetStaticIntField(clsMouse, fidMDWheel, (jint)diMouseState.lZ); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-07 12:48:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv1389/src/native/win32 Modified Files: org_lwjgl_Window.cpp Log Message: Minor tweaks to window creation. 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.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_Window.cpp 4 Jun 2003 22:10:24 -0000 1.10 +++ org_lwjgl_Window.cpp 7 Jun 2003 12:48:21 -0000 1.11 @@ -271,10 +271,10 @@ int exstyle, windowflags; if (fullscreen) { - exstyle = WS_EX_TOPMOST; + exstyle = WS_EX_APPWINDOW | WS_EX_TOPMOST; windowflags = WS_POPUP | WS_VISIBLE; } else { - exstyle = 0; + exstyle = WS_EX_APPWINDOW; windowflags = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_VISIBLE | WS_MINIMIZEBOX | WS_SYSMENU; } @@ -313,8 +313,8 @@ printf("Created window\n"); #endif - //ShowWindow(hwnd, SW_SHOWNORMAL); - ShowWindow(hwnd, SW_SHOW); + ShowWindow(hwnd, SW_SHOWNORMAL); + //ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); SetForegroundWindow(hwnd); SetFocus(hwnd); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-07 12:47:38
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv1176/src/native/win32 Modified Files: org_lwjgl_input_Keyboard.cpp Log Message: Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- org_lwjgl_input_Keyboard.cpp 16 May 2003 18:39:46 -0000 1.17 +++ org_lwjgl_input_Keyboard.cpp 7 Jun 2003 12:47:35 -0000 1.18 @@ -47,7 +47,7 @@ #include "org_lwjgl_input_Keyboard.h" #include "Window.h" -#define KEYBOARD_BUFFER_SIZE 50 +#define KEYBOARD_BUFFER_SIZE 50 static BYTE readBuffer[KEYBOARD_BUFFER_SIZE*4]; static LPDIRECTINPUTDEVICE lpdiKeyboard = NULL; @@ -63,13 +63,14 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_initIDs (JNIEnv * env, jclass clazz) { + /* // Get a global class instance, just to be sure static jobject globalClassLock = NULL; if (globalClassLock == NULL) { globalClassLock = env->NewGlobalRef(clazz); } - + */ fid_readBuffer = env->GetStaticFieldID(clazz, "readBuffer", "Ljava/nio/ByteBuffer;"); } @@ -208,17 +209,23 @@ if (ret == DI_OK) { unsigned char * buf = readBuffer; +//#ifdef _DEBUG +// if (bufsize > 0) { +// printf("Got %d keyboard events.\n", bufsize); +// } +//#endif for (unsigned int i = 0; i < bufsize; i ++) { num_events++; *buf++ = (unsigned char) rgdod[i].dwOfs; *buf++ = (unsigned char) rgdod[i].dwData; if (translationEnabled) { - // Cas: shouldn't need to call handleMessages any more - // handleMessages(); UINT virt_key = MapVirtualKey(rgdod[i].dwOfs, 1); if (virt_key != 0) { - if (!GetKeyboardState(state)) - return 0; + if (!GetKeyboardState(state)) { + *buf++ = 0; + *buf++ = 0; + continue; + } num_chars = ToUnicode(virt_key, rgdod[i].dwOfs, state, @@ -283,10 +290,23 @@ * Method: nEnableTranslation * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation +JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation (JNIEnv *, jclass) { - translationEnabled = true; + // We can't do translation on DOS boxes it seems so we'll have to throw a wobbler + // here: + OSVERSIONINFO osvi; + + osvi.dwOSVersionInfoSize = sizeof(osvi); + GetVersionEx(&osvi); + + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { + translationEnabled = true; + return JNI_TRUE; + } else { + translationEnabled = false; + return JNI_FALSE; + } } /* |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-07 12:47:35
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv1106/src/native/common Modified Files: org_lwjgl_input_Keyboard.h Log Message: Index: org_lwjgl_input_Keyboard.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Keyboard.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_input_Keyboard.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- org_lwjgl_input_Keyboard.h 11 Jan 2003 23:09:08 -0000 1.2 +++ org_lwjgl_input_Keyboard.h 7 Jun 2003 12:47:19 -0000 1.3 @@ -313,7 +313,7 @@ * Method: nEnableTranslation * Signature: ()V */ -JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation +JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Keyboard_nEnableTranslation (JNIEnv *, jclass); /* |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-07 12:47:12
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1:/tmp/cvs-serv1027/src/java/org/lwjgl/input Modified Files: Keyboard.java Log Message: Index: Keyboard.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Keyboard.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Keyboard.java 8 May 2003 21:27:12 -0000 1.21 +++ Keyboard.java 7 Jun 2003 12:47:08 -0000 1.22 @@ -344,18 +344,20 @@ /** * Enable keyboard translation. Must be called after the keyboard is created, * and keyboard buffering must be enabled. + * @return false if translation cannot be enabled; true if it can */ - public static void enableTranslation() { + public static boolean enableTranslation() { assert created : "The keyboard has not been created."; assert readBuffer != null : "Keyboard buffering has not been enabled."; - nEnableTranslation(); - translationEnabled = true; + + translationEnabled = nEnableTranslation(); + return translationEnabled; } /** * Native method to enable the translation buffer */ - private static native void nEnableTranslation(); + private static native boolean nEnableTranslation(); /** * Enable keyboard buffering. Must be called after the keyboard is created. |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-07 12:47:12
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv1027/src/java/org/lwjgl Modified Files: Window.java Log Message: 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.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Window.java 4 Jun 2003 21:49:46 -0000 1.10 +++ Window.java 7 Jun 2003 12:47:08 -0000 1.11 @@ -120,6 +120,7 @@ * @param newTitle The new window title */ public final void setTitle(String newTitle) { + assert isCreated(); title = newTitle; nSetTitle(title); } @@ -134,6 +135,7 @@ * @return true if the user or operating system has asked the window to close */ public final boolean isCloseRequested() { + assert isCreated(); return closeRequested; } @@ -141,6 +143,7 @@ * @return true if the window is minimized or otherwise not visible */ public final boolean isMinimized() { + assert isCreated(); return minimized; } @@ -172,6 +175,7 @@ * and needs to repaint itself */ public final boolean isDirty() { + assert isCreated(); return dirty; } @@ -179,6 +183,7 @@ * Paint the window. This clears the dirty flag and swaps the buffers. */ public final void paint() { + assert isCreated(); dirty = false; doPaint(); } @@ -194,7 +199,8 @@ doCreate(); currentWindow = this; created = true; - } + + } /** * Create the window (derived classes). @@ -205,7 +211,7 @@ /** * Destroy the window. */ - public final synchronized void destroy() { + public final void destroy() { if (!created) return; doDestroy(); @@ -237,16 +243,7 @@ * 'Tick' the window. This must be called at least once per video frame * to handle window close requests, moves, paints, etc. */ - public final native void tick(); - - /* (non-Javadoc) - * @see java.lang.Object#finalize() - */ - protected void finalize() throws Throwable { - super.finalize(); - - destroy(); - } + public native void tick(); /* (non-Javadoc) * @see java.lang.Object#toString() |
|
From: Elias N. <eli...@us...> - 2003-06-07 11:53:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1:/tmp/cvs-serv17977 Modified Files: Cursor.java Log Message: Doc update Index: Cursor.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Cursor.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Cursor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Cursor.java 20 May 2003 12:20:11 -0000 1.4 +++ Cursor.java 7 Jun 2003 11:53:17 -0000 1.5 @@ -59,7 +59,8 @@ * Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create * Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported. * So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values. - * + * The constructor will copy the images and delays, so there's no need to keep them around. + * * @param width cursor image width * @param height cursor image height * @param xHotspot the x coordinate of the cursor hotspot |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-06-04 22:10:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv26802/src/native/win32 Modified Files: org_lwjgl_opengl_BaseGL.cpp org_lwjgl_Window.cpp Log Message: 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.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- org_lwjgl_opengl_BaseGL.cpp 20 May 2003 12:20:13 -0000 1.21 +++ org_lwjgl_opengl_BaseGL.cpp 4 Jun 2003 22:10:23 -0000 1.22 @@ -47,89 +47,89 @@ HGLRC hglrc = NULL; // OpenGL rendering context -static int findPixelFormat(JNIEnv *env, unsigned int flags, int bpp, int alpha, int depth, int stencil) { - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd - 1, // version number - flags, // RGBA type - PFD_TYPE_RGBA, - (BYTE)bpp, - 0, 0, 0, 0, 0, 0, // color bits ignored - (BYTE)alpha, - 0, // shift bit ignored - 0, // no accumulation buffer - 0, 0, 0, 0, // accum bits ignored - (BYTE)depth, - (BYTE)stencil, - 0, // No auxiliary buffer - PFD_MAIN_PLANE, // main layer - 0, // reserved - 0, 0, 0 // layer masks ignored - }; - - // get the best available match of pixel format for the device context - int iPixelFormat = ChoosePixelFormat(hdc, &pfd); - if (iPixelFormat == 0) { - throwException(env, "Failed to choose pixel format"); - return -1; - } - -#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"); - throwException(env, "Failed to choose pixel format"); - return -1; - } - - // 3. Check the chosen format matches or exceeds our specifications - PIXELFORMATDESCRIPTOR desc; - if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { - throwException(env, "Could not describe pixel format"); - return -1; - } - - if (desc.cColorBits < bpp) { - throwException(env, "This application requires a greater colour depth"); - return -1; - } - - if (desc.cAlphaBits < alpha) { - throwException(env, "This application requires a greater alpha depth"); - return -1; - } - - if (desc.cStencilBits < stencil) { - throwException(env, "This application requires a greater stencil depth"); - return -1; - } - - if (desc.cDepthBits < depth) { - throwException(env, "This application requires a greater depth buffer depth"); - return -1; - } - - if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0 || (desc.dwFlags & PFD_GENERIC_ACCELERATED) != 0) { - throwException(env, "Mode not supported by hardware"); - return -1; - } - - if ((desc.dwFlags & flags) != flags) { - throwException(env, "Capabilities not supported"); - return -1; - } - - // 4. Initialise other things now - if (extgl_Open() != 0) { - throwException(env, "Failed to open extgl"); - return -1; - } - return iPixelFormat; -} - +static int findPixelFormat(JNIEnv *env, unsigned int flags, int bpp, int alpha, int depth, int stencil) { + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), // size of this pfd + 1, // version number + flags, // RGBA type + PFD_TYPE_RGBA, + (BYTE)bpp, + 0, 0, 0, 0, 0, 0, // color bits ignored + (BYTE)alpha, + 0, // shift bit ignored + 0, // no accumulation buffer + 0, 0, 0, 0, // accum bits ignored + (BYTE)depth, + (BYTE)stencil, + 0, // No auxiliary buffer + PFD_MAIN_PLANE, // main layer + 0, // reserved + 0, 0, 0 // layer masks ignored + }; + + // get the best available match of pixel format for the device context + int iPixelFormat = ChoosePixelFormat(hdc, &pfd); + if (iPixelFormat == 0) { + throwException(env, "Failed to choose pixel format"); + return -1; + } + +#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"); + throwException(env, "Failed to choose pixel format"); + return -1; + } + + // 3. Check the chosen format matches or exceeds our specifications + PIXELFORMATDESCRIPTOR desc; + if (DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &desc) == 0) { + throwException(env, "Could not describe pixel format"); + return -1; + } + + if (desc.cColorBits < bpp) { + throwException(env, "This application requires a greater colour depth"); + return -1; + } + + if (desc.cAlphaBits < alpha) { + throwException(env, "This application requires a greater alpha depth"); + return -1; + } + + if (desc.cStencilBits < stencil) { + throwException(env, "This application requires a greater stencil depth"); + return -1; + } + + if (desc.cDepthBits < depth) { + throwException(env, "This application requires a greater depth buffer depth"); + return -1; + } + + if ((desc.dwFlags & PFD_GENERIC_FORMAT) != 0 || (desc.dwFlags & PFD_GENERIC_ACCELERATED) != 0) { + throwException(env, "Mode not supported by hardware"); + return -1; + } + + if ((desc.dwFlags & flags) != flags) { + throwException(env, "Capabilities not supported"); + return -1; + } + + // 4. Initialise other things now + if (extgl_Open() != 0) { + throwException(env, "Failed to open extgl"); + return -1; + } + return iPixelFormat; +} + /* * Class: org_lwjgl_opengl_BaseGL * Method: nCreate @@ -155,12 +155,12 @@ unsigned int flags = PFD_DRAW_TO_WINDOW | // support window PFD_SUPPORT_OPENGL | // support OpenGL PFD_DOUBLEBUFFER; // double buffered - - int iPixelFormat = findPixelFormat(env, flags, bpp, alpha, depth, stencil); - if (iPixelFormat == -1) { - closeWindow(); - return; - } + + int iPixelFormat = findPixelFormat(env, flags, bpp, alpha, depth, stencil); + if (iPixelFormat == -1) { + closeWindow(); + return; + } // Create a rendering context hglrc = wglCreateContext(hdc); if (hglrc == NULL) { @@ -214,5 +214,5 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_swapBuffers (JNIEnv *, jobject) { - SwapBuffers(wglGetCurrentDC()); + wglSwapLayerBuffers(hdc, WGL_SWAP_MAIN_PLANE); } 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.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- org_lwjgl_Window.cpp 20 May 2003 12:20:13 -0000 1.9 +++ org_lwjgl_Window.cpp 4 Jun 2003 22:10:24 -0000 1.10 @@ -313,7 +313,8 @@ printf("Created window\n"); #endif - ShowWindow(hwnd, SW_SHOWNORMAL); + //ShowWindow(hwnd, SW_SHOWNORMAL); + ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); SetForegroundWindow(hwnd); SetFocus(hwnd); @@ -389,4 +390,32 @@ (JNIEnv * env, jobject obj) { handleMessages(env, obj); +} + + +/* + * Class: org_lwjgl_Window + * Method: minimize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_Window_minimize + (JNIEnv * env, jobject obj) +{ + if (isMinimized) + return; + ShowWindow(hwnd, SW_MINIMIZE); +} + +/* + * Class: org_lwjgl_Window + * Method: minimize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_Window_restore + (JNIEnv * env, jobject obj) +{ + if (!isMinimized) + return; + + ShowWindow(hwnd, SW_RESTORE); } |