removed usage of native glu

using getters
This commit is contained in:
Brian Matzon 2004-02-04 21:46:13 +00:00
parent 924398d3c6
commit b3e651c093
4 changed files with 38 additions and 46 deletions

View File

@ -37,7 +37,7 @@ import org.lwjgl.DisplayMode;
import org.lwjgl.input.Controller; import org.lwjgl.input.Controller;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.Window; import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU; import org.lwjgl.opengl.glu.GLU;
import org.lwjgl.vector.Vector2f; import org.lwjgl.vector.Vector2f;
/** /**
@ -89,7 +89,7 @@ public class ControllerCreationTest {
private void initializeOpenGL() { private void initializeOpenGL() {
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLU.gluOrtho2D(0.0, 640, 0, 480); GLU.gluOrtho2D(0.0f, 640f, 0f, 480f);
} }
public void executeTest() { public void executeTest() {

View File

@ -34,6 +34,7 @@ package org.lwjgl.test.input;
import org.lwjgl.*; import org.lwjgl.*;
import org.lwjgl.input.*; import org.lwjgl.input.*;
import org.lwjgl.opengl.*; import org.lwjgl.opengl.*;
import org.lwjgl.opengl.glu.GLU;
import java.nio.*; import java.nio.*;
@ -50,9 +51,6 @@ public class HWCursorTest {
/** Intended deiplay mode */ /** Intended deiplay mode */
private DisplayMode mode; private DisplayMode mode;
/** GLU instance */
private GLU glu;
/** The native cursor */ /** The native cursor */
private static Cursor cursor = null; private static Cursor cursor = null;

View File

@ -35,7 +35,7 @@ import org.lwjgl.DisplayMode;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.Window; import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU; import org.lwjgl.opengl.glu.GLU;
import org.lwjgl.vector.Vector2f; import org.lwjgl.vector.Vector2f;
/** /**
@ -48,9 +48,6 @@ import org.lwjgl.vector.Vector2f;
*/ */
public class KeyboardTest { public class KeyboardTest {
/** GLU instance */
private GLU glu;
/** position of quad to draw */ /** position of quad to draw */
private Vector2f position = new Vector2f(320.0f, 240.0f); private Vector2f position = new Vector2f(320.0f, 240.0f);
@ -90,7 +87,7 @@ public class KeyboardTest {
private void initializeOpenGL() { private void initializeOpenGL() {
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLU.gluOrtho2D(0.0, 640, 0, 480); GLU.gluOrtho2D(0.0f, 640f, 0f, 480f);
} }
public void executeTest() { public void executeTest() {
@ -120,7 +117,7 @@ public class KeyboardTest {
while (!Window.isCloseRequested()) { while (!Window.isCloseRequested()) {
Window.update(); Window.update();
if(Window.isMinimized()) { if (Window.isMinimized()) {
try { try {
Thread.sleep(100); Thread.sleep(100);
} catch (InterruptedException inte) { } catch (InterruptedException inte) {
@ -134,10 +131,11 @@ public class KeyboardTest {
Keyboard.read(); Keyboard.read();
int count = Keyboard.getNumKeyboardEvents(); int count = Keyboard.getNumKeyboardEvents();
while(Keyboard.next()) { while (Keyboard.next()) {
System.out.println("Checking key:" + Keyboard.getKeyName(Keyboard.getEventKey())); System.out.println("Checking key:" + Keyboard.getKeyName(Keyboard.getEventKey()));
System.out.println("Key character: " + Keyboard.getCharacter()); System.out.println("Key character: " + Keyboard.getCharacter());
if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) {
return; return;
} }
@ -157,15 +155,15 @@ public class KeyboardTest {
position.y -= 1; position.y -= 1;
} }
if(Keyboard.isStateKeySet(Keyboard.KEY_SCROLL) == Keyboard.STATE_ON) { if (Keyboard.isStateKeySet(Keyboard.KEY_SCROLL) == Keyboard.STATE_ON) {
System.out.println("SCROLL lock on"); System.out.println("SCROLL lock on");
} }
if(Keyboard.isStateKeySet(Keyboard.KEY_CAPITAL) == Keyboard.STATE_ON) { if (Keyboard.isStateKeySet(Keyboard.KEY_CAPITAL) == Keyboard.STATE_ON) {
System.out.println("CAPS lock on"); System.out.println("CAPS lock on");
} }
if(Keyboard.isStateKeySet(Keyboard.KEY_NUMLOCK) == Keyboard.STATE_ON) { if (Keyboard.isStateKeySet(Keyboard.KEY_NUMLOCK) == Keyboard.STATE_ON) {
System.out.println("NUM lock on"); System.out.println("NUM lock on");
} }
} }
@ -173,19 +171,18 @@ public class KeyboardTest {
System.out.println(); System.out.println();
} }
if(position.x<0) { if (position.x < 0) {
position.x = 0; position.x = 0;
} else if (position.x>640-60) { } else if (position.x > 640 - 60) {
position.x = 640-60; position.x = 640 - 60;
} }
if(position.y < 0) { if (position.y < 0) {
position.y = 0; position.y = 0;
} else if (position.y>480-30) { } else if (position.y > 480 - 30) {
position.y = 480-30; position.y = 480 - 30;
} }
render(); render();
Window.paint(); Window.paint();

View File

@ -37,7 +37,7 @@ import org.lwjgl.DisplayMode;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.Window; import org.lwjgl.opengl.Window;
import org.lwjgl.opengl.GLU; import org.lwjgl.opengl.glu.GLU;
import org.lwjgl.vector.Vector2f; import org.lwjgl.vector.Vector2f;
/** /**
@ -49,9 +49,6 @@ import org.lwjgl.vector.Vector2f;
* @version $Revision$ * @version $Revision$
*/ */
public class MouseCreationTest { public class MouseCreationTest {
/** GLU instance */
private GLU glu;
/** position of quad to draw */ /** position of quad to draw */
private Vector2f position = new Vector2f(320.0f, 240.0f); private Vector2f position = new Vector2f(320.0f, 240.0f);
@ -92,7 +89,7 @@ public class MouseCreationTest {
private void initializeOpenGL() { private void initializeOpenGL() {
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLU.gluOrtho2D(0.0, 640, 0, 480); GLU.gluOrtho2D(0.0f, 640f, 0f, 480f);
} }
public void executeTest() { public void executeTest() {