Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5804/test/input Modified Files: ControllerCreationTest.java ControllerTest.java HWCursorTest.java MouseCreationTest.java MouseTest.java Log Message: fixed tests according to new way cleaned up imports Index: ControllerCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerCreationTest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- ControllerCreationTest.java 26 Mar 2004 15:03:07 -0000 1.23 +++ ControllerCreationTest.java 26 Mar 2004 21:57:56 -0000 1.24 @@ -37,7 +37,6 @@ import org.lwjgl.input.Controller; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.opengl.glu.GLU; import org.lwjgl.vector.Vector2f; /** @@ -89,7 +88,6 @@ private void initializeOpenGL() { GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - GLU.gluOrtho2D(0.0f, 640f, 0f, 480f); } public void executeTest() { @@ -101,9 +99,7 @@ System.out.println("=========== WINDOWED MODE =============="); for(int i=0; i<2; i++) { System.out.println("Test " + (i+1) + ":"); - createController(); wiggleController(); - destroyController(); System.out.println(""); } @@ -127,31 +123,17 @@ System.out.println("=========== FULLSCREEN MODE =============="); for(int i=0; i<2; i++) { System.out.println("Test " + (i+3) + ":"); - createController(); wiggleController(); - destroyController(); System.out.println(""); } System.out.println("Test completed successfully!"); System.out.print("Shutting down..."); Display.resetDisplayMode(); - Controller.destroy(); Window.destroy(); System.out.println("shutdown complete"); } - private void createController() { - System.out.print("Creating controller..."); - try { - Controller.create(); - } catch (Exception e) { - System.out.println("failed"); - System.exit(-1); - } - System.out.println("success"); - } - private void wiggleController() { System.out.print("Please move the controller around"); @@ -161,8 +143,6 @@ while (Sys.getTime() < endtime) { Window.update(); - - Controller.poll(); //controller is a bit fuzzy if(Controller.getX() > 100) { @@ -186,12 +166,6 @@ System.out.println("thank you"); } - private void destroyController() { - System.out.print("Destroying controller..."); - Controller.destroy(); - System.out.print("success"); - } - private void render() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); Index: ControllerTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/ControllerTest.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- ControllerTest.java 26 Mar 2004 15:03:07 -0000 1.20 +++ ControllerTest.java 26 Mar 2004 21:57:56 -0000 1.21 @@ -35,7 +35,6 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.opengl.glu.GLU; import org.lwjgl.vector.Vector2f; import org.lwjgl.vector.Vector3f; @@ -106,9 +105,6 @@ private void initialize() { // create display and opengl setupDisplay(); - - createController(); - createKeyboard(); } /** @@ -136,7 +132,6 @@ */ private void initializeOpenGL() { GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - GLU.gluOrtho2D(0.0f, WINDOW_WIDTH, 0, WINDOW_HEIGHT); } /** @@ -147,36 +142,8 @@ runTest(); - Controller.destroy(); - Keyboard.destroy(); Window.destroy(); } - - /** - * Creates the controller - */ - private void createController() { - try { - Controller.create(); - } catch (Exception e) { - e.printStackTrace(); - System.out.println("No controller found, exiting..."); - System.exit(-1); - } - } - - /** - * Creates the keyboard - */ - private void createKeyboard() { - try { - Keyboard.create(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } - /** * Runs the test */ @@ -195,10 +162,8 @@ // pause and continue if minimized if(Window.isMinimized()) { - if(Window.isDirty()) { - render(); - } pause(100); + render(); continue; } @@ -242,9 +207,6 @@ * Reads the controller */ private void readController() { - // poll for current values - Controller.poll(); - // get last button down for(int i=0;i<Controller.getButtonCount(); i++) { if(Controller.isButtonDown(i)) { @@ -346,8 +308,6 @@ * Handles the keyboard */ private void handleKeyboard() { - Keyboard.poll(); - // closing on ESCAPE if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { closing = true; Index: MouseCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseCreationTest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- MouseCreationTest.java 26 Mar 2004 15:03:07 -0000 1.27 +++ MouseCreationTest.java 26 Mar 2004 21:57:56 -0000 1.28 @@ -37,7 +37,6 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.opengl.glu.GLU; import org.lwjgl.vector.Vector2f; /** @@ -89,7 +88,6 @@ private void initializeOpenGL() { GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - GLU.gluOrtho2D(0.0f, 640f, 0f, 480f); } public void executeTest() { @@ -101,9 +99,7 @@ System.out.println("=========== WINDOWED MODE =============="); for(int i=0; i<2; i++) { System.out.println("Test " + (i+1) + ":"); - createMouse(); wiggleMouse(); - destroyMouse(); System.out.println(""); } @@ -127,31 +123,17 @@ System.out.println("=========== FULLSCREEN MODE =============="); for(int i=0; i<2; i++) { System.out.println("Test " + (i+3) + ":"); - createMouse(); wiggleMouse(); - destroyMouse(); System.out.println(""); } System.out.println("Test completed successfully!"); System.out.print("Shutting down..."); Display.resetDisplayMode(); - Mouse.destroy(); Window.destroy(); System.out.println("shutdown complete"); } - private void createMouse() { - System.out.print("Creating mouse..."); - try { - Mouse.create(); - } catch (Exception e) { - System.out.println("failed"); - System.exit(-1); - } - System.out.println("success"); - } - private void wiggleMouse() { System.out.print("Please move the mouse around"); @@ -161,8 +143,6 @@ while (Sys.getTime() < endtime) { Window.update(); - Mouse.poll(); - position.x += Mouse.getDX(); position.y += Mouse.getDY(); @@ -188,12 +168,6 @@ System.out.println("thank you"); } - private void destroyMouse() { - System.out.print("Destroying mouse..."); - Mouse.destroy(); - System.out.print("success"); - } - private void render() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); Index: HWCursorTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/HWCursorTest.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- HWCursorTest.java 26 Mar 2004 15:03:07 -0000 1.28 +++ HWCursorTest.java 26 Mar 2004 21:57:56 -0000 1.29 @@ -260,9 +260,6 @@ * Processes keyboard input */ private void processKeyboard() { - Keyboard.poll(); - Mouse.poll(); - if (Mouse.getDX() != 0 || Mouse.getDY() != 0) { mouse_x += Mouse.getDX() / 2; mouse_y += Mouse.getDY() / 2; Index: MouseTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/input/MouseTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- MouseTest.java 26 Mar 2004 15:03:07 -0000 1.29 +++ MouseTest.java 26 Mar 2004 21:57:56 -0000 1.30 @@ -35,7 +35,6 @@ import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.Window; -import org.lwjgl.opengl.glu.GLU; import org.lwjgl.vector.Vector2f; import org.lwjgl.vector.Vector3f; @@ -95,11 +94,6 @@ /** Fullscreen or not */ public static final boolean FULLSCREEN = false; - /** Buffered mouse or not */ - public static final boolean BUFFERED_MOUSE = true; - - private int bufferSize; - /** Creates a new instance of MouseTest */ public MouseTest() { } @@ -108,8 +102,8 @@ // create display and opengl setupDisplay(); - createMouse(); - createKeyboard(); + setupMouse(); + setupKeyboard(); } /** @@ -137,7 +131,6 @@ */ private void initializeOpenGL() { GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - GLU.gluOrtho2D(0.0f, WINDOW_WIDTH, 0, WINDOW_HEIGHT); } /** @@ -148,43 +141,19 @@ runTest(); - Mouse.destroy(); - Keyboard.destroy(); Window.destroy(); } /** * Creates the mouse */ - private void createMouse() { - try { - Mouse.create(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - - // if compiled for buffered mode, enable that - if(BUFFERED_MOUSE) { - try { - Mouse.enableBuffer(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } + private void setupMouse() { } /** * Creates the keyboard */ - private void createKeyboard() { - try { - Keyboard.create(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } + private void setupKeyboard() { } /** @@ -245,23 +214,13 @@ * handles the mouse */ private void handleMouse() { - if(BUFFERED_MOUSE) { - readBufferedMouse(); - } else { - readUnbufferedMouse(); - } + readBufferedMouse(); } /** * reads a mouse in buffered mode */ private void readBufferedMouse() { - // poll for current values - Mouse.poll(); - - // read events - Mouse.read(); - // iterate all events, use the last button down while(Mouse.next()) { if(Mouse.getEventButtonState()) { @@ -271,23 +230,6 @@ updateState(); } - - /** - * Reads the mouse in unbuffered mode - */ - private void readUnbufferedMouse() { - // poll for current values - Mouse.poll(); - - // get last button down - for(int i=0;i<Mouse.getButtonCount(); i++) { - if(Mouse.isButtonDown(i)) { - lastButton = i; - } - } - - updateState(); - } /** * Updates our "model" @@ -300,7 +242,6 @@ if (Mouse.getDX() == Mouse.getDY() && Mouse.getDX() == 0 && Mouse.getDWheel() == 0) { return; } - // determine direction moved // ============================ if(Mouse.getDX() > 0) { @@ -371,8 +312,6 @@ * Handles the keyboard */ private void handleKeyboard() { - Keyboard.poll(); - // closing on ESCAPE if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { closing = true; |