Simplification work
This commit is contained in:
parent
1c98b2e5f6
commit
fca57cefd5
|
@ -219,6 +219,21 @@ public class Controller {
|
|||
return buttons[button];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the controller is buffered
|
||||
*/
|
||||
public static boolean isBuffered() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the controller's input buffer. This is not yet implemented in LWJGL so
|
||||
* it always throws a RuntimeException.
|
||||
*/
|
||||
public static void read() {
|
||||
throw new RuntimeException("Buffering is not implemented for Controllers.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a button's name
|
||||
* @param button The button
|
||||
|
|
|
@ -422,6 +422,20 @@ public class Keyboard {
|
|||
assert created : "The keyboard has not been created.";
|
||||
return keyDownBuffer.get(key) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if buffering is enabled
|
||||
*/
|
||||
public static boolean isBuffered() {
|
||||
return readBuffer != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if translation is enabled
|
||||
*/
|
||||
public static boolean isTranslationEnabled() {
|
||||
return translationEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether one of the state keys are "active"
|
||||
|
|
|
@ -169,7 +169,7 @@ public class Mouse {
|
|||
currentCursor = cursor;
|
||||
if (currentCursor != null) {
|
||||
nSetNativeCursor(currentCursor.getHandle());
|
||||
currentCursor.setTimeout();
|
||||
currentCursor.setTimeout();
|
||||
} else {
|
||||
nSetNativeCursor(0);
|
||||
}
|
||||
|
@ -273,6 +273,13 @@ public class Mouse {
|
|||
public static boolean isCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if buffering is enabled
|
||||
*/
|
||||
public static boolean isBuffered() {
|
||||
return readBuffer != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Destroy" the mouse. Remember to reset the native cursor if
|
||||
|
@ -515,7 +522,7 @@ public class Mouse {
|
|||
|
||||
/**
|
||||
* Updates the cursor, so that animation can be changed if needed.
|
||||
* This method is called automatically by the window on its update.
|
||||
* This method is called automatically by the window on its update.
|
||||
*/
|
||||
public static void updateCursor() {
|
||||
if(currentCursor != null && currentCursor.hasTimedOut()) {
|
||||
|
|
|
@ -273,6 +273,7 @@ public final class Window {
|
|||
* Create a fullscreen window that matches the current display depth. Default common values are chosen
|
||||
* for common OpenGL rendering operations: you will get at least a 16-bit depth buffer, an 8 bit stencil
|
||||
* buffer, probably no alpha buffer, and probably no multisampling.
|
||||
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
|
||||
* @param title
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -284,7 +285,7 @@ public final class Window {
|
|||
* Create a fullscreen window. If the underlying OS does not
|
||||
* support fullscreen mode, then a window will be created instead. If this
|
||||
* fails too then an Exception will be thrown.
|
||||
*
|
||||
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
|
||||
* @param title The title of the window
|
||||
* @param bpp Minimum bits per pixel
|
||||
* @param alpha Minimum bits per pixel in alpha buffer
|
||||
|
@ -301,7 +302,7 @@ public final class Window {
|
|||
* Create a fullscreen window. If the underlying OS does not
|
||||
* support fullscreen mode, then a window will be created instead. If this
|
||||
* fails too then an Exception will be thrown.
|
||||
*
|
||||
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
|
||||
* @param title The title of the window
|
||||
* @param bpp Minimum bits per pixel
|
||||
* @param alpha Minimum bits per pixel in alpha buffer
|
||||
|
@ -329,7 +330,7 @@ public final class Window {
|
|||
* display will be created instead. If this fails too then an Exception will be thrown.
|
||||
* If the window is created fullscreen, then its size may not match the specified size
|
||||
* here.
|
||||
*
|
||||
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
|
||||
* @param title The title of the window
|
||||
* @param x The position of the window on the x axis. May be ignored.
|
||||
* @param y The position of the window on the y axis. May be ignored.
|
||||
|
@ -352,7 +353,7 @@ public final class Window {
|
|||
* display will be created instead. If this fails too then an Exception will be thrown.
|
||||
* If the window is created fullscreen, then its size may not match the specified size
|
||||
* here.
|
||||
*
|
||||
* <p>The window created will be set up in orthographic 2D projection, with 1:1 pixel ratio with GL coordinates.
|
||||
* @param title The title of the window
|
||||
* @param x The position of the window on the x axis. May be ignored.
|
||||
* @param y The position of the window on the y axis. May be ignored.
|
||||
|
@ -402,7 +403,16 @@ public final class Window {
|
|||
nCreate(title, x, y, width, height, fullscreen, bpp, alpha, depth, stencil, samples);
|
||||
context = new Window();
|
||||
makeCurrent();
|
||||
|
||||
|
||||
// Put the window into orthographic projection mode with 1:1 pixel ratio.
|
||||
// We haven't used GLU here to do this to avoid an unnecessary dependency.
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glOrtho(0.0, (double) width, 0.0, (double) height, -1.0, 1.0);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glViewport(0, 0, width, height);
|
||||
|
||||
// Automatically create mouse, keyboard and controller
|
||||
if (!Mouse.isCreated()) {
|
||||
try {
|
||||
|
|
|
@ -41,293 +41,232 @@ import org.lwjgl.vector.Vector2f;
|
|||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
*
|
||||
* Tests switching between windowed and fullscreen
|
||||
*
|
||||
*
|
||||
* @author Brian Matzon <brian@matzon.dk>
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class FullScreenWindowedTest {
|
||||
/** Intended deiplay mode */
|
||||
private DisplayMode mode;
|
||||
/** our quad moving around */
|
||||
private Vector2f quadPosition;
|
||||
/** our quadVelocity */
|
||||
private Vector2f quadVelocity;
|
||||
/** angle of quad */
|
||||
private float angle;
|
||||
/** degrees to rotate per frame */
|
||||
private float angleRotation = 1.0f;
|
||||
/** Max speed of all changable attributes */
|
||||
private static final float MAX_SPEED = 20.0f;
|
||||
|
||||
/** Intended deiplay mode */
|
||||
private DisplayMode mode;
|
||||
|
||||
/** our quad moving around */
|
||||
private Vector2f quadPosition;
|
||||
|
||||
/** our quadVelocity */
|
||||
private Vector2f quadVelocity;
|
||||
|
||||
/** angle of quad */
|
||||
private float angle;
|
||||
|
||||
/** degrees to rotate per frame */
|
||||
private float angleRotation = 1.0f;
|
||||
|
||||
/** Max speed of all changable attributes */
|
||||
private static final float MAX_SPEED = 20.0f;
|
||||
|
||||
/**
|
||||
* Creates a FullScreenWindowedTest
|
||||
*/
|
||||
public FullScreenWindowedTest() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the test
|
||||
*/
|
||||
public void execute() {
|
||||
initialize();
|
||||
|
||||
mainLoop();
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the test
|
||||
*/
|
||||
private void initialize() {
|
||||
try {
|
||||
//find displaymode
|
||||
mode = findDisplayMode(800, 600, 16);
|
||||
|
||||
// start of in windowed mode
|
||||
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0, 0);
|
||||
|
||||
glInit();
|
||||
|
||||
Keyboard.create();
|
||||
|
||||
quadPosition = new Vector2f(100f, 100f);
|
||||
quadVelocity = new Vector2f(1.0f, 1.0f);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the main loop of the "test"
|
||||
*/
|
||||
private void mainLoop() {
|
||||
while (!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)
|
||||
&& !Window.isCloseRequested()) {
|
||||
// allow subsystem to get a chance to run too
|
||||
Window.update();
|
||||
|
||||
if (!Window.isMinimized()) {
|
||||
// check keyboard input
|
||||
processKeyboard();
|
||||
|
||||
// do "game" logic, and render it
|
||||
logic();
|
||||
render();
|
||||
|
||||
// paint window
|
||||
Window.paint();
|
||||
} else {
|
||||
|
||||
// no need to render/paint if nothing has changed (ie. window dragged over)
|
||||
if (Window.isDirty()) {
|
||||
render();
|
||||
Window.paint();
|
||||
}
|
||||
|
||||
// don't waste cpu time, sleep more
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException inte) {
|
||||
}
|
||||
}
|
||||
}
|
||||
Display.resetDisplayMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the logic
|
||||
*/
|
||||
private void logic() {
|
||||
angle += angleRotation;
|
||||
if (angle > 90.0f) {
|
||||
angle = 0.0f;
|
||||
}
|
||||
|
||||
quadPosition.x += quadVelocity.x;
|
||||
quadPosition.y += quadVelocity.y;
|
||||
|
||||
//check colision with vertical border border
|
||||
if (quadPosition.x + 50 >= mode.width || quadPosition.x - 50 <= 0) {
|
||||
quadVelocity.x *= -1;
|
||||
}
|
||||
|
||||
//check collision with horizontal border
|
||||
if (quadPosition.y + 50 >= mode.height || quadPosition.y - 50 <= 0) {
|
||||
quadVelocity.y *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void render() {
|
||||
//clear background
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// draw white quad
|
||||
GL11.glPushMatrix();
|
||||
{
|
||||
GL11.glTranslatef(quadPosition.x, quadPosition.y, 0);
|
||||
GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
{
|
||||
GL11.glVertex2i(-50, -50);
|
||||
GL11.glVertex2i(50, -50);
|
||||
GL11.glVertex2i(50, 50);
|
||||
GL11.glVertex2i(-50, 50);
|
||||
}
|
||||
GL11.glEnd();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes keyboard input
|
||||
*/
|
||||
private void processKeyboard() {
|
||||
Keyboard.poll();
|
||||
|
||||
//check for fullscreen key
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_F)) {
|
||||
|
||||
try {
|
||||
Keyboard.destroy();
|
||||
Window.destroy();
|
||||
|
||||
Display.setDisplayMode(mode);
|
||||
Window.create("Test", mode.bpp, 0, 0, 0, 0);
|
||||
|
||||
glInit();
|
||||
|
||||
Keyboard.create();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//check for window key
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
|
||||
try {
|
||||
Keyboard.destroy();
|
||||
Window.destroy();
|
||||
|
||||
Display.resetDisplayMode();
|
||||
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0, 0);
|
||||
|
||||
glInit();
|
||||
|
||||
Keyboard.create();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//check for speed changes
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
|
||||
quadVelocity.y += 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
|
||||
quadVelocity.y -= 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
|
||||
quadVelocity.x += 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
|
||||
quadVelocity.x -= 0.1f;
|
||||
}
|
||||
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_ADD)) {
|
||||
angleRotation += 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_SUBTRACT)) {
|
||||
angleRotation -= 0.1f;
|
||||
}
|
||||
|
||||
//throttle
|
||||
if (quadVelocity.x < -MAX_SPEED) {
|
||||
quadVelocity.x = -MAX_SPEED;
|
||||
}
|
||||
if (quadVelocity.x > MAX_SPEED) {
|
||||
quadVelocity.x = MAX_SPEED;
|
||||
}
|
||||
if (quadVelocity.y < -MAX_SPEED) {
|
||||
quadVelocity.y = -MAX_SPEED;
|
||||
}
|
||||
if (quadVelocity.y > MAX_SPEED) {
|
||||
quadVelocity.y = MAX_SPEED;
|
||||
}
|
||||
|
||||
if (angleRotation < 0.0f) {
|
||||
angleRotation = 0.0f;
|
||||
}
|
||||
if (angleRotation > MAX_SPEED) {
|
||||
angleRotation = MAX_SPEED;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up the test
|
||||
*/
|
||||
private void cleanup() {
|
||||
Keyboard.destroy();
|
||||
Window.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a displaymode, if one such is available
|
||||
*
|
||||
* @param width Required width
|
||||
* @param height Required height
|
||||
* @param bpp Minimum required bits per pixel
|
||||
* @return
|
||||
*/
|
||||
private DisplayMode findDisplayMode(int width, int height, int bpp) {
|
||||
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
||||
for (int i = 0; i < modes.length; i++) {
|
||||
if (modes[i].width == width
|
||||
&& modes[i].height == height
|
||||
&& modes[i].bpp >= bpp && modes[i].freq <= 60) {
|
||||
return modes[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes OGL
|
||||
*/
|
||||
private void glInit() {
|
||||
// Go into orthographic projection mode.
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, mode.width, 0, mode.height);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glViewport(0, 0, mode.width, mode.height);
|
||||
|
||||
//set clear color to black
|
||||
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
//sync frame (only works on windows)
|
||||
Window.setVSyncEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test entry point
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println(
|
||||
"Change between fullscreen and windowed mode, by pressing F and W respectively");
|
||||
System.out.println(
|
||||
"Move quad using arrowkeys, and change rotation using +/-");
|
||||
FullScreenWindowedTest fswTest = new FullScreenWindowedTest();
|
||||
fswTest.execute();
|
||||
}
|
||||
/**
|
||||
* Creates a FullScreenWindowedTest
|
||||
*/
|
||||
public FullScreenWindowedTest() {
|
||||
}
|
||||
/**
|
||||
* Executes the test
|
||||
*/
|
||||
public void execute() {
|
||||
initialize();
|
||||
mainLoop();
|
||||
cleanup();
|
||||
}
|
||||
/**
|
||||
* Initializes the test
|
||||
*/
|
||||
private void initialize() {
|
||||
try {
|
||||
//find displaymode
|
||||
mode = findDisplayMode(800, 600, 16);
|
||||
// start of in windowed mode
|
||||
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0, 0);
|
||||
glInit();
|
||||
quadPosition = new Vector2f(100f, 100f);
|
||||
quadVelocity = new Vector2f(1.0f, 1.0f);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Runs the main loop of the "test"
|
||||
*/
|
||||
private void mainLoop() {
|
||||
while (!Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && !Window.isCloseRequested()) {
|
||||
if (!Window.isMinimized()) {
|
||||
// check keyboard input
|
||||
processKeyboard();
|
||||
// do "game" logic, and render it
|
||||
logic();
|
||||
render();
|
||||
} else {
|
||||
// no need to render/paint if nothing has changed (ie. window
|
||||
// dragged over)
|
||||
if (Window.isDirty()) {
|
||||
render();
|
||||
}
|
||||
// don't waste cpu time, sleep more
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException inte) {
|
||||
}
|
||||
}
|
||||
// Update window
|
||||
Window.update();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Performs the logic
|
||||
*/
|
||||
private void logic() {
|
||||
angle += angleRotation;
|
||||
if (angle > 90.0f) {
|
||||
angle = 0.0f;
|
||||
}
|
||||
quadPosition.x += quadVelocity.x;
|
||||
quadPosition.y += quadVelocity.y;
|
||||
//check colision with vertical border border
|
||||
if (quadPosition.x + 50 >= mode.width || quadPosition.x - 50 <= 0) {
|
||||
quadVelocity.x *= -1;
|
||||
}
|
||||
//check collision with horizontal border
|
||||
if (quadPosition.y + 50 >= mode.height || quadPosition.y - 50 <= 0) {
|
||||
quadVelocity.y *= -1;
|
||||
}
|
||||
}
|
||||
private void render() {
|
||||
//clear background
|
||||
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
|
||||
// draw white quad
|
||||
GL11.glPushMatrix();
|
||||
{
|
||||
GL11.glTranslatef(quadPosition.x, quadPosition.y, 0);
|
||||
GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f);
|
||||
GL11.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
GL11.glBegin(GL11.GL_QUADS);
|
||||
{
|
||||
GL11.glVertex2i(-50, -50);
|
||||
GL11.glVertex2i(50, -50);
|
||||
GL11.glVertex2i(50, 50);
|
||||
GL11.glVertex2i(-50, 50);
|
||||
}
|
||||
GL11.glEnd();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
/**
|
||||
* Processes keyboard input
|
||||
*/
|
||||
private void processKeyboard() {
|
||||
//check for fullscreen key
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_F)) {
|
||||
try {
|
||||
Display.setDisplayMode(mode);
|
||||
Window.create("Test", mode.bpp, 0, 0, 0, 0);
|
||||
glInit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//check for window key
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
|
||||
try {
|
||||
Display.resetDisplayMode();
|
||||
Window.create("Test", 50, 50, mode.width, mode.height, mode.bpp, 0, 0, 0, 0);
|
||||
glInit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//check for speed changes
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
|
||||
quadVelocity.y += 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
|
||||
quadVelocity.y -= 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
|
||||
quadVelocity.x += 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
|
||||
quadVelocity.x -= 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_ADD)) {
|
||||
angleRotation += 0.1f;
|
||||
}
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_SUBTRACT)) {
|
||||
angleRotation -= 0.1f;
|
||||
}
|
||||
//throttle
|
||||
if (quadVelocity.x < -MAX_SPEED) {
|
||||
quadVelocity.x = -MAX_SPEED;
|
||||
}
|
||||
if (quadVelocity.x > MAX_SPEED) {
|
||||
quadVelocity.x = MAX_SPEED;
|
||||
}
|
||||
if (quadVelocity.y < -MAX_SPEED) {
|
||||
quadVelocity.y = -MAX_SPEED;
|
||||
}
|
||||
if (quadVelocity.y > MAX_SPEED) {
|
||||
quadVelocity.y = MAX_SPEED;
|
||||
}
|
||||
if (angleRotation < 0.0f) {
|
||||
angleRotation = 0.0f;
|
||||
}
|
||||
if (angleRotation > MAX_SPEED) {
|
||||
angleRotation = MAX_SPEED;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Cleans up the test
|
||||
*/
|
||||
private void cleanup() {
|
||||
}
|
||||
/**
|
||||
* Retrieves a displaymode, if one such is available
|
||||
*
|
||||
* @param width
|
||||
* Required width
|
||||
* @param height
|
||||
* Required height
|
||||
* @param bpp
|
||||
* Minimum required bits per pixel
|
||||
* @return
|
||||
*/
|
||||
private DisplayMode findDisplayMode(int width, int height, int bpp) {
|
||||
DisplayMode[] modes = Display.getAvailableDisplayModes();
|
||||
for (int i = 0; i < modes.length; i++) {
|
||||
if (modes[i].width == width && modes[i].height == height && modes[i].bpp >= bpp && modes[i].freq <= 60) {
|
||||
return modes[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Initializes OGL
|
||||
*/
|
||||
private void glInit() {
|
||||
// Go into orthographic projection mode.
|
||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||
GL11.glLoadIdentity();
|
||||
GLU.gluOrtho2D(0, mode.width, 0, mode.height);
|
||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glViewport(0, 0, mode.width, mode.height);
|
||||
//set clear color to black
|
||||
GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
//sync frame (only works on windows)
|
||||
Window.setVSyncEnabled(true);
|
||||
}
|
||||
/**
|
||||
* Test entry point
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Change between fullscreen and windowed mode, by pressing F and W respectively");
|
||||
System.out.println("Move quad using arrowkeys, and change rotation using +/-");
|
||||
FullScreenWindowedTest fswTest = new FullScreenWindowedTest();
|
||||
fswTest.execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy
|
|||
|
||||
/*
|
||||
* Class: org_lwjgl_opengl_Window
|
||||
* Method: update
|
||||
* Method: nUpdate
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nUpdate
|
||||
|
|
|
@ -257,7 +257,7 @@ int getWindowHeight(void) {
|
|||
|
||||
/*
|
||||
* Class: org_lwjgl_Window
|
||||
* Method: update
|
||||
* Method: nUpdate
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nUpdate
|
||||
|
|
Loading…
Reference in New Issue