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:
parent
e6a8d3e390
commit
d7cbfc5255
|
@ -45,10 +45,15 @@ public class GearsApplet extends Applet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see java.applet.Applet#start()
|
|
||||||
*/
|
|
||||||
public void start() {
|
public void start() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startApplet() {
|
||||||
gameThread = new Thread() {
|
gameThread = new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
running = true;
|
running = true;
|
||||||
|
@ -67,9 +72,6 @@ public class GearsApplet extends Applet {
|
||||||
gameThread.start();
|
gameThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopApplet() {
|
public void stopApplet() {
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +80,10 @@ public class GearsApplet extends Applet {
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
try {
|
try {
|
||||||
display_parent = new Canvas() {
|
display_parent = new Canvas() {
|
||||||
|
public final void addNotify() {
|
||||||
|
super.addNotify();
|
||||||
|
startLWJGL();
|
||||||
|
}
|
||||||
public final void removeNotify() {
|
public final void removeNotify() {
|
||||||
destroyLWJGL();
|
destroyLWJGL();
|
||||||
super.removeNotify();
|
super.removeNotify();
|
||||||
|
|
Loading…
Reference in New Issue