You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
|
1
(1) |
|
2
(6) |
3
(8) |
4
(1) |
5
|
6
(6) |
7
(3) |
8
(2) |
|
9
|
10
|
11
|
12
|
13
(4) |
14
|
15
|
|
16
(12) |
17
(4) |
18
(1) |
19
(8) |
20
|
21
(12) |
22
(4) |
|
23
(4) |
24
(14) |
25
|
26
|
27
(20) |
28
(31) |
29
(3) |
|
30
(13) |
31
(1) |
|
|
|
|
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-27 22:46:29
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv16223/src/java/org/lwjgl Modified Files: Window.java Log Message: New Window class, and major changes to Display Index: Window.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Window.java 27 Mar 2003 22:32:48 -0000 1.1 +++ Window.java 27 Mar 2003 22:46:25 -0000 1.2 @@ -15,8 +15,7 @@ * cannot be changed * - the window may be closeable by the user or operating system, and may be minimized * by the user or operating system - * - the operating system may or may not allow more than one window to be constructed - * at any one time. There is no guarantee that all windows can be visible at once. + * - only one window may ever be open at once * - the operating system may or may not be able to do fullscreen or windowed windows. * * @author foo @@ -26,6 +25,9 @@ static { System.loadLibrary(Sys.getLibraryName()); } + + /** Whether we have a window already */ + private static boolean created; /** The window's native data structure. On Win32 this is an HWND. */ private int handle; @@ -63,18 +65,26 @@ * * In this abstract base class, no actual window peer is constructed. This should be * done in specialised derived classes. + * + * Only one Window can be constructed at a time; to create another Window you must + * first destroy() the first window. * * @param title The window's title * @param x, y, width, height The position and dimensions of the client area of * the window. The dimensions may be ignored if the window cannot be made non- * fullscreen. The position may be ignored in either case. + * @throws RuntimeException if you attempt to create more than one window at the same time */ protected Window(String title, int x, int y, int width, int height) { + if (created) + throw new RuntimeException("Only one LWJGL window may be instantiated at any one time."); this.title = title; this.x = x; this.y = y; this.width = width; this.height = height; + + created = true; } /** @@ -157,7 +167,15 @@ /** * Destroy the window. */ - public final native void destroy(); + public final void destroy() { + created = false; + nDestroy(); + } + + /** + * Natively destroy the window + */ + private native void nDestroy(); /** * @return the native window handle |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-27 22:36:19
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv10844/src/java/org/lwjgl Modified Files: Display.java Log Message: New Window class, and major changes to Display Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-27 22:33:36
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1:/tmp/cvs-serv9078/src/java/org/lwjgl/test/input Modified Files: MouseCreationTest.java MouseTest.java ControllerCreationTest.java Log Message: New Window class, and major changes to Display Index: MouseCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- MouseCreationTest.java 24 Mar 2003 17:07:25 -0000 1.5 +++ MouseCreationTest.java 27 Mar 2003 22:32:44 -0000 1.6 @@ -35,6 +35,7 @@ import org.lwjgl.Display; import org.lwjgl.DisplayMode; import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.*; import org.lwjgl.opengl.GL; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -118,7 +119,7 @@ // recreate display in fullscreen mode System.out.print("Destroying display..."); - Display.destroy(); + BaseGL.destroy(); System.out.println("success"); System.out.print("Entering fullscreen mode..."); @@ -140,7 +141,7 @@ System.out.print("Shutting down..."); Mouse.destroy(); gl.destroy(); - Display.destroy(); + BaseGL.destroy(); System.out.println("shutdown complete"); } Index: MouseTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- MouseTest.java 24 Mar 2003 17:07:25 -0000 1.7 +++ MouseTest.java 27 Mar 2003 22:32:45 -0000 1.8 @@ -35,6 +35,7 @@ import org.lwjgl.DisplayMode; import org.lwjgl.input.Mouse; import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.*; import org.lwjgl.opengl.GL; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -118,7 +119,7 @@ Mouse.destroy(); Keyboard.destroy(); gl.destroy(); - Display.destroy(); + BaseGL.destroy(); } private void createMouse() { @@ -131,8 +132,8 @@ } private void wiggleMouse() { - while (!Display.isCloseRequested()) { - if(Display.isMinimized()) { + while (!BaseGL.isCloseRequested()) { + if(BaseGL.isMinimized()) { continue; } Index: ControllerCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ControllerCreationTest.java 19 Mar 2003 12:41:27 -0000 1.2 +++ ControllerCreationTest.java 27 Mar 2003 22:32:46 -0000 1.3 @@ -35,6 +35,7 @@ import org.lwjgl.Display; import org.lwjgl.DisplayMode; import org.lwjgl.input.Controller; +import org.lwjgl.opengl.*; import org.lwjgl.opengl.GL; import org.lwjgl.opengl.GLU; import org.lwjgl.vector.Vector2f; @@ -118,7 +119,7 @@ // recreate display in fullscreen mode System.out.print("Destroying display..."); - Display.destroy(); + BaseGL.destroy(); System.out.println("success"); System.out.print("Entering fullscreen mode..."); @@ -140,7 +141,7 @@ System.out.print("Shutting down..."); Controller.destroy(); gl.destroy(); - Display.destroy(); + BaseGL.destroy(); System.out.println("shutdown complete"); } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-27 22:33:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test In directory sc8-pr-cvs1:/tmp/cvs-serv9078/src/java/org/lwjgl/test Modified Files: WindowCreationTest.java Log Message: New Window class, and major changes to Display Index: WindowCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/WindowCreationTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- WindowCreationTest.java 24 Mar 2003 17:16:42 -0000 1.1 +++ WindowCreationTest.java 27 Mar 2003 22:32:46 -0000 1.2 @@ -7,6 +7,7 @@ package org.lwjgl.test; import org.lwjgl.*; +import org.lwjgl.opengl.BaseGL; /** * @author Brian @@ -43,6 +44,6 @@ System.out.println("Display created"); - Display.destroy(); + BaseGL.destroy(); } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-27 22:33:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv9078/src/java/org/lwjgl/opengl Modified Files: BaseGL.java Log Message: New Window class, and major changes to Display Index: BaseGL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- BaseGL.java 21 Mar 2003 17:05:55 -0000 1.9 +++ BaseGL.java 27 Mar 2003 22:32:39 -0000 1.10 @@ -190,4 +190,166 @@ && Thread.currentThread() == renderThread; } + /** + * Create a fullscreen display. If the display has already been created then this + * method is a no-op. + * + * Alpha, depth, and stencil will be 0 bits. + * + * @param title The title for the application + * @throws Exception if the window could not be created for any reason + * @see #destroy() + */ + public static void create(String title) throws Exception { + create(title, 0, 0, 0); + } + + /** + * Create a fullscreen display. If the display has already been created then this + * method is a no-op. + * + * @param title The title for the application + * @param alpha Minimun number of alpha bits on the display + * @param depth Minimun number of depth bits on the display + * @param stencil Minimun number of stencil bits on the display + * @throws Exception if the window could not be created for any reason + * @see #destroy() + */ + public static void create(String title, int alpha, int depth, int stencil) + throws Exception { + + if (Display.created) { + return; + } + + if (!nCreateFullscreen(title, alpha, depth, stencil)) { + throw new Exception("Failed to create fullscreen display."); + } + + Display.created = true; + } + + /** + * Create a windowed display. If the display has already been created then this + * method is a no-op. + * + * The window is not guaranteed to be positioned at (x, y). Nor is it guaranteed + * to have a drag bar, title bar, close button, or minimized button. It cannot be + * resized once created. + * + * The window will have 0 bits alpha, depth, and stencil. + * + * @param title The title for the application + * @param x, y The position of the window + * @param width, height The dimensions of the drawable area of the window + * @throws Exception if the window could not be created for any reason + * @see #destroy() + */ + public static void create(String title, int x, int y, int width, int height) + throws Exception { + + create(title, x, y, width, height, 0, 0, 0); + + } + + /** + * Create a windowed display. If the display has already been created then this + * method is a no-op. + * + * The window is not guaranteed to be positioned at (x, y). Nor is it guaranteed + * to have a drag bar, title bar, close button, or minimized button. It cannot be + * resized once created. + * + * @param title The title for the application + * @param x, y The position of the window + * @param width, height The dimensions of the drawable area of the window + * @param alpha Minimun number of alpha bits on the display + * @param depth Minimun number of depth bits on the display + * @param stencil Minimun number of stencil bits on the display + * @throws Exception if the window could not be created for any reason + * @see #destroy() + */ + public static void create(String title, int x, int y, int width, int height, int alpha, int depth, int stencil) + throws Exception { + + if (Display.created) { + return; + } + + if (!nCreateWindowed(title, x, y, width, height, alpha, depth, stencil)) { + throw new Exception("Failed to create windowed display."); + } + + Display.created = true; + } + + /** + * Native method to create the display. This will set the handle if it is + * successful. + * @return true if the display was successfully created + * @see #create(org.lwjgl.DisplayMode, boolean) + */ + private static native boolean nCreateWindowed( + String title, + int x, + int y, + int width, + int height, + int alpha_bits, + int depth_bits, + int stencil_bits); + + /** + * Native method to create the display. This will set the handle if it is + * successful. + * @return true if the display was successfully created + * @see #create(org.lwjgl.DisplayMode, boolean) + */ + private static native boolean nCreateFullscreen( + String title, + int alpha_bits, + int depth_bits, + int stencil_bits); + + /** + * Destroy the display and return it to normal. If the display has not yet + * been created no action is taken. + */ + public static void destroy() { + if (!Display.created) { + return; + } + + nDestroy(); + Display.created = false; + Display.mode = null; + } + + /** + * Native method to destroy the display. This will reset the handle. + */ + private static native void nDestroy(); + + /** + * Determines if the display is minimized. When the display is minimized it is + * effectively invisible, and you need perform no rendering in your game loop. + * On the native side, when the application is switched to some other application, + * the display window will minimize; when focus is regained, it will maximize and + * automatically gain focus and become the foreground window again. + * @return true if the display is minimized + */ + public static native boolean isMinimized(); + + /** + * Determines if the user has requested that the application should close. + * When a user has requested that the application should shutdown, it is up to + * the application to perform the actual shutdown and cleanup of any allocated + * resources. + * + * @return true if the user has requested that the application should close + */ + public static boolean isCloseRequested() { + return Display.closeRequested; + } + } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-27 22:33:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv9078/src/java/org/lwjgl/test/opengl Modified Files: Grass.java Game.java Log Message: New Window class, and major changes to Display Index: Grass.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Grass.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Grass.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Grass.java 19 Mar 2003 12:41:28 -0000 1.9 +++ Grass.java 27 Mar 2003 22:32:34 -0000 1.10 @@ -214,7 +214,7 @@ Mouse.destroy(); Keyboard.destroy(); gl.destroy(); - Display.destroy(); + BaseGL.destroy(); } private static float myrand() { Index: Game.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/opengl/Game.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Game.java 19 Mar 2003 12:41:28 -0000 1.10 +++ Game.java 27 Mar 2003 22:32:36 -0000 1.11 @@ -45,7 +45,7 @@ import org.lwjgl.opengl.*; import org.lwjgl.input.*; -import java.nio.*; +import java.nio.*; public final class Game { static { @@ -188,6 +188,6 @@ Keyboard.destroy(); Mouse.destroy(); gl.destroy(); - Display.destroy(); + BaseGL.destroy(); } } |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-27 22:33:05
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv9078/src/java/org/lwjgl Modified Files: Display.java Added Files: Window.java Log Message: New Window class, and major changes to Display --- NEW FILE: Window.java --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Window.java /* * Created on 27-Mar-2003 * * To change this generated comment go to * Window>Preferences>Java>Code Generation>Code Template */ package org.lwjgl; /** * This is the abstract base class for a Window in LWJGL. LWJGL windows have some * peculiar characteristics: * * - width and height are always fixed and cannot be changed * - the position of the window may or may not be programmable but once specified * cannot be changed * - the window may be closeable by the user or operating system, and may be minimized * by the user or operating system * - the operating system may or may not allow more than one window to be constructed * at any one time. There is no guarantee that all windows can be visible at once. * - the operating system may or may not be able to do fullscreen or windowed windows. * * @author foo */ public abstract class Window { static { System.loadLibrary(Sys.getLibraryName()); } /** The window's native data structure. On Win32 this is an HWND. */ private int handle; /** Whether the window is currently minimized */ private boolean minimized; /** Whether the window has been asked to close by the user or underlying OS */ private boolean closeRequested; /** Whether the window is dirty, ie. needs painting */ private boolean dirty; /** X coordinate of the window */ private int x; /** * Y coordinate of the window. Y in window coordinates is from the top of the display down, * unlike GL, where it is typically at the bottom of the display. */ private int y; /** Width of the window */ private final int width; /** Height of the window */ private final int height; /** Title of the window */ private String title; /** * Construct a Window. Some OSs may not support non-fullscreen windows; in * which case the window will be fullscreen regardless. * * In this abstract base class, no actual window peer is constructed. This should be * done in specialised derived classes. * * @param title The window's title * @param x, y, width, height The position and dimensions of the client area of * the window. The dimensions may be ignored if the window cannot be made non- * fullscreen. The position may be ignored in either case. */ protected Window(String title, int x, int y, int width, int height) { this.title = title; this.x = x; this.y = y; this.width = width; this.height = height; } /** * @return the width of the window */ public final int getWidth() { return width; } /** * @return the height of the window */ public final int getHeight() { return height; } /** * @return the title of the window */ public final String getTitle() { return title; } /** * Set the title of the window. This may be ignored by the underlying OS. * @param newTitle The new window title */ public final void setTitle(String newTitle) { title = newTitle; nSetTitle(); } /** * Native implementation of setTitle(). This will read the window's title member * and stash it in the native title of the window. */ private native void nSetTitle(); /** * @return true if the user or operating system has asked the window to close */ public final boolean isCloseRequested() { return closeRequested; } /** * @return true if the window is minimized or otherwise not visible */ public final boolean isMinimized() { return minimized; } /** * Determine if the window's contents have been damaged by external events. * If you are writing a straightforward game rendering loop and simply paint * every frame regardless, you can ignore this flag altogether. If you are * trying to be kind to other processes you can check this flag and only * redraw when it returns true. The flag is cleared when you call paint(). * * @return true if the window has been damaged by external changes * and needs to repaint itself */ public final boolean isDirty() { return dirty; } /** * Paint the window. This clears the dirty flag and swaps the buffers. */ public final void paint() { dirty = false; swapBuffers(); } /** * Swap the buffers. */ private native void swapBuffers(); /** * Destroy the window. */ public final native void destroy(); /** * @return the native window handle */ public final int getHandle() { return handle; } /** * '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(); } Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Display.java 21 Mar 2003 17:05:55 -0000 1.19 +++ Display.java 27 Mar 2003 22:32:47 -0000 1.20 @@ -34,6 +34,7 @@ import java.util.HashSet; import java.util.Arrays; + /** * $Id$ * @@ -49,6 +50,7 @@ static { System.loadLibrary(Sys.getLibraryName()); + init(); } /** Has the display been created? */ @@ -83,6 +85,12 @@ private Display() { super(); } + + /** + * Initialize. This determines, natively, the current display mode and stashes + * it back in the mode static member. + */ + private static native void init(); /** * Returns the entire list of display modes as an array, in no @@ -116,89 +124,29 @@ /** * Native method for getting displaymodes */ - public static native DisplayMode[] nGetAvailableDisplayModes(); - + private static native DisplayMode[] nGetAvailableDisplayModes(); + /** - * Create a display with the specified display mode. If the display is - * already created then no action is taken - the display must first be - * destroyed. - * - * @param displayMode A display mode to choose - * @param alpha Minimun number of alpha bits on the display - * @param depth Minimun number of depth bits on the display - * @param stencil Minimun number of stencil bits on the display - * @param fullscreen Whether to create the display fullscreen - * @param title The title for the application + * Set the current display mode. The underlying OS may not use an exact match for + * the specified display mode. After successfully calling setDisplayMode() you will + * still need to query the display's characteristics using getDisplayMode(). + * @param newMode The new display mode to set * @throws Exception if the display mode could not be set - * @see #destroy() */ - public static void create(DisplayMode displayMode, int alpha, int depth, int stencil, boolean fullscreen, String title) - throws Exception { - - if (created) { - return; - } - - if (!nCreate(displayMode.width, - displayMode.height, - displayMode.bpp, - displayMode.freq, - alpha, - depth, - stencil, - fullscreen, - title)) { - throw new Exception("Failed to set display mode to " + displayMode); - } - - created = true; - mode = displayMode; - } - - /** - * Native method to create the display. This will set the handle if it is - * successful. - * @return true if the display was successfully created - * @see #create(org.lwjgl.DisplayMode, boolean) - */ - private static native boolean nCreate( - int width, - int height, - int bpp, - int freq, - int alpha_bits, - int depth_bits, - int stencil_bits, - boolean fullscreen, - String title); - - /** - * Destroy the display and return it to normal. If the display has not yet - * been created no action is taken. - */ - public static void destroy() { - if (!created) { - return; - } - - nDestroy(); - created = false; - mode = null; - } - + public static native void setDisplayMode(DisplayMode mode) throws Exception; + /** - * Native method to destroy the display. This will reset the handle. + * Reset the display mode to whatever it was when LWJGL was initialized. + * Fails silently. */ - private static native void nDestroy(); + public static native void resetDisplayMode() throws Exception; /** * Retrieves the width of the created display * * @return the current display width. - * @throws AssertionError if the display has not been created yet. */ public static int getWidth() { - assert created : "The display has not been created yet."; return mode.width; } @@ -206,10 +154,8 @@ * Retrieves the height of the created display * * @return the current display height. - * @throws AssertionError if the display has not been created yet. */ public static int getHeight() { - assert created : "The display has not been created yet."; return mode.height; } @@ -217,10 +163,8 @@ * Retrieves the current display depth of the created display * * @return the current display depth. - * @throws AssertionError if the display has not been created yet. */ public static int getDepth() { - assert created : "The display has not been created yet."; return mode.bpp; } @@ -228,27 +172,14 @@ * Retrieves the current display frequency of the created display * * @return the current display frequency. - * @throws AssertionError if the display has not been created yet. */ public static int getFrequency() { - assert created : "The display has not been created yet."; return mode.freq; } /** - * Retrieves the <code>DisplayMode</code> that the display has currently been - * set to. - * - * @return the current display mode, or null if the display is not yet created - * @throws AssertionError if the display has not been created yet. - */ - public static DisplayMode getDisplayMode() { - assert created : "The display has not been created yet."; - return mode; - } - - /** - * Retrieves the native handle to the created window + * Retrieves the native handle to the created window. The meaning of this value + * is platform specific. Under Win32, it is an HWND. * * @return the native handle * @throws AssertionError if the display has not been created yet. @@ -259,37 +190,6 @@ } /** - * Tests whether or not the display has been created - * - * @return true if the display has been created - */ - public static boolean isCreated() { - return created; - } - - /** - * Determines if the display is minimized. When the display is minimized it is - * effectively invisible, and you need perform no rendering in your game loop. - * On the native side, when the application is switched to some other application, - * the display window will minimize; when focus is regained, it will maximize and - * automatically gain focus and become the foreground window again. - * @return true if the display is minimized - */ - public static native boolean isMinimized(); - - /** - * Determines if the user has requested that the application should close. - * When a user has requested that the application should shutdown, it is up to - * the application to perform the actual shutdown and cleanup of any allocated - * resources. - * - * @return true if the user has requested that the application should close - */ - public static boolean isCloseRequested() { - return closeRequested; - } - - /** * 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 @@ -299,5 +199,21 @@ */ public static native int getPlatform(); + /** + * Obtains the display's gamma ramp. The gamma ramp returned is an array of + * integers in the range 0..255. If gamma is not supported by the underlying + * hardware then null is returned. + * @return an array of ints, or null + */ + public static native int[] getGammaRamp(); + + /** + * Sets the display's gamma ramp. The gamma ramp should be an array of ints + * in the range 0...255. The length of the array should match the length of the + * array returned by getGammaRamp(). + * + * If the underlying hardware does not support gamma then this command is a no-op. + */ + public static native void setGammaRamp(int[] gamma); } |
|
From: Elias N. <eli...@us...> - 2003-03-27 18:28:10
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv28750/linux Modified Files: org_lwjgl_opengl_BaseGL.cpp Log Message: Various linux fixes(alot) Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_opengl_BaseGL.cpp 27 Mar 2003 18:27:36 -0000 1.11 +++ org_lwjgl_opengl_BaseGL.cpp 27 Mar 2003 18:28:05 -0000 1.12 @@ -65,7 +65,6 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate (JNIEnv * env, jobject obj) { - printf("1\n"); if (disp == NULL) { #ifdef _DEBUG printf("No display\n"); @@ -78,9 +77,7 @@ #endif return JNI_FALSE; } - printf("2\n"); context = glXCreateContext(disp, getVisualInfo(), NULL, True); - printf("3\n"); if (context == NULL) { #ifdef _DEBUG printf("Could not create context\n"); @@ -88,9 +85,7 @@ return JNI_FALSE; } - printf("4\n"); makeCurrent(); - printf("5\n"); if (extgl_Initialize() != 0) { #ifdef _DEBUG printf("Could not init gl function pointers\n"); |
|
From: Elias N. <eli...@us...> - 2003-03-27 18:27:43
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv28256/linux Modified Files: org_lwjgl_Display.cpp org_lwjgl_opengl_BaseGL.cpp Log Message: Various linux fixes(alot) Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- org_lwjgl_Display.cpp 27 Mar 2003 17:22:26 -0000 1.30 +++ org_lwjgl_Display.cpp 27 Mar 2003 18:27:35 -0000 1.31 @@ -279,6 +279,7 @@ } screen = DefaultScreen(disp); if (!loadGL(disp, screen)) { + XCloseDisplay(disp); #ifdef _DEBUG printf("Could not load GL libs\n"); #endif Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_opengl_BaseGL.cpp 27 Mar 2003 15:16:35 -0000 1.10 +++ org_lwjgl_opengl_BaseGL.cpp 27 Mar 2003 18:27:36 -0000 1.11 @@ -65,6 +65,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate (JNIEnv * env, jobject obj) { + printf("1\n"); if (disp == NULL) { #ifdef _DEBUG printf("No display\n"); @@ -77,7 +78,9 @@ #endif return JNI_FALSE; } + printf("2\n"); context = glXCreateContext(disp, getVisualInfo(), NULL, True); + printf("3\n"); if (context == NULL) { #ifdef _DEBUG printf("Could not create context\n"); @@ -85,7 +88,9 @@ return JNI_FALSE; } + printf("4\n"); makeCurrent(); + printf("5\n"); if (extgl_Initialize() != 0) { #ifdef _DEBUG printf("Could not init gl function pointers\n"); @@ -135,10 +140,10 @@ } /* - * * Class: org_lwjgl_opengl_BaseGL - * * Method: nFreeContext - * * Signature: ()V - * */ + * Class: org_lwjgl_opengl_BaseGL + * Method: nFreeContext + * Signature: ()V + */ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_BaseGL_nReleaseContext (JNIEnv *, jobject) { |
|
From: Elias N. <eli...@us...> - 2003-03-27 17:27:44
|
Update of /cvsroot/java-game-lib/LWJGL/doc In directory sc8-pr-cvs1:/tmp/cvs-serv1539/doc Modified Files: TODO Log Message: Index: TODO CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/TODO =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/doc/TODO,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TODO 27 Mar 2003 16:25:54 -0000 1.1 +++ TODO 27 Mar 2003 17:27:26 -0000 1.2 @@ -3,22 +3,15 @@ 1. Apple extensions 2. Pbuffers - means opening up some internals like HDC and HWNDs that are meaningless to other operating systems but who cares... -3. Debug build: check for function availabilty macro and throw an OpenGL - exception instead of blowing up the VM 4. Javadoc for GL commands. For now why not just paste in the OpenGL man docs in there as they're in the public domain? If anyone complains we'll just have to sort something else out... 5. Change callback mechanism for GLUQuadrics to use an interface 6. Pbuffers for linux (and maybe macosx) - it's possible afaik -7. Check that returned modes really are hw accelerated. - (PFD_GENERIC_ACCELERATED, PFD_GENERIC_FORMAT) -8. The linux mouse behaviour hacks - at least the alt+tab hack. 9. Mode switching when alt+tabbing from fullscreen - if possible. -10. Maybe a flag to tell which platform you're on? Or sort out the - GL_NV_vertex_array_range allocation in a xplatform way. 11. OS X version 12. BSD Version? 13. Better documentation/tutorials 14. Better build system -15. 2D API \ No newline at end of file +15. 2D API |
|
From: Elias N. <eli...@us...> - 2003-03-27 17:22:32
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv31460/linux Modified Files: org_lwjgl_Display.cpp Log Message: Linux various (5) Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- org_lwjgl_Display.cpp 27 Mar 2003 15:42:25 -0000 1.29 +++ org_lwjgl_Display.cpp 27 Mar 2003 17:22:26 -0000 1.30 @@ -348,6 +348,7 @@ #endif return JNI_FALSE; } + XF86VidModeLockModeSwitch(disp, screen, 1); break; } } @@ -363,6 +364,7 @@ setRepeatMode(AutoRepeatModeDefault); XDestroyWindow(disp, win); if (current_fullscreen) { + XF86VidModeLockModeSwitch(disp, screen, 0); if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[0])) { #ifdef _DEBUG printf("Could not switch mode\n"); |
|
From: Brian M. <ma...@us...> - 2003-03-27 16:26:01
|
Update of /cvsroot/java-game-lib/LWJGL/doc In directory sc8-pr-cvs1:/tmp/cvs-serv3871 Added Files: TODO Log Message: initial commit --- NEW FILE: TODO --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/doc/TODO Todo: 1. Apple extensions 2. Pbuffers - means opening up some internals like HDC and HWNDs that are meaningless to other operating systems but who cares... 3. Debug build: check for function availabilty macro and throw an OpenGL exception instead of blowing up the VM 4. Javadoc for GL commands. For now why not just paste in the OpenGL man docs in there as they're in the public domain? If anyone complains we'll just have to sort something else out... 5. Change callback mechanism for GLUQuadrics to use an interface 6. Pbuffers for linux (and maybe macosx) - it's possible afaik 7. Check that returned modes really are hw accelerated. (PFD_GENERIC_ACCELERATED, PFD_GENERIC_FORMAT) 8. The linux mouse behaviour hacks - at least the alt+tab hack. 9. Mode switching when alt+tabbing from fullscreen - if possible. 10. Maybe a flag to tell which platform you're on? Or sort out the GL_NV_vertex_array_range allocation in a xplatform way. 11. OS X version 12. BSD Version? 13. Better documentation/tutorials 14. Better build system 15. 2D API |
|
From: Elias N. <eli...@us...> - 2003-03-27 15:42:30
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv14142/linux Modified Files: org_lwjgl_Display.cpp Log Message: Various linux fixes(4) Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- org_lwjgl_Display.cpp 27 Mar 2003 15:38:47 -0000 1.28 +++ org_lwjgl_Display.cpp 27 Mar 2003 15:42:25 -0000 1.29 @@ -375,7 +375,6 @@ vis_info = NULL; XCloseDisplay(disp); disp = NULL; - XSync(disp, False); closeGL(); #ifdef _DEBUG printf("Closed X connection\n"); |
|
From: Elias N. <eli...@us...> - 2003-03-27 15:38:52
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv12366/linux Modified Files: org_lwjgl_Display.cpp Log Message: Various linux fixes(3) Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- org_lwjgl_Display.cpp 27 Mar 2003 15:16:35 -0000 1.27 +++ org_lwjgl_Display.cpp 27 Mar 2003 15:38:47 -0000 1.28 @@ -293,7 +293,6 @@ } root_win = RootWindow(disp, screen); vis_info = chooseVisual(disp, screen, bpp, depth_bits, alpha_bits, stencil_bits); - XSync(disp, False); if (vis_info == NULL) { XCloseDisplay(disp); #ifdef _DEBUG @@ -376,6 +375,7 @@ vis_info = NULL; XCloseDisplay(disp); disp = NULL; + XSync(disp, False); closeGL(); #ifdef _DEBUG printf("Closed X connection\n"); |
|
From: Elias N. <eli...@us...> - 2003-03-27 15:29:01
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv6618/common Modified Files: extgl.c Log Message: Various linux fixes(2) Index: extgl.c CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- extgl.c 27 Mar 2003 15:16:34 -0000 1.8 +++ extgl.c 27 Mar 2003 15:28:57 -0000 1.9 @@ -3237,11 +3237,11 @@ #ifdef _X11 int extgl_Open(Display *disp, int screen) { - lib_gl_handle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL); + lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_gl_handle == NULL) return 1; - lib_glu_handle = dlopen("libGLU.so", RTLD_NOW | RTLD_GLOBAL); + lib_glu_handle = dlopen("libGLU.so", RTLD_LAZY | RTLD_GLOBAL); if (lib_glu_handle == NULL) return 1; if (extgl_InitGLX(disp, screen) != 0) |
|
From: Elias N. <eli...@us...> - 2003-03-27 15:16:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv32760/linux Modified Files: org_lwjgl_Display.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_opengl_BaseGL.cpp Log Message: Various linux fixes Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- org_lwjgl_Display.cpp 21 Mar 2003 23:28:00 -0000 1.26 +++ org_lwjgl_Display.cpp 27 Mar 2003 15:16:35 -0000 1.27 @@ -64,7 +64,6 @@ static XF86VidModeModeInfo **avail_modes; static XVisualInfo * vis_info; static Atom delete_atom; -static bool gl_loaded = false; static jclass saved_clazz; extern void handlePointerMotion(XMotionEvent *); @@ -83,70 +82,6 @@ int stencil; }; -/*static int fillFormat(struct pixelformat *formats, int index, int bpp, int depth, int alpha, int stencil) { - for (int i = 0; i < index; i++) - if (formats[i].bpp == bpp && - formats[i].depth == depth && - formats[i].alpha == alpha && - formats[i].stencil == stencil) - return 0; - formats[index].bpp = bpp; - formats[index].depth = depth; - formats[index].stencil = stencil; - formats[index].alpha = alpha; - return 1; -} - -static struct pixelformat *getGLXAvailablePixelFormats(Display *disp, int screen, int *length) { - if (extgl_Extensions.glx.GLX13 == 1) { - int num_formats; - int attriblist[] = {GLX_DOUBLEBUFFER, True, - GLX_STEREO, False, - GLX_RENDER_TYPE, GLX_RGBA_BIT, - GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, - GLX_CONFIG_CAVEAT, GLX_NONE, - None}; - GLXFBConfig *configs = glXChooseFBConfig(disp, screen, attriblist, &num_formats); - struct pixelformat *formats = (struct pixelformat *)malloc(num_formats*sizeof(struct pixelformat)); - *length = 0; - for (int i = 0; i < num_formats; i++) { - int bpp, depth, alpha, stencil; - int val; - if (glXGetFBConfigAttrib(disp, configs[i], GLX_RED_SIZE, &val) != 0) { - ree(formats); - return NULL; - } - bpp = val; - if (glXGetFBConfigAttrib(disp, configs[i], GLX_GREEN_SIZE, &val) != 0) { - free(formats); - return NULL; - } - bpp += val; - if (glXGetFBConfigAttrib(disp, configs[i], GLX_BLUE_SIZE, &val) != 0) { - free(formats); - return NULL; - } - bpp += val; - if (glXGetFBConfigAttrib(disp, configs[i], GLX_ALPHA_SIZE, &alpha) != 0) { - free(formats); - return NULL; - } - if (glXGetFBConfigAttrib(disp, configs[i], GLX_DEPTH_SIZE, &depth) != 0) { - free(formats); - return NULL; - } - if (glXGetFBConfigAttrib(disp, configs[i], GLX_STENCIL_SIZE, &stencil) != 0) { - free(formats); - return NULL; - } - if (fillFormat(formats, *length, bpp, depth, alpha, stencil) == 1) - (*length)++; - } - return formats; - } - return NULL; -} -*/ static XVisualInfo *chooseVisual(Display *disp, int screen, int bpp, int depth, int alpha, int stencil) { int bpe; switch (bpp) { @@ -173,27 +108,16 @@ return glXChooseVisual(disp, screen, attriblist); } -/*static struct pixelformat *getAvailablePixelFormats(Display *disp, int screen, int *length) { - struct pixelformat *formats = getGLXAvailablePixelFormats(disp, screen, length); - if (formats != NULL) - return formats; - *length = 16; - formats = (struct pixelformat *)malloc((*length)*sizeof(struct pixelformat)); - *length = 0; - for (int bpp = 16; bpp <= 24; bpp += 8) - for (int depth = 16; depth <= 24; depth += 8) - for (int alpha = 0; alpha <= 8; alpha += 8) - for (int stencil = 0; stencil <= 8; stencil += 8) { - XVisualInfo * visual = chooseVisual(disp, screen, bpp, depth, alpha, stencil); - if (visual != NULL) { - if (fillFormat(formats, *length, bpp, depth, alpha, stencil) == 1) - (*length)++; - XFree(visual); - } - } - return formats; +static void dumpVisualInfo(Display *disp, XVisualInfo *vis_info) { + int alpha, depth, stencil, r, g, b; + glXGetConfig(disp, vis_info, GLX_RED_SIZE, &r); + glXGetConfig(disp, vis_info, GLX_GREEN_SIZE, &g); + glXGetConfig(disp, vis_info, GLX_BLUE_SIZE, &b); + glXGetConfig(disp, vis_info, GLX_ALPHA_SIZE, &alpha); + glXGetConfig(disp, vis_info, GLX_DEPTH_SIZE, &depth); + glXGetConfig(disp, vis_info, GLX_STENCIL_SIZE, &stencil); + printf("Pixel format chosen sizes: r = %d, g = %d, b = %d, a = %d, depth = %d, stencil = %d\n", r, g, b, alpha, depth, stencil); } -*/ static void waitMapped(Display *disp, Window win) { XEvent event; @@ -234,7 +158,7 @@ XNextEvent(disp, &event); switch (event.type) { case ClientMessage: - if ((event.xclient.format == 32) && (event.xclient.data.l[0] == delete_atom)) + if ((event.xclient.format == 32) && ((Atom)event.xclient.data.l[0] == delete_atom)) env->SetStaticBooleanField(saved_clazz, fid_close, JNI_TRUE); break; case FocusIn: @@ -264,20 +188,16 @@ } static bool loadGL(Display *disp, int screen) { - if (gl_loaded == true) - return true; if (extgl_Open(disp, screen) != 0) { #ifdef _DEBUG printf("Could not load gl libs\n"); #endif return false; } - gl_loaded = true; return true; } static void closeGL(void) { - gl_loaded = false; extgl_Close(); } @@ -373,6 +293,7 @@ } root_win = RootWindow(disp, screen); vis_info = chooseVisual(disp, screen, bpp, depth_bits, alpha_bits, stencil_bits); + XSync(disp, False); if (vis_info == NULL) { XCloseDisplay(disp); #ifdef _DEBUG @@ -380,7 +301,9 @@ #endif return JNI_FALSE; } - +#ifdef _DEBUG + dumpVisualInfo(disp, vis_info); +#endif cmap = XCreateColormap(disp, root_win, vis_info->visual, AllocNone); attribs.colormap = cmap; attribs.event_mask = FocusChangeMask | VisibilityChangeMask| StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; @@ -391,6 +314,7 @@ attribs.override_redirect = True; } win = XCreateWindow(disp, root_win, 0, 0, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); + XFreeColormap(disp, cmap); #ifdef _DEBUG printf("Created window\n"); #endif @@ -425,6 +349,7 @@ #endif return JNI_FALSE; } + break; } } XF86VidModeSetViewPort(disp, screen, 0, 0); @@ -446,8 +371,11 @@ } } XFree(avail_modes); + avail_modes = NULL; XFree(vis_info); + vis_info = NULL; XCloseDisplay(disp); + disp = NULL; closeGL(); #ifdef _DEBUG printf("Closed X connection\n"); @@ -479,13 +407,6 @@ screen = DefaultScreen(disp); int bpp = XDefaultDepth(disp, screen); - if (!loadGL(disp, screen)) { -#ifdef _DEBUG - printf("Could not load GL\n"); -#endif - XCloseDisplay(disp); - return NULL; - } if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { #ifdef _DEBUG printf("Could not get display modes\n"); @@ -493,22 +414,15 @@ XCloseDisplay(disp); return NULL; } - int num_pixelformats; -// struct pixelformat *formats = getAvailablePixelFormats(disp, screen, &num_pixelformats); // Allocate an array of DisplayModes big enough jclass displayModeClass = env->FindClass("org/lwjgl/DisplayMode"); - jobjectArray ret = env->NewObjectArray(num_modes/**num_pixelformats*/, displayModeClass, NULL); + jobjectArray ret = env->NewObjectArray(num_modes, displayModeClass, NULL); jmethodID displayModeConstructor = env->GetMethodID(displayModeClass, "<init>", "(IIII)V"); for (i = 0; i < num_modes; i++) { -/* for (int j = 0; j < num_pixelformats; j++) { - jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, formats[j].bpp, 0, formats[j].alpha, formats[j].depth, formats[j].stencil); - env->SetObjectArrayElement(ret, i*num_pixelformats + j, displayMode); - }*/ jobject displayMode = env->NewObject(displayModeClass, displayModeConstructor, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay, bpp, 0); env->SetObjectArrayElement(ret, i, displayMode); } -// free(formats); XFree(avail_modes); XCloseDisplay(disp); return ret; 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.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- org_lwjgl_input_Keyboard.cpp 21 Mar 2003 23:28:00 -0000 1.18 +++ org_lwjgl_input_Keyboard.cpp 27 Mar 2003 15:16:35 -0000 1.19 @@ -257,9 +257,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nPoll (JNIEnv * env, jclass clazz, jint buf) { - XEvent event; - unsigned char state; - handleMessages(env); updateGrab(); memcpy((unsigned char*)buf, key_buf, KEYBOARD_SIZE*sizeof(unsigned char)); @@ -273,10 +270,8 @@ JNIEXPORT int JNICALL Java_org_lwjgl_input_Keyboard_nRead (JNIEnv * env, jclass clazz) { - XEvent event; XKeyEvent *key_event; int buf_count = 0; - int state; int num_events = 0; handleMessages(env); Index: org_lwjgl_opengl_BaseGL.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_BaseGL.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- org_lwjgl_opengl_BaseGL.cpp 21 Mar 2003 23:28:00 -0000 1.9 +++ org_lwjgl_opengl_BaseGL.cpp 27 Mar 2003 15:16:35 -0000 1.10 @@ -65,15 +65,20 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_opengl_BaseGL_nCreate (JNIEnv * env, jobject obj) { - - if (!getVisualInfo()) { + if (disp == NULL) { +#ifdef _DEBUG + printf("No display\n"); +#endif + return JNI_FALSE; + } + if (getVisualInfo() == NULL) { #ifdef _DEBUG printf("No visual info\n"); #endif return JNI_FALSE; } context = glXCreateContext(disp, getVisualInfo(), NULL, True); - if (!context) { + if (context == NULL) { #ifdef _DEBUG printf("Could not create context\n"); #endif @@ -103,9 +108,8 @@ (JNIEnv * env, jobject obj) { releaseContext(); - // Delete the rendering context - if (context != NULL) - glXDestroyContext(disp, context); + glXDestroyContext(disp, context); + context = NULL; } /* |
|
From: Elias N. <eli...@us...> - 2003-03-27 15:16:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1:/tmp/cvs-serv32760 Modified Files: config.h.in configure.in Log Message: Various linux fixes Index: config.h.in CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/config.h.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/config.h.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- config.h.in 11 Dec 2002 07:16:31 -0000 1.2 +++ config.h.in 27 Mar 2003 15:16:33 -0000 1.3 @@ -6,9 +6,6 @@ /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* Define to 1 if you have the `openal' library (-lopenal). */ -#undef HAVE_LIBOPENAL - /* Define to 1 if you have the `X11' library (-lX11). */ #undef HAVE_LIBX11 Index: configure.in CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/configure.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/configure.in,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- configure.in 16 Mar 2003 21:55:43 -0000 1.9 +++ configure.in 27 Mar 2003 15:16:34 -0000 1.10 @@ -51,8 +51,8 @@ else AC_MSG_RESULT($JAVA_HOME) JAVA_HOME="$JAVA_HOME" - CPPFLAGS="$CPPFLAGS -D_X11 -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" - CFLAGS="$CFLAGS -D_X11 -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" + CPPFLAGS="$CPPFLAGS -D_DEBUG -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" + CFLAGS="$CFLAGS -D_DEBUG -D_X11 -Wall -I$JAVA_HOME/include -I$JAVA_HOME/include/linux" fi dnl Checks for libraries. @@ -64,8 +64,6 @@ AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required)) dnl Replace `main' with a function in -lXxf86vm: AC_CHECK_LIB(Xxf86vm, main,, AC_MSG_ERROR(Xxf86vm is required)) -dnl Replace `main' with a function in -lopenal: -AC_CHECK_LIB(openal, main,, AC_MSG_ERROR(openal is required)) dnl Checks for header files. |
|
From: Elias N. <eli...@us...> - 2003-03-27 15:16:41
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv32760/common Modified Files: extgl.c Log Message: Various linux fixes Index: extgl.c CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.c =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- extgl.c 2 Jan 2003 05:44:16 -0000 1.7 +++ extgl.c 27 Mar 2003 15:16:34 -0000 1.8 @@ -2484,13 +2484,11 @@ return extgl_error; } -#ifdef _X11 void extgl_InitGLXSupportedExtensions(Display *disp, int screen) { extgl_Extensions.glx.EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info"); extgl_Extensions.glx.EXT_visual_rating = GLXQueryExtension(disp, screen, "GLX_EXT_visual_rating"); } -#endif int extgl_InitGLX(Display *disp, int screen) { @@ -3239,11 +3237,11 @@ #ifdef _X11 int extgl_Open(Display *disp, int screen) { - lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); + lib_gl_handle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL); if (lib_gl_handle == NULL) return 1; - lib_glu_handle = dlopen("libGLU.so", RTLD_LAZY | RTLD_GLOBAL); + lib_glu_handle = dlopen("libGLU.so", RTLD_NOW | RTLD_GLOBAL); if (lib_glu_handle == NULL) return 1; if (extgl_InitGLX(disp, screen) != 0) |
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-24 22:16:04
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl
In directory sc8-pr-cvs1:/tmp/cvs-serv8086/src/java/org/lwjgl
Modified Files:
Tag: experimental
Sys.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.16.2.2
retrieving revision 1.16.2.3
diff -u -d -r1.16.2.2 -r1.16.2.3
--- Sys.java 24 Mar 2003 22:12:14 -0000 1.16.2.2
+++ Sys.java 24 Mar 2003 22:15:58 -0000 1.16.2.3
@@ -124,6 +124,9 @@
}
}
+ /** The game title */
+ private static String title;
+
/**
* No constructor for Sys.
*/
@@ -283,6 +286,7 @@
public static void mainLoop(Game game) {
try {
+ title = game.getTitle();
game.init();
boolean wasMinimized = true;
@@ -333,7 +337,7 @@
}
} catch (Throwable t) {
t.printStackTrace(System.err);
- alert(game.getTitle(), "An internal error has occurred.");
+ alert(title, "An internal error has occurred.");
} finally {
try {
game.cleanup();
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-24 22:12:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl
In directory sc8-pr-cvs1:/tmp/cvs-serv1547/src/java/org/lwjgl
Modified Files:
Tag: experimental
Sys.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.16.2.1
retrieving revision 1.16.2.2
diff -u -d -r1.16.2.1 -r1.16.2.2
--- Sys.java 24 Mar 2003 21:41:12 -0000 1.16.2.1
+++ Sys.java 24 Mar 2003 22:12:14 -0000 1.16.2.2
@@ -107,10 +107,6 @@
*/
public static final boolean DEBUG;
- /** Finish flag. This will exit the game's main loop. */
- private static boolean finished;
-
-
private static boolean _debug;
static {
try {
@@ -291,11 +287,11 @@
boolean wasMinimized = true;
- while (!finished) {
+ for (;;) {
if (isCloseRequested()) {
// Immediately exit
- finished = true;
+ break;
} if (isMinimized()) {
if (!wasMinimized) {
// Set task priority to LOW.
@@ -358,13 +354,6 @@
}
}
- /**
- * Finish the main loop. This will cause the game to exit cleanly.
- */
- public static void finish() {
- finished = true;
- }
-
/**
* Swap the video buffers.
*/
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-24 22:08:54
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl
In directory sc8-pr-cvs1:/tmp/cvs-serv27883/src/java/org/lwjgl/opengl
Modified Files:
Tag: experimental
BaseGL.java GL.java CoreGL.java
Log Message:
Index: BaseGL.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/BaseGL.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -d -r1.9 -r1.9.2.1
--- BaseGL.java 21 Mar 2003 17:05:55 -0000 1.9
+++ BaseGL.java 24 Mar 2003 22:08:47 -0000 1.9.2.1
@@ -68,18 +68,46 @@
/** This GL will be valid for use in only one thread */
protected Thread renderThread;
+ /** Colour bits */
+ protected final int colorBits;
+
+ /** Alpha bits */
+ protected final int alphaBits;
+
+ /** Depth bits */
+ protected final int depthBits;
+
+ /** Stencil bits */
+ protected final int stencilBits;
+
/**
* Constructor for BaseGL. The context is not created at this point;
* to create the GL you must call create().
+ *
+ * @param colorBits The number of color bits required (typically 16 or 32)
+ * @param alphaBits The number of alpha bits required (typically 0 or 8)
+ * @param depthBits The number of depth bits required
+ * @param stencilBits The number of stencil bits required (typically 0 or 8)
+ * @param debug Debug mode
*
* @see #create()
*/
- public BaseGL() {
+ public BaseGL(int colorBits, int alphaBits, int depthBits, int stencilBits) {
+ this.colorBits = colorBits;
+ this.alphaBits = alphaBits;
+ this.depthBits = depthBits;
+ this.stencilBits = stencilBits;
}
/**
* Creates the GL, with the best match it can get for the specified
- * parameters. The display must first have been created.
+ * parameters. A window will be created for the GL to draw in which will
+ * equal or exceed the specified color, alpha, depth, and stencil requirements.
+ * If such a window cannot be created an Exception is thrown.
+ *
+ * When using the debug version of LWJGL the window created may not be fullscreen
+ * but may, according to the target platform, be a draggable window on the
+ * desktop.
*
* @throws Exception if the GL could not be created for some reason
*/
@@ -148,7 +176,7 @@
/**
* Free the context from the current thread.
*/
- public final void releaseContext() {
+ private final void releaseContext() {
assert created : "GL has not been created yet.";
renderThread = null;
currentContext = null;
@@ -158,17 +186,12 @@
/**
* Make this the current context for the current thread.
*/
- public final void makeCurrent() {
+ private final void makeCurrent() {
assert created : "GL has not been created yet.";
renderThread = Thread.currentThread();
currentContext = this;
nMakeCurrent();
}
-
- /**
- * Swap the buffers
- */
- public native void swapBuffers();
/**
* Native method to free the context
Index: GL.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GL.java,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -d -r1.17 -r1.17.2.1
--- GL.java 6 Mar 2003 20:54:03 -0000 1.17
+++ GL.java 24 Mar 2003 22:08:48 -0000 1.17.2.1
@@ -37,8 +37,6 @@
import java.util.HashMap;
import java.util.StringTokenizer;
-import org.lwjgl.Display;
-
/**
* $Id$
*
@@ -52,13 +50,7 @@
public native void activeTextureARB(int texture);
[...1039 lines suppressed...]
- if(org.lwjgl.Sys.DEBUG) {
- System.out.println("Available WGL extensions:");
- }
+ if (org.lwjgl.Sys.DEBUG) {
+ System.out.println("Available WGL extensions:");
+ }
StringTokenizer st = new StringTokenizer(exts);
while (st.hasMoreTokens()) {
String ext = st.nextToken();
- if(org.lwjgl.Sys.DEBUG) {
- System.out.println(ext);
- }
+ if (org.lwjgl.Sys.DEBUG) {
+ System.out.println(ext);
+ }
Field f = (Field) map.get(ext);
if (f != null) {
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.11
retrieving revision 1.11.2.1
diff -u -d -r1.11 -r1.11.2.1
--- CoreGL.java 17 Feb 2003 15:13:40 -0000 1.11
+++ CoreGL.java 24 Mar 2003 22:08:48 -0000 1.11.2.1
@@ -44,9 +44,13 @@
/**
* Constructor for CoreGL.
+ * @param colorBits The number of color bits required (typically 16 or 32)
+ * @param alphaBits The number of alpha bits required (typically 0 or 8)
+ * @param depthBits The number of depth bits required
+ * @param stencilBits The number of stencil bits required (typically 0 or 8)
*/
- public CoreGL() {
- super();
+ public CoreGL(int colorBits, int alphaBits, int depthBits, int stencilBits) {
+ super(colorBits, alphaBits, depthBits, stencilBits);
}
public native void accum(int op, float value);
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-24 21:44:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl
In directory sc8-pr-cvs1:/tmp/cvs-serv24740/src/java/org/lwjgl
Modified Files:
Tag: experimental
Display.java
Log Message:
Index: Display.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v
retrieving revision 1.19.2.1
retrieving revision 1.19.2.2
diff -u -d -r1.19.2.1 -r1.19.2.2
--- Display.java 24 Mar 2003 21:41:09 -0000 1.19.2.1
+++ Display.java 24 Mar 2003 21:44:08 -0000 1.19.2.2
@@ -147,4 +147,45 @@
return currentMode;
}
+ /**
+ * Retrieves the current display frequency of the created display.
+ * This will be 0 if the frequency cannot be determined.
+ *
+ * @return the current display frequency.
+ * @throws AssertionError if the display has not been created yet.
+ */
+ public static int getFrequency() {
+ return currentMode.freq;
+ }
+
+ /**
+ * Retrieves the current display depth of the created display
+ *
+ * @return the current display depth.
+ * @throws AssertionError if the display has not been created yet.
+ */
+ public static int getDepth() {
+ return currentMode.bpp;
+ }
+
+ /**
+ * Retrieves the height of the created display
+ *
+ * @return the current display height.
+ * @throws AssertionError if the display has not been created yet.
+ */
+ public static int getHeight() {
+ return currentMode.height;
+ }
+
+ /**
+ * Retrieves the width of the created display
+ *
+ * @return the current display width.
+ * @throws AssertionError if the display has not been created yet.
+ */
+ public static int getWidth() {
+ return currentMode.width;
+ }
+
}
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-24 21:42:22
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input
In directory sc8-pr-cvs1:/tmp/cvs-serv21875/src/java/org/lwjgl/input
Modified Files:
Tag: experimental
Controller.java Mouse.java Keyboard.java
Log Message:
Index: Controller.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Controller.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Controller.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- Controller.java 10 Feb 2003 23:07:12 -0000 1.3
+++ Controller.java 24 Mar 2003 21:42:15 -0000 1.3.2.1
@@ -211,4 +211,12 @@
* Register fields with the native library
*/
private static native void initIDs();
+
+ /**
+ * @return true if the controller has been created.
+ */
+ public static boolean isCreated() {
+ return created;
+ }
+
}
Index: Mouse.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/input/Mouse.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -d -r1.14 -r1.14.2.1
--- Mouse.java 17 Mar 2003 18:57:05 -0000 1.14
+++ Mouse.java 24 Mar 2003 21:42:15 -0000 1.14.2.1
@@ -32,7 +32,6 @@
package org.lwjgl.input;
-import org.lwjgl.Display;
import org.lwjgl.Sys;
/**
@@ -102,8 +101,6 @@
public static void create() throws Exception {
if (created)
return;
- if (!Display.isCreated())
- throw new Exception("The display has not yet been created.");
if (!nCreate())
throw new Exception("The mouse could not be created.");
created = true;
@@ -153,5 +150,12 @@
public static boolean isButtonDown(int button) {
assert created : "The mouse has not been created.";
return Mouse.buttons[button];
+ }
+
+ /**
+ * @return true if the mouse has been created.
+ */
+ public static boolean isCreated() {
+ return created;
}
}
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.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- Keyboard.java 11 Jan 2003 23:09:38 -0000 1.16
+++ Keyboard.java 24 Mar 2003 21:42:15 -0000 1.16.2.1
@@ -35,7 +35,6 @@
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import org.lwjgl.Display;
import org.lwjgl.Sys;
/**
@@ -249,8 +248,6 @@
public static void create() throws Exception {
if (created)
return;
- if (!Display.isCreated())
- throw new Exception("The display has not yet been created.");
if (!nCreate())
throw new Exception("The keyboard could not be created.");
created = true;
@@ -344,6 +341,13 @@
}
/**
+ * @return true if keyboard buffering is enabled
+ */
+ public static boolean isBufferEnabled() {
+ return readBuffer != null;
+ }
+
+ /**
* Native method to enable the buffer
* @return the size of the buffer allocated, in events (1 event is 2 bytes),
* or 0 if no buffer can be allocated
@@ -389,4 +393,12 @@
} else
return false;
}
+
+ /**
+ * @return true if the keyboard has been created.
+ */
+ public static boolean isCreated() {
+ return created;
+ }
+
}
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-24 21:41:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl
In directory sc8-pr-cvs1:/tmp/cvs-serv20215/src/java/org/lwjgl
Modified Files:
Tag: experimental
Display.java Sys.java
Log Message:
Index: Display.java
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java
===================================================================
RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -u -d -r1.19 -r1.19.2.1
--- Display.java 21 Mar 2003 17:05:55 -0000 1.19
+++ Display.java 24 Mar 2003 21:41:09 -0000 1.19.2.1
@@ -37,9 +37,7 @@
/**
* $Id$
*
- * Encapsulates everything you need for game display.
- * It must be created before any input devices are created.
- * The game display has NO mouse cursor or any other window decorations.
+ * Methods for setting and querying display resolution.
*
* @author cix_foo <ci...@us...>
* @version $Revision$
@@ -47,15 +45,11 @@
public final class Display {
- static {
- System.loadLibrary(Sys.getLibraryName());
- }
-
- /** Has the display been created? */
- private static boolean created;
+ /** The initial display mode. Initialized on library load. */
+ private static DisplayMode initialMode;
- /** The current display mode, if created */
- private static DisplayMode mode;
+ /** The current display mode */
+ private static DisplayMode currentMode;
/** A pointer to the native display window. On Windows this will be an hWnd. */
private static int handle;
@@ -63,26 +57,24 @@
/** 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;
+ static {
+ System.loadLibrary(Sys.getLibraryName());
+ init();
+ currentMode = initialMode;
+ }
- /** MacOSX platform */
- public static final int PLATFORM_AGL = 2;
-
/**
* No construction allowed.
*/
private Display() {
super();
}
+
+ /**
+ * Initialize the Display class. This finds the initial display mode by
+ * querying the O/S.
+ */
+ private static native void init();
/**
* Returns the entire list of display modes as an array, in no
@@ -116,123 +108,32 @@
/**
* Native method for getting displaymodes
*/
- public static native DisplayMode[] nGetAvailableDisplayModes();
+ private static native DisplayMode[] nGetAvailableDisplayModes();
/**
- * Create a display with the specified display mode. If the display is
- * already created then no action is taken - the display must first be
- * destroyed.
- *
+ * Set the current display mode. The actual display mode set by the O/S
+ * may not match exactly the mode specified; for example, if frequency
+ * is 0 then the O/S will choose a default frequency.
+ *
* @param displayMode A display mode to choose
- * @param alpha Minimun number of alpha bits on the display
- * @param depth Minimun number of depth bits on the display
- * @param stencil Minimun number of stencil bits on the display
- * @param fullscreen Whether to create the display fullscreen
- * @param title The title for the application
+ * @return the actual display mode set
* @throws Exception if the display mode could not be set
* @see #destroy()
*/
- public static void create(DisplayMode displayMode, int alpha, int depth, int stencil, boolean fullscreen, String title)
- throws Exception {
-
- if (created) {
- return;
- }
-
- if (!nCreate(displayMode.width,
- displayMode.height,
- displayMode.bpp,
- displayMode.freq,
- alpha,
- depth,
- stencil,
- fullscreen,
- title)) {
- throw new Exception("Failed to set display mode to " + displayMode);
- }
-
- created = true;
- mode = displayMode;
- }
-
- /**
- * Native method to create the display. This will set the handle if it is
- * successful.
- * @return true if the display was successfully created
- * @see #create(org.lwjgl.DisplayMode, boolean)
- */
- private static native boolean nCreate(
- int width,
- int height,
- int bpp,
- int freq,
- int alpha_bits,
- int depth_bits,
- int stencil_bits,
- boolean fullscreen,
- String title);
+ public static native DisplayMode setDisplayMode(DisplayMode displayMode) throws Exception;
/**
- * Destroy the display and return it to normal. If the display has not yet
- * been created no action is taken.
+ * Reset the display back to its initial display mode. This method should
+ * always be called before the application exits.
*/
- public static void destroy() {
- if (!created) {
- return;
+ public static void resetDisplayMode() {
+ try {
+ if (!currentMode.equals(initialMode))
+ setDisplayMode(initialMode);
+ } catch (Exception e) {
+ System.err.println("Failed to reset display mode!");
+ e.printStackTrace(System.err);
}
-
- nDestroy();
- created = false;
- mode = null;
- }
-
- /**
- * Native method to destroy the display. This will reset the handle.
- */
- private static native void nDestroy();
-
- /**
- * Retrieves the width of the created display
- *
- * @return the current display width.
- * @throws AssertionError if the display has not been created yet.
- */
- public static int getWidth() {
- assert created : "The display has not been created yet.";
- return mode.width;
- }
-
- /**
- * Retrieves the height of the created display
- *
- * @return the current display height.
- * @throws AssertionError if the display has not been created yet.
- */
- public static int getHeight() {
- assert created : "The display has not been created yet.";
- return mode.height;
- }
-
- /**
- * Retrieves the current display depth of the created display
- *
- * @return the current display depth.
- * @throws AssertionError if the display has not been created yet.
- */
- public static int getDepth() {
- assert created : "The display has not been created yet.";
- return mode.bpp;
- }
-
- /**
- * Retrieves the current display frequency of the created display
- *
- * @return the current display frequency.
- * @throws AssertionError if the display has not been created yet.
- */
- public static int getFrequency() {
- assert created : "The display has not been created yet.";
- return mode.freq;
}
/**
@@ -243,61 +144,7 @@
* @throws AssertionError if the display has not been created yet.
*/
public static DisplayMode getDisplayMode() {
- assert created : "The display has not been created yet.";
- return mode;
- }
-
- /**
- * Retrieves the native handle to the created window
- *
- * @return the native handle
- * @throws AssertionError if the display has not been created yet.
- */
- public static int getHandle() {
- assert created : "The display has not been created yet.";
- return handle;
- }
-
- /**
- * Tests whether or not the display has been created
- *
- * @return true if the display has been created
- */
- public static boolean isCreated() {
- return created;
- }
-
- /**
- * Determines if the display is minimized. When the display is minimized it is
- * effectively invisible, and you need perform no rendering in your game loop.
- * On the native side, when the application is switched to some other application,
- * the display window will minimize; when focus is regained, it will maximize and
- * automatically gain focus and become the foreground window again.
- * @return true if the display is minimized
- */
- public static native boolean isMinimized();
-
- /**
- * Determines if the user has requested that the application should close.
- * When a user has requested that the application should shutdown, it is up to
- * the application to perform the actual shutdown and cleanup of any allocated
- * resources.
- *
- * @return true if the user has requested that the application should close
- */
- public static boolean isCloseRequested() {
- return closeRequested;
+ return currentMode;
}
-
- /**
- * 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();
-
}
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.16
retrieving revision 1.16.2.1
diff -u -d -r1.16 -r1.16.2.1
--- Sys.java 21 Mar 2003 17:05:56 -0000 1.16
+++ Sys.java 24 Mar 2003 21:41:12 -0000 1.16.2.1
@@ -35,6 +35,10 @@
import java.nio.Buffer;
import java.nio.ByteBuffer;
+import org.lwjgl.input.*;
+import org.lwjgl.input.Keyboard;
+import org.lwjgl.input.Mouse;
+
/**
* $Id$
*
@@ -44,6 +48,12 @@
* @version $Revision$
*/
public final class Sys {
+
+ /**
+ * The LWJGL version sequence number. This is used to check that the Java
+ * code is loading the correct version of the native library.
+ */
+ public static final int VERSION = 1;
/** Low process priority. @see #setProcessPriority() */
public static final int LOW_PRIORITY = -1;
@@ -77,12 +87,29 @@
/** The native library name */
private static String LIBRARY_NAME;
+ /*
+ * 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;
+
/**
* Debug flag. This will tell you if you are using the debug version of
* the library, and whether assertions are enabled or not.
*/
public static final boolean DEBUG;
+ /** Finish flag. This will exit the game's main loop. */
+ private static boolean finished;
+
private static boolean _debug;
static {
@@ -101,14 +128,6 @@
}
}
-
- /**
- * @return the name of the native library to load
- */
- public static String getLibraryName() {
- return LIBRARY_NAME;
- }
-
/**
* No constructor for Sys.
*/
@@ -120,6 +139,13 @@
*/
private static void initialize() {
System.loadLibrary(LIBRARY_NAME);
+
+ // Check the library version is correct. If not, we'll bung up an alert
+ // and bail out.
+ if (getVersion() != VERSION) {
+ alert("LWJGL", "The LWJGL dll version is incorrect. You have a lwjgl.dll somewhere in your path which should be removed, or an incorrect installation of this application.");
+ throw new RuntimeException("Mismatched DLL version.");
+ }
setTime(0);
}
@@ -175,7 +201,7 @@
* differences in operating systems this might or might not have any effect or
* the correct effect.
*
- * The default process priority is NORMAL_PRIORITY.
+ * The default process priority is HIGH_PRIORITY.
*
* REALTIME_PRIORITY processes should theoretically be the maximum priority of
* any process on the system and may have side effects on I/O and other fundamental
@@ -189,7 +215,7 @@
* @param priority a priority class, which will be one of REALTIME_PRIORITY,
* HIGH_PRIORITY, NORMAL_PRIORITY, or LOW_PRIORITY.
*/
- public static native void setProcessPriority(int priority);
+ private static native void setProcessPriority(int priority);
/**
* Attempt to display a modal alert to the user. This method should be used
@@ -209,5 +235,141 @@
* @param message The message text for the alert.
*/
public static native void alert(String title, String message);
+
+ /**
+ * Determines if the display is minimized. When the display is minimized it is
+ * effectively invisible, and you need perform no rendering in your game loop.
+ * On the native side, when the application is switched to some other application,
+ * the display window will minimize; when focus is regained, it will maximize and
+ * automatically gain focus and become the foreground window again.
+ * @return true if the display is minimized
+ */
+ private static native boolean isMinimized();
+
+ /**
+ * Determines if the user has requested that the application should close.
+ * When a user has requested that the application should shutdown, it is up to
+ * the application to perform the actual shutdown and cleanup of any allocated
+ * resources.
+ *
+ * @return true if the user has requested that the application should close
+ */
+ private static native boolean isCloseRequested();
+
+ /**
+ * 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();
+
+ /**
+ * Gets the native library version sequence number. This should match the VERSION
+ * constant defined here.
+ * @return the native version sequence number
+ */
+ private static native int getVersion();
+
+ /**
+ * @return the name of the native library to load
+ */
+ public static String getLibraryName() {
+ return LIBRARY_NAME;
+ }
+
+ /**
+ * Run the game.
+ * @param game The Game to run
+ */
+ public static void mainLoop(Game game) {
+ try {
+
+ game.init();
+
+ boolean wasMinimized = true;
+
+ while (!finished) {
+
+ if (isCloseRequested()) {
+ // Immediately exit
+ finished = true;
+ } if (isMinimized()) {
+ if (!wasMinimized) {
+ // Set task priority to LOW.
+ setProcessPriority(LOW_PRIORITY);
+ wasMinimized = true;
+ }
+ long then = getTime();
+ game.idle();
+ long now = getTime();
+ // CPU throttle
+ float timeTaken = ((float)(then - now)) / (float)getTimerResolution();
+ try {
+ Thread.sleep(java.lang.Math.min(1, (int)(timeTaken * 1000.0f)));
+ } catch (InterruptedException e) {
+ }
+ } else {
+ if (wasMinimized) {
+ // Return task priority to HIGH (or NORMAL, if in debug mode)
+ setProcessPriority(DEBUG ? NORMAL_PRIORITY : HIGH_PRIORITY);
+ wasMinimized = false;
+ }
+ // Poll all input devices
+ if (Mouse.isCreated())
+ Mouse.poll();
+ if (Keyboard.isCreated()) {
+ Keyboard.poll();
+ if (Keyboard.isBufferEnabled())
+ Keyboard.read();
+ }
+ if (Controller.isCreated())
+ Controller.poll();
+
+ // Perform one tick
+ game.tick();
+
+ // Swap video buffers
+ swapBuffers();
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace(System.err);
+ alert(game.getTitle(), "An internal error has occurred.");
+ } finally {
+ try {
+ game.cleanup();
+ } catch (Throwable t) {
+ t.printStackTrace(System.err);
+ }
+
+ System.runFinalization();
+
+ // Just in case
+ if (Mouse.isCreated())
+ Mouse.destroy();
+ if (Keyboard.isCreated())
+ Keyboard.destroy();
+ if (Controller.isCreated())
+ Controller.destroy();
+ Display.resetDisplayMode();
+ }
+ }
+
+ /**
+ * Finish the main loop. This will cause the game to exit cleanly.
+ */
+ public static void finish() {
+ finished = true;
+ }
+ /**
+ * Swap the video buffers.
+ */
+ private static native void swapBuffers();
+
+
+
}
|
|
From: Caspian Rychlik-P. <ci...@us...> - 2003-03-24 21:38:45
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl
In directory sc8-pr-cvs1:/tmp/cvs-serv17186/src/java/org/lwjgl
Added Files:
Tag: experimental
Game.java
Log Message:
--- NEW FILE: Game.java ---
CVS Browser:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Game.java
/*
* Created on 24-Mar-2003
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code Template
*/
package org.lwjgl;
/**
* To ensure the LWJGL is used correctly in a platform-independent manner that
* will behave impeccably on all systems we provide a main loop for games written
* using the LWJGL. The Game interface should be implemented by your game itself
* to perform all the things it needs to do during the normal course of running
* a game.
*
* @author foo
*/
public interface Game {
/**
* This is called to initialize your game. Here you should set the display mode,
* create GL and AL, and create any input devices such as Mouse, Keyboard, and
* Controller.
*
* Should your initialization fail for any reason, throw an Exception. The
* cleanup() method will be called and then the application will terminate.
*
* @throws Exception if initialization fails
*/
public void init() throws Exception;
/**
* This is called to cleanup when your game terminates, for any reason. This
* method is always called when the game exits, except in the case of a JVM
* crash.
*/
public void cleanup();
/**
* Frame tick. This is the main loop of the game. Every video frame this method
* is called, allowing you to perform game logic, and then render your frame.
*
* Important note: all input device polling is done for you before tick() is called.
* After tick() returns, doubble buffer swapping is automatically done for you.
*/
public void tick();
/**
* Idle tick. This is called instead of tick() when the application is minimized.
* You are automatically restricted to 50% CPU during idle tick. You should perform
* no rendering. Ideally your game should pause completely and this method should be
* a no-op.
*
* Use the idle tick to process network protocols whilst the game is minimized.
*/
public void idle();
/**
* @return the title of your game. Must be non-null.
*/
public String getTitle();
}
|