I have created an LWJGL Window using the following code:
Display.setDisplayMode(new DisplayMode(viewport.getW(), viewport.getH()));
Display.setTitle(title);
Display.setIcon(loadIcon("/art/icon.png"));
Display.setResizable(true);
Display.create();
The issue is, I code across two monitors. When the game is maximized in one monitor and I click on another window or generally do something to make the LWJGL window lose focus, when I refocus the window, it resizes to its original size and position.
Just in case it’s needed, here’s my re sizing code:
if (Display.wasResized()) {
resyncOpenGL();
rescaled = true;
}
private void resyncOpenGL() {
viewport.setW(Display.getWidth());
viewport.setH(Display.getHeight());
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glOrtho(0, viewport.getW(), 0, viewport.getH(), -1000.0f, 1000.0f);
GL11.glViewport(0, 0, viewport.getW(), viewport.getH());
}
Note: Viewport is my own created class, it should have no effect on the actual size of the window being displayed
Thanks