[DEV] prevent init bug

This commit is contained in:
Edouard DUPIN 2022-01-03 23:54:00 +01:00
parent 920ac8cb20
commit fcd755cd12

View File

@ -36,7 +36,6 @@ import org.atriasoft.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeySpecial; import org.atriasoft.gale.key.KeySpecial;
import org.atriasoft.gale.key.KeyStatus; import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType; import org.atriasoft.gale.key.KeyType;
import org.lwjgl.opengl.GL; import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.awt.AWTGLCanvas; import org.lwjgl.opengl.awt.AWTGLCanvas;
@ -101,12 +100,14 @@ public class ContextLWJGLAWT extends GaleContext implements MouseListener, Mouse
private Robot robot = null; private Robot robot = null;
private final List<Integer> pressedKey = new ArrayList<>(); private final List<Integer> pressedKey = new ArrayList<>();
private Boolean isInitialized = false;
public ContextLWJGLAWT(final GaleApplication application, final String[] args) { public ContextLWJGLAWT(final GaleApplication application, final String[] args) {
super(application, args); super(application, args);
System.out.println("Hello JOGL !"); System.out.println("Hello JOGL !");
initWindows(); initWindows();
start2ndThreadProcessing(); start2ndThreadProcessing();
this.isInitialized = true;
} }
private int getUniqueIndex(final KeyEvent e) { private int getUniqueIndex(final KeyEvent e) {
@ -522,7 +523,9 @@ public class ContextLWJGLAWT extends GaleContext implements MouseListener, Mouse
System.exit(0); System.exit(0);
return; return;
} }
if (ContextLWJGLAWT.this.isInitialized) {
ContextLWJGLAWT.this.canvas.render(); ContextLWJGLAWT.this.canvas.render();
}
// fps.toc(); // fps.toc();
// fps.draw(); // fps.draw();
SwingUtilities.invokeLater(this); SwingUtilities.invokeLater(this);