updated GearsApplet to use addNotify() to start a LWJGL Display, also prevents a new Display being created each time the start() method is called.

This commit is contained in:
kappa1 2009-05-23 09:09:28 +00:00
parent e6a8d3e390
commit d7cbfc5255
1 changed files with 12 additions and 6 deletions

View File

@ -45,10 +45,15 @@ public class GearsApplet extends Applet {
}
}
/**
* @see java.applet.Applet#start()
*/
public void start() {
}
public void stop() {
}
public void startApplet() {
gameThread = new Thread() {
public void run() {
running = true;
@ -67,9 +72,6 @@ public class GearsApplet extends Applet {
gameThread.start();
}
public void stop() {
}
public void stopApplet() {
running = false;
}
@ -78,6 +80,10 @@ public class GearsApplet extends Applet {
setLayout(new BorderLayout());
try {
display_parent = new Canvas() {
public final void addNotify() {
super.addNotify();
startLWJGL();
}
public final void removeNotify() {
destroyLWJGL();
super.removeNotify();