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
|
|
2
(1) |
3
(3) |
4
(2) |
5
(18) |
6
|
7
|
8
|
|
9
|
10
(3) |
11
(1) |
12
|
13
|
14
(5) |
15
|
|
16
|
17
|
18
(4) |
19
(1) |
20
|
21
|
22
|
|
23
(31) |
24
|
25
(1) |
26
(2) |
27
|
28
|
29
|
|
30
|
31
(5) |
|
|
|
|
|
|
From: Elias N. <eli...@us...> - 2004-05-05 14:41:14
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31076/linux Modified Files: org_lwjgl_Display.cpp Log Message: Fixed linux building Index: org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- org_lwjgl_Display.cpp 5 May 2004 14:28:38 -0000 1.48 +++ org_lwjgl_Display.cpp 5 May 2004 14:41:04 -0000 1.49 @@ -1,4 +1,4 @@ - * Copyright (c) 2002 Light Weight Java Game Library Project + /* Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:35:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29782/src/java/org/lwjgl/examples Modified Files: Game.java Log Message: Index: Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples/Game.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Game.java 5 May 2004 14:28:38 -0000 1.2 +++ Game.java 5 May 2004 14:35:05 -0000 1.3 @@ -52,7 +52,7 @@ public static final String GAME_TITLE = "My Game"; /** Desired frame time */ - private static final float FRAMETIME = 1.0f / 60.0f; + private static final int FRAMERATE = 60; /** Exit the game */ private static boolean finished; @@ -111,7 +111,7 @@ // The window is in the foreground, so we should play the game logic(); render(); - org.lwjgl.Display.sync(FRAMETIME); + org.lwjgl.Display.sync(FRAMERATE); } else { // The window is not in the foreground, so we can allow other stuff to run and // infrequently update |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:34:36
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29596/src/java/org/lwjgl Modified Files: Display.java Log Message: duh Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- Display.java 5 May 2004 14:33:03 -0000 1.46 +++ Display.java 5 May 2004 14:34:26 -0000 1.47 @@ -237,7 +237,7 @@ public static void sync(int fps) { float frameTime = 1.0f / (float) fps; timeNow = Sys.getTime(); - while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameRate) { + while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameTime) { // This is a system-friendly way of allowing other stuff to use CPU if it wants to Thread.yield(); timeNow = Sys.getTime(); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:33:12
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29342/src/java/org/lwjgl Modified Files: Display.java Log Message: Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- Display.java 5 May 2004 14:28:37 -0000 1.45 +++ Display.java 5 May 2004 14:33:03 -0000 1.46 @@ -232,12 +232,11 @@ /** * Synchronize the display to a capped frame rate. - * @param frameTime The desired frame time in seconds + * @param fps The desired frame rate, in frames per second */ - public static void sync(float frameRate) { + public static void sync(int fps) { + float frameTime = 1.0f / (float) fps; timeNow = Sys.getTime(); - System.out.println(Sys.getTimerResolution()); - System.out.println(timeNow+" "+timeThen+" "+((float) (timeNow - timeThen) / (float) Sys.getTimerResolution())); while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameRate) { // This is a system-friendly way of allowing other stuff to use CPU if it wants to Thread.yield(); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:29:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/java/org/lwjgl/opengl Modified Files: Window.java Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: Window.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/Window.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- Window.java 7 Apr 2004 07:55:42 -0000 1.46 +++ Window.java 5 May 2004 14:28:37 -0000 1.47 @@ -511,23 +511,6 @@ private static native void nUpdate(); /** - * Determines to the best of the platform's ability whether monitor vysnc is enabled on - * this window. The failsafe assumption is that when vsync cannot be determined, this - * method returns false, and you should rely on using a hires timer to throttle your - * framerate rather than relying on monitor sync (even if monitor sync is actually working). - * Therefore you can guarantee that if we return true from this method that we're pretty - * certain vsync is enabled. - * @return boolean - */ - public static boolean isVSyncEnabled() { - if (!isCreated()) - throw new IllegalStateException("Cannot determine vsync state of uncreated window"); - return nIsVSyncEnabled(); - } - - private static native boolean nIsVSyncEnabled(); - - /** * Enable or disable vertical monitor synchronization. This call is a best-attempt at changing * the vertical refresh synchronization of the monitor, and is not guaranteed to be successful. * To check whether the call <em>might</em> have been successful, call isVSyncEnabled(). |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:29:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/java/org/lwjgl/input Modified Files: Cursor.java Mouse.java Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: Cursor.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Cursor.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- Cursor.java 12 Apr 2004 14:37:20 -0000 1.24 +++ Cursor.java 5 May 2004 14:28:37 -0000 1.25 @@ -36,9 +36,8 @@ import java.nio.ByteOrder; import java.nio.IntBuffer; -import org.lwjgl.Display; -import org.lwjgl.Sys; import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; /** * $Id$ @@ -108,28 +107,25 @@ // Win32 or X and do accordingly. This hasn't been implemented on Mac, but we // might want to split it into a X/Win/Mac cursor if it gets too cluttered - switch(Display.getPlatform()) { - case Display.PLATFORM_GLX: - // create our cursor elements - cursors = new CursorElement[1]; - cursors[0] = new CursorElement(); - cursors[0].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images_copy, images_copy.position(), delays, delays != null ? delays.position() : -1); - break; - case Display.PLATFORM_WGL: - // create our cursor elements - cursors = new CursorElement[numImages]; - for(int i=0; i<numImages; i++) { - cursors[i] = new CursorElement(); - cursors[i].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, 1, images_copy, images_copy.position(), null, 0); - cursors[i].delay = (delays != null) ? delays.get(i) : 0; - cursors[i].timeout = System.currentTimeMillis(); - - // offset to next image - images_copy.position(width*height*(i+1)); - } - break; - case Display.PLATFORM_AGL: - break; + String osName = System.getProperty("os.name", ""); + if (osName.startsWith("Win")) { + // create our cursor elements + cursors = new CursorElement[numImages]; + for(int i=0; i<numImages; i++) { + cursors[i] = new CursorElement(); + cursors[i].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, 1, images_copy, images_copy.position(), null, 0); + cursors[i].delay = (delays != null) ? delays.get(i) : 0; + cursors[i].timeout = System.currentTimeMillis(); + + // offset to next image + images_copy.position(width*height*(i+1)); + } + } else if (osName.startsWith("Lin")) { + // create our cursor elements + cursors = new CursorElement[1]; + cursors[0] = new CursorElement(); + cursors[0].cursorHandle = nCreateCursor(width, height, xHotspot, yHotspot, numImages, images_copy, images_copy.position(), delays, delays != null ? delays.position() : -1); + } else { } } Index: Mouse.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- Mouse.java 12 Apr 2004 14:46:17 -0000 1.53 +++ Mouse.java 5 May 2004 14:28:37 -0000 1.54 @@ -38,10 +38,9 @@ import java.util.Map; import org.lwjgl.BufferUtils; -import org.lwjgl.Display; +import org.lwjgl.LWJGLException; import org.lwjgl.Sys; import org.lwjgl.opengl.Window; -import org.lwjgl.LWJGLException; /** * $Id$ @@ -568,7 +567,7 @@ * shouldn't be called otherwise */ public static void updateCursor() { - if (Display.getPlatform() == Display.PLATFORM_WGL && currentCursor != null && currentCursor.hasTimedOut()) { + if (System.getProperty("os.name").startsWith("Win") && currentCursor != null && currentCursor.hasTimedOut()) { currentCursor.nextCursor(); try { setNativeCursor(currentCursor); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:29:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/native/win32 Modified Files: org_lwjgl_Sys.cpp org_lwjgl_opengl_Window.cpp Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- org_lwjgl_opengl_Window.cpp 5 May 2004 09:53:53 -0000 1.30 +++ org_lwjgl_opengl_Window.cpp 5 May 2004 14:28:37 -0000 1.31 @@ -58,7 +58,6 @@ RECT clientSize; static bool closerequested; -static jboolean vsync; static jboolean allowSoftwareOpenGL; // Whether to allow software opengl //CAS: commented these out as no longer used @@ -471,7 +470,6 @@ isDirty = true; isFullScreen = fullscreen == JNI_TRUE; isUndecorated = getBooleanProperty(env, "org.lwjgl.opengl.Window.undecorated"); - vsync = JNI_FALSE; // Speacial option for allowing software opengl allowSoftwareOpenGL = getBooleanProperty(env, "org.lwjgl.opengl.Window.allowSoftwareOpenGL"); @@ -588,17 +586,6 @@ /* * Class: org_lwjgl_opengl_Window - * Method: nIsVSyncEnabled - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVSyncEnabled - (JNIEnv * env, jclass clazz) -{ - return vsync; -} - -/* - * Class: org_lwjgl_opengl_Window * Method: nSetVSyncEnabled * Signature: (Z)Z */ @@ -611,7 +598,6 @@ } else { wglSwapIntervalEXT(0); } - vsync = sync; } } Index: org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- org_lwjgl_Sys.cpp 5 May 2004 13:26:21 -0000 1.24 +++ org_lwjgl_Sys.cpp 5 May 2004 14:28:37 -0000 1.25 @@ -46,9 +46,8 @@ // Handle to the application's window extern HWND hwnd; -unsigned __int64 hires_timer_freq; // Hires timer frequency -unsigned __int64 hires_timer_start; // Hires timer start -unsigned __int64 hires_timer; // Hires timer current time +unsigned __int64 hires_timer_freq = 0; // Hires timer frequency +unsigned __int64 hires_timer = 0; // Hires timer current time /* * Class: org_lwjgl_Sys @@ -58,7 +57,8 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution (JNIEnv * env, jclass clazz) { - return hires_timer_freq; + QueryPerformanceFrequency((LARGE_INTEGER*) &hires_timer_freq); + return (jlong) hires_timer_freq; } JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebug(JNIEnv *env, jclass clazz, jboolean enabled) { @@ -71,28 +71,14 @@ /* * Class: org_lwjgl_Sys - * Method: getTime + * Method: ngetTime * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime +JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime (JNIEnv * env, jclass clazz) { QueryPerformanceCounter((LARGE_INTEGER*) &hires_timer); - hires_timer -= hires_timer_start; - return hires_timer; -} - -/* - * Class: org_lwjgl_Sys - * Method: setTime - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime - (JNIEnv * env, jclass clazz, jlong startTime) -{ - QueryPerformanceFrequency((LARGE_INTEGER*) &hires_timer_freq); - QueryPerformanceCounter((LARGE_INTEGER*) &hires_timer_start); - hires_timer_start -= startTime; + return (jlong) hires_timer; } /* |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/native/macosx Modified Files: org_lwjgl_opengl_Window.cpp org_lwjgl_Display.cpp org_lwjgl_Sys.cpp Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- org_lwjgl_opengl_Window.cpp 18 Apr 2004 03:20:04 -0000 1.37 +++ org_lwjgl_opengl_Window.cpp 5 May 2004 14:28:39 -0000 1.38 @@ -1,35 +1,35 @@ -/* +/* * 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 + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * 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 + * * 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 + * 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 + * 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$ * @@ -49,7 +49,7 @@ static CGLContextObj context; static bool vsync_enabled; static bool current_fullscreen; - + static void destroyMode(JNIEnv *env, jclass clazz) { if (!current_fullscreen) resetMode(env); @@ -162,7 +162,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_swapBuffers(JNIEnv * env, jclass clazz) { CGLFlushDrawable(context); } - + JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_minimize(JNIEnv *env, jclass clazz) { } @@ -185,10 +185,6 @@ return JNI_FALSE; } -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVSyncEnabled(JNIEnv *env, jclass clazz) { - return vsync_enabled; -} - JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVisible(JNIEnv *env, jclass clazz) { return JNI_TRUE; } Index: org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Display.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- org_lwjgl_Display.cpp 6 Nov 2003 14:30:24 -0000 1.27 +++ org_lwjgl_Display.cpp 5 May 2004 14:28:39 -0000 1.28 @@ -189,9 +189,6 @@ return ret; } -JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getPlatform(JNIEnv * env, jclass clazz) { - return org_lwjgl_Display_PLATFORM_AGL; -} JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) { return GAMMARAMP_LENGTH; Index: org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- org_lwjgl_Sys.cpp 27 Mar 2004 14:09:55 -0000 1.14 +++ org_lwjgl_Sys.cpp 5 May 2004 14:28:39 -0000 1.15 @@ -46,9 +46,7 @@ #include "org_lwjgl_Sys.h" #include "common_tools.h" -long int hires_timer_freq; // Hires timer frequency -long int hires_timer_start; // Hires timer start -long int hires_timer; // Hires timer current time +static long int hires_timer; // Hires timer current time /* * Class: org_lwjgl_Sys @@ -58,7 +56,8 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution (JNIEnv * env, jclass clazz) { - return hires_timer_freq; + // Constant on MacOS + return 1000000; } static long queryTime(void) { @@ -77,34 +76,20 @@ /* * Class: org_lwjgl_Sys - * Method: getTime + * Method: ngetTime * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime +JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime (JNIEnv * env, jclass clazz) { hires_timer = queryTime(); - hires_timer -= hires_timer_start; - return hires_timer; + return (jlong) hires_timer; } JNIEXPORT jstring JNICALL Java_org_lwjgl_Sys_getNativeLibraryVersion(JNIEnv *env, jclass clazz) { return getVersionString(env); } -/* - * Class: org_lwjgl_Sys - * Method: setTime - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime -(JNIEnv * env, jclass clazz, jlong startTime) -{ - hires_timer_start = queryTime(); - // We don't have a real resolution so assume highest possible - hires_timer_freq = 1000000; - hires_timer_start -= startTime; -} /* * Class: org_lwjgl_Sys |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/java/org/lwjgl/test Modified Files: DisplayTest.java Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: DisplayTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/DisplayTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DisplayTest.java 29 Jan 2004 19:57:47 -0000 1.1 +++ DisplayTest.java 5 May 2004 14:28:40 -0000 1.2 @@ -67,7 +67,6 @@ System.out.println("==== Test Current ===="); System.out.println("Info about current:"); - System.out.println("Platform: " + getNameForPlatform()); System.out.println("Graphics card: " + Display.getAdapter() + ", version: " + Display.getVersion()); System.out.println("Resolution: " + Display.getWidth() + "x" + @@ -229,24 +228,6 @@ } /** - * Returns a String representation of the platform - * - * @return String representation of the platform - */ - private String getNameForPlatform() { - switch (Display.getPlatform()) { - case Display.PLATFORM_WGL: - return "WGL"; - case Display.PLATFORM_GLX: - return "GLX"; - case Display.PLATFORM_AGL: - return "AGL"; - default: - return "Unknown platform"; - } - } - - /** * Tests the Sys class, and serves as basic usage test * * @param args ignored |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/native/common Modified Files: org_lwjgl_Sys.h Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: org_lwjgl_Sys.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- org_lwjgl_Sys.h 27 Mar 2004 14:09:54 -0000 1.21 +++ org_lwjgl_Sys.h 5 May 2004 14:28:39 -0000 1.22 @@ -45,22 +45,14 @@ /* * Class: org_lwjgl_Sys - * Method: getTime + * Method: ngetTime * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime +JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime (JNIEnv *, jclass); /* * Class: org_lwjgl_Sys - * Method: setTime - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime - (JNIEnv *, jclass, jlong); - -/* - * Class: org_lwjgl_Sys * Method: setProcessPriority * Signature: (I)V */ |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/java/org/lwjgl/test/opengl Modified Files: Game.java VBOTest.java VBOIndexTest.java Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: VBOIndexTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/VBOIndexTest.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- VBOIndexTest.java 4 Apr 2004 12:48:51 -0000 1.18 +++ VBOIndexTest.java 5 May 2004 14:28:38 -0000 1.19 @@ -196,8 +196,7 @@ * Initialize */ private static void init() throws Exception { - Sys.setTime(0); - Sys.setProcessPriority(Sys.HIGH_PRIORITY); + System.out.println("Timer resolution: " + Sys.getTimerResolution()); // Go into orthographic projection mode. GL11.glMatrixMode(GL11.GL_PROJECTION); Index: Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- Game.java 4 Apr 2004 12:48:51 -0000 1.32 +++ Game.java 5 May 2004 14:28:38 -0000 1.33 @@ -148,7 +148,6 @@ */ private static void init() throws Exception { - Sys.setTime(0); Sys.setProcessPriority(Sys.HIGH_PRIORITY); System.out.println("Timer resolution: " + Sys.getTimerResolution()); System.out.println("Number of texture units: " + Util.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS)); Index: VBOTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/VBOTest.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- VBOTest.java 4 Apr 2004 12:48:51 -0000 1.24 +++ VBOTest.java 5 May 2004 14:28:38 -0000 1.25 @@ -176,8 +176,6 @@ * Initialize */ private static void init() throws Exception { - Sys.setTime(0); - Sys.setProcessPriority(Sys.HIGH_PRIORITY); System.out.println("Timer resolution: " + Sys.getTimerResolution()); // Go into orthographic projection mode. GL11.glMatrixMode(GL11.GL_PROJECTION); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/java/org/lwjgl/openal Modified Files: AL.java Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: AL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/AL.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- AL.java 2 May 2004 15:46:55 -0000 1.22 +++ AL.java 5 May 2004 14:28:39 -0000 1.23 @@ -35,9 +35,8 @@ import java.lang.reflect.Method; import java.util.StringTokenizer; -import org.lwjgl.Display; -import org.lwjgl.Sys; import org.lwjgl.LWJGLException; +import org.lwjgl.Sys; /** * $Id$ @@ -141,18 +140,15 @@ String seperator = System.getProperty("path.separator"); String jwsLibname; - switch (Display.getPlatform()) { - case Display.PLATFORM_WGL: - jwsLibname = "lwjglaudio"; - break; - case Display.PLATFORM_GLX: - jwsLibname = "openal"; - break; - case Display.PLATFORM_AGL: - jwsLibname = "openal"; - break; - default: - throw new LWJGLException("Unknown platform"); + String osName = System.getProperty("os.name"); + if (osName.startsWith("Win")) { + jwsLibname = "lwjglaudio"; + } else if (osName.startsWith("Lin")) { + jwsLibname = "openal"; + } else if (osName.startsWith("Mac")) { + jwsLibname = "openal"; + } else { + throw new LWJGLException("Unknown platform: "+osName); } String jwsPath = getPathFromJWS(jwsLibname); |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:49
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/java/org/lwjgl/examples Modified Files: Game.java Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/examples/Game.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Game.java 16 Apr 2004 10:46:30 -0000 1.1 +++ Game.java 5 May 2004 14:28:38 -0000 1.2 @@ -109,18 +109,9 @@ finished = true; } else if (Window.isActive()) { // The window is in the foreground, so we should play the game - long timeThen = Sys.getTime(); logic(); render(); - // Stabilise the framerate if we haven't got vsync - if (!Window.isVSyncEnabled()) { - long timeNow = Sys.getTime(); - while ((float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < FRAMETIME) { - // This is a system-friendly way of allowing other stuff to use CPU if it wants to - Thread.yield(); - timeNow = Sys.getTime(); - } - } + org.lwjgl.Display.sync(FRAMETIME); } else { // The window is not in the foreground, so we can allow other stuff to run and // infrequently update |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:48
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/native/linux Modified Files: org_lwjgl_opengl_Window.cpp org_lwjgl_Display.cpp org_lwjgl_Sys.cpp Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- org_lwjgl_opengl_Window.cpp 13 Apr 2004 12:13:32 -0000 1.41 +++ org_lwjgl_opengl_Window.cpp 5 May 2004 14:28:38 -0000 1.42 @@ -613,12 +613,6 @@ return focused ? JNI_TRUE : JNI_FALSE; } -JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_Window_nIsVSyncEnabled - (JNIEnv * env, jclass clazz) -{ - return vsync_enabled; -} - JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nSetVSyncEnabled (JNIEnv * env, jclass clazz, jboolean sync) { Index: org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- org_lwjgl_Display.cpp 7 Apr 2004 07:46:03 -0000 1.47 +++ org_lwjgl_Display.cpp 5 May 2004 14:28:38 -0000 1.48 @@ -1,4 +1,3 @@ -/* * Copyright (c) 2002 Light Weight Java Game Library Project * All rights reserved. * @@ -60,7 +59,7 @@ static bool getVidModeExtensionVersion(Display *disp, int screen, int *major, int *minor) { int event_base, error_base; - + if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { printfDebug("XF86VidMode extension not available\n"); return false; @@ -139,7 +138,7 @@ if (disp == NULL) return; screen = DefaultScreen(disp); - + if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { printfDebug("Could not get display modes\n"); } @@ -215,10 +214,10 @@ if (disp == NULL) return NULL; - + screen = DefaultScreen(disp); int bpp = XDefaultDepth(disp, screen); - + if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { printfDebug("Could not get display modes\n"); decDisplay(); @@ -228,7 +227,7 @@ jclass displayModeClass = env->FindClass("org/lwjgl/DisplayMode"); jobjectArray ret = env->NewObjectArray(num_modes, displayModeClass, NULL); jmethodID displayModeConstructor = env->GetMethodID(displayModeClass, "<init>", "(IIII)V"); - + for (i = 0; i < num_modes; i++) { jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, bpp, 0); env->SetObjectArrayElement(ret, i, displayMode); @@ -238,10 +237,6 @@ return ret; } -JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getPlatform(JNIEnv * env, jclass clazz) { - return org_lwjgl_Display_PLATFORM_GLX; -} - JNIEXPORT jint JNICALL Java_org_lwjgl_Display_getGammaRampLength(JNIEnv *env, jclass clazz) { return gamma_ramp_length; } Index: org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- org_lwjgl_Sys.cpp 27 Mar 2004 14:09:54 -0000 1.24 +++ org_lwjgl_Sys.cpp 5 May 2004 14:28:38 -0000 1.25 @@ -45,8 +45,6 @@ #include "org_lwjgl_Sys.h" #include "common_tools.h" -static long int hires_timer_freq; // Hires timer frequency -static long int hires_timer_start; // Hires timer start static long int hires_timer; // Hires timer current time /* @@ -57,7 +55,8 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution (JNIEnv * env, jclass clazz) { - return hires_timer_freq; + // Constant on linux + return 1000000; } static long queryTime(void) { @@ -76,29 +75,14 @@ /* * Class: org_lwjgl_Sys - * Method: getTime + * Method: ngetTime * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTime +JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_ngetTime (JNIEnv * env, jclass clazz) { hires_timer = queryTime(); - hires_timer -= hires_timer_start; - return hires_timer; -} - -/* - * Class: org_lwjgl_Sys - * Method: setTime - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setTime - (JNIEnv * env, jclass clazz, jlong startTime) -{ - hires_timer_start = queryTime(); - // We don't have a real resolution so assume highest possible - hires_timer_freq = 1000000; - hires_timer_start -= startTime; + return (jlong) hires_timer; } /* |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 14:28:46
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28476/src/java/org/lwjgl Modified Files: Display.java Sys.java Log Message: Removed Sys.setTime(), Sys.getPlatform() Changed Sys.getTime() Added Display.sync() Index: Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- Display.java 27 Mar 2004 15:05:22 -0000 1.44 +++ Display.java 5 May 2004 14:28:37 -0000 1.45 @@ -59,20 +59,9 @@ /** Whether or not the display has been requested to shutdown by the user */ private static boolean closeRequested = false; - - /* - * Platforms. This will let you determine which platform you are running - * on, which is handy to know for some GL context calls. - */ - - /** Windows platform */ - public static final int PLATFORM_WGL = 0; - - /** GLX (Linux/Unix) platform */ - public static final int PLATFORM_GLX = 1; - - /** MacOSX platform */ - public static final int PLATFORM_AGL = 2; + + /** Timer for sync() */ + private static long timeNow, timeThen; static { Sys.initialize(); @@ -178,16 +167,6 @@ } /** - * Returns the operating system windowing platform. This will be one of the - * constants defined above. There is no "unknown" platform; a native library port - * has to provide a unique platform number for this mechanism to work. If the LWJGL - * is ported to, say, QNX, we will have a PLATFORM_QNX at the ready. - * - * @return the windowing system - */ - public static native int getPlatform(); - - /** * Set the display configuration to the specified gamma, brightness and contrast. * The configuration changes will be reset when resetDisplayMode is called. * @@ -250,5 +229,21 @@ * @return a String */ public static native String getVersion(); + + /** + * Synchronize the display to a capped frame rate. + * @param frameTime The desired frame time in seconds + */ + public static void sync(float frameRate) { + timeNow = Sys.getTime(); + System.out.println(Sys.getTimerResolution()); + System.out.println(timeNow+" "+timeThen+" "+((float) (timeNow - timeThen) / (float) Sys.getTimerResolution())); + while (timeNow > timeThen && (float) (timeNow - timeThen) / (float) Sys.getTimerResolution() < frameRate) { + // This is a system-friendly way of allowing other stuff to use CPU if it wants to + Thread.yield(); + timeNow = Sys.getTime(); + } + timeThen = timeNow; + } } Index: Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- Sys.java 27 Mar 2004 15:05:22 -0000 1.45 +++ Sys.java 5 May 2004 14:28:38 -0000 1.46 @@ -81,7 +81,7 @@ /** The native library name */ private static String LIBRARY_NAME = "lwjgl"; - /** The platform being executed on */ + /** The platform adapter class name */ private static String PLATFORM; /** @@ -131,13 +131,8 @@ throw new LinkageError("Version mismatch: jar version is '" + VERSION + "', native libary version is '" + native_version + "'"); setDebug(DEBUG); - setTime(0); - // check platform name, and default to awt - PLATFORM = System.getProperty("org.lwjgl.Sys.platform"); - if(PLATFORM == null) { - PLATFORM = "org.lwjgl.SwingAdapter"; - } + PLATFORM = System.getProperty("org.lwjgl.Sys.platform", "org.lwjgl.SwingAdapter"); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { @@ -173,20 +168,14 @@ /** * Gets the current value of the hires timer, in ticks. When the Sys class is first loaded * the hires timer is reset to 0. If no hires timer is present then this method will always - * return whatever value the timer was last set to. + * return 0.<p><strong>NOTEZ BIEN</strong> that the hires timer WILL wrap around. * - * @return the current hires time, in ticks. - */ - public static native long getTime(); - - /** - * Sets the hires timer to a new time, specified in ticks. - * - * @param time The new time, in ticks - * @see #getTime() - * @see #getTimerResolution() + * @return the current hires time, in ticks (always >= 0) */ - public static native void setTime(long time); + public static long getTime() { + return ngetTime() & 0x7FFFFFFFFFFFFFFFL; + } + private static native long ngetTime(); /** * Set the process priority in a system independent way. Because of the various |
|
From: Caspian Rychlik-P. <ci...@us...> - 2004-05-05 13:26:31
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14131/src/native/win32 Modified Files: org_lwjgl_Sys.cpp Log Message: Added some win32 timing tweaks Index: org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- org_lwjgl_Sys.cpp 27 Mar 2004 14:09:55 -0000 1.23 +++ org_lwjgl_Sys.cpp 5 May 2004 13:26:21 -0000 1.24 @@ -46,9 +46,9 @@ // Handle to the application's window extern HWND hwnd; -__int64 hires_timer_freq; // Hires timer frequency -__int64 hires_timer_start; // Hires timer start -__int64 hires_timer; // Hires timer current time +unsigned __int64 hires_timer_freq; // Hires timer frequency +unsigned __int64 hires_timer_start; // Hires timer start +unsigned __int64 hires_timer; // Hires timer current time /* * Class: org_lwjgl_Sys |
|
From: Elias N. <eli...@us...> - 2004-05-05 11:31:01
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18664/win32 Modified Files: org_lwjgl_input_Controller.cpp Log Message: Win32: Added missing throwException in Controller.cpp Index: org_lwjgl_input_Controller.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Controller.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- org_lwjgl_input_Controller.cpp 12 Jan 2004 17:24:47 -0000 1.20 +++ org_lwjgl_input_Controller.cpp 5 May 2004 11:30:51 -0000 1.21 @@ -117,33 +117,33 @@ */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) { - // assert that window has been created + // assert that window has been created if(hwnd == NULL) { - throwException(env, "Please create the window before initializing input devices"); - return; + throwException(env, "Please create the window before initializing input devices"); + return; } // Create the DirectInput object. HRESULT hr; hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL); if (FAILED(hr)) { - printfDebug("DirectInputCreate failed\n"); ShutdownController(); + throwException(env, "DirectInputCreate failed\n"); return; } /* Find all Controllers */ EnumerateControllers(); if (!cCreate_success) { - throwException(env, "Failed to enumerate."); ShutdownController(); + throwException(env, "Failed to enumerate."); return; } /* check that we got at least 1 controller */ if (cDIDevice == NULL) { - throwException(env, "No devices found."); ShutdownController(); + throwException(env, "No devices found."); return; } @@ -154,8 +154,8 @@ /* Enumerate capabilities of Controller */ EnumerateControllerCapabilities(); if (!cCreate_success) { - throwException(env, "Falied to enumerate capabilities."); ShutdownController(); + throwException(env, "Falied to enumerate capabilities."); return; } @@ -180,8 +180,8 @@ /* Aquire the Controller */ hr = cDIDevice->Acquire(); if(FAILED(hr)) { - throwException(env, "Acquire failed"); ShutdownController(); + throwException(env, "Acquire failed"); return; } } |
|
From: Elias N. <eli...@us...> - 2004-05-05 09:54:02
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2061/src/native/win32 Modified Files: Window.h org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Window.cpp Log Message: Split global DirectInput interface into 3 interfaces in Mouse, Keyboard and Controller Index: org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- org_lwjgl_input_Mouse.cpp 4 May 2004 18:47:47 -0000 1.52 +++ org_lwjgl_input_Mouse.cpp 5 May 2004 09:53:53 -0000 1.53 @@ -43,10 +43,12 @@ #include <windows.h> #undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x0300 +#include <dinput.h> #include "Window.h" #include "common_tools.h" -#include <dinput.h> +extern HINSTANCE dll_handle; // Handle to the LWJGL dll +static LPDIRECTINPUT lpdi = NULL; // DirectInput static LPDIRECTINPUTDEVICE mDIDevice; // DI Device instance static int mButtoncount = 0; // Temporary buttoncount static bool mHaswheel; // Temporary wheel check @@ -92,11 +94,12 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv *env, jclass clazz) { HRESULT hr; - // assert that Direct Input has been created - if(lpdi == NULL) { - throwException(env, "Please create the window before initializing input devices"); - return; - } + // Create input + HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); + if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION) { + throwException(env, "Failed to create DirectInput"); + return; + } /* skip enumeration, since we only want system mouse */ CreateMouse(); @@ -313,18 +316,24 @@ /** * Shutdown DI */ -void ShutdownMouse() { +static void ShutdownMouse() { // release device if (mDIDevice != NULL) { mDIDevice->Unacquire(); mDIDevice->Release(); mDIDevice = NULL; } + // Release DirectInput + if (lpdi != NULL) { + printfDebug("Destroying directinput\n"); + lpdi->Release(); + lpdi = NULL; + } } /** * Enumerates the capabilities of the Mouse attached to the system */ -void EnumerateMouseCapabilities() { +static void EnumerateMouseCapabilities() { HRESULT hr; hr = mDIDevice->EnumObjects(EnumMouseObjectsCallback, NULL, DIDFT_ALL); if FAILED(hr) { @@ -345,7 +354,7 @@ /** * Callback from EnumObjects. Called for each "object" on the Mouse. */ -BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { +static BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { printfDebug("found %s\n", lpddoi->tszName); if(lpddoi->guidType == GUID_Button) { mButtoncount++; @@ -362,7 +371,7 @@ /** * Creates the specified device as a Mouse */ -void CreateMouse() { +static void CreateMouse() { HRESULT hr; hr = lpdi->CreateDevice(GUID_SysMouse, &mDIDevice, NULL); if FAILED(hr) { @@ -376,7 +385,7 @@ /** * Sets up the Mouse properties */ -void SetupMouse() { +static void SetupMouse() { // set Mouse data format if(mDIDevice->SetDataFormat(&c_dfDIMouse) != DI_OK) { printfDebug("SetDataFormat failed\n"); Index: org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- org_lwjgl_opengl_Window.cpp 4 May 2004 18:58:09 -0000 1.29 +++ org_lwjgl_opengl_Window.cpp 5 May 2004 09:53:53 -0000 1.30 @@ -49,7 +49,6 @@ HWND hwnd = NULL; // Handle to the window HDC hdc = NULL; // Device context HGLRC hglrc = NULL; // OpenGL context -LPDIRECTINPUT lpdi = NULL; // DirectInput static bool isFullScreen = false; // Whether we're fullscreen or not static bool isMinimized = false; // Whether we're minimized or not static bool isFocused = false; // whether we're focused or not @@ -190,46 +189,12 @@ return iPixelFormat; } -/* - * Create DirectInput. - * Returns true for success, or false for failure - */ -static bool createDirectInput(JNIEnv *env) -{ - // Create input - HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); - if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) { - switch (ret) { - case DIERR_INVALIDPARAM : - throwException(env, "Failed to create DirectInput - Invalid parameter\n"); - break; - case DIERR_OLDDIRECTINPUTVERSION : - throwException(env, "Failed to create DirectInput - Old Version\n"); - break; - case DIERR_OUTOFMEMORY : - throwException(env, "Failed to create DirectInput - Out Of Memory\n"); - break; - default: - throwException(env, "Failed to create DirectInput - Unknown failure\n"); - } - return false; - } else { - return true; - } -} /* * Close the window */ static void closeWindow() { - // Release DirectInput - if (lpdi != NULL) { - printfDebug("Destroying directinput\n"); - lpdi->Release(); - lpdi = NULL; - } - // Release device context if (hdc != NULL && hwnd != NULL) { printfDebug("Releasing DC\n"); @@ -551,13 +516,6 @@ } } - if (!createDirectInput(env)) { - // Close the window - closeWindow(); - extgl_Close(); - return; - } - ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); SetForegroundWindow(hwnd); Index: org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- org_lwjgl_input_Keyboard.cpp 7 Apr 2004 07:48:37 -0000 1.31 +++ org_lwjgl_input_Keyboard.cpp 5 May 2004 09:53:53 -0000 1.32 @@ -51,6 +51,9 @@ #define KEYBOARD_BUFFER_SIZE 50 +extern HINSTANCE dll_handle; // Handle to the LWJGL dll + +static LPDIRECTINPUT lpdi = NULL; // DirectInput static LPDIRECTINPUTDEVICE lpdiKeyboard = NULL; static bool translationEnabled; @@ -64,6 +67,13 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate (JNIEnv * env, jclass clazz) { + // Create input + HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); + if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION) { + throwException(env, "Failed to create DirectInput"); + return; + } + translationEnabled = false; // Check to see if we're already initialized if (lpdiKeyboard != NULL) { @@ -98,7 +108,7 @@ dipropdw.dwData = KEYBOARD_BUFFER_SIZE; lpdiKeyboard->SetProperty(DIPROP_BUFFERSIZE, &dipropdw.diph); - HRESULT ret = lpdiKeyboard->Acquire(); + ret = lpdiKeyboard->Acquire(); if(FAILED(ret)) { printfDebug("Failed to acquire keyboard\n"); } @@ -118,6 +128,12 @@ lpdiKeyboard->Release(); lpdiKeyboard = NULL; } + // Release DirectInput + if (lpdi != NULL) { + printfDebug("Destroying directinput\n"); + lpdi->Release(); + lpdi = NULL; + } } /* Index: Window.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/Window.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Window.h 17 Feb 2004 16:57:23 -0000 1.8 +++ Window.h 5 May 2004 09:53:52 -0000 1.9 @@ -45,9 +45,6 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <jni.h> - #undef DIRECTINPUT_VERSION - #define DIRECTINPUT_VERSION 0x0500 - #include <dinput.h> #include "extgl.h" #ifdef _PRIVATE_WINDOW_H_ @@ -57,7 +54,6 @@ extern HWND hwnd; // Handle to the window extern HDC hdc; // Device context - extern LPDIRECTINPUT lpdi; // DirectInput extern bool isFullScreen; // Whether we're fullscreen or not extern bool isMinimized; // Whether we're minimized or not extern bool isFocused; // Whether we're focused or not |