28 lines
535 B
Java
28 lines
535 B
Java
package de.teamteamteam.spacescooter.thread;
|
|
|
|
import java.awt.EventQueue;
|
|
|
|
import de.teamteamteam.spacescooter.gui.GameFrame;
|
|
|
|
/**
|
|
* This thread triggers about 60 redraws per second.
|
|
*/
|
|
public class PaintThread extends TimedThread {
|
|
|
|
private GameFrame gf;
|
|
|
|
public PaintThread(GameFrame gf) {
|
|
this.gf = gf;
|
|
this.setName("PaintThread");
|
|
}
|
|
|
|
public void work() {
|
|
//Trigger redrawing the things. Important: AWT-Context needed here!
|
|
EventQueue.invokeLater(new Runnable() {
|
|
public void run() {
|
|
gf.draw();
|
|
}
|
|
});
|
|
}
|
|
}
|