Delete unneeded files that went through the merge.

This commit is contained in:
Jan Philipp Timme 2014-10-24 11:54:02 +02:00
parent 72b914cd3b
commit 4555e8792f
2 changed files with 0 additions and 79 deletions

View File

@ -1,48 +0,0 @@
package de.teamteamteam.spacescooter.threads;
public class BasicTimer {
private int fps;
private long timeThen;
boolean newVersion = true;
public BasicTimer(int frameRate) {
if (System.getProperty("java.version").startsWith("1.4"))
newVersion = false;
if (newVersion) {
fps = frameRate;
timeThen = System.nanoTime();
}
else {
fps = frameRate;
System.out.println("Old Version Detected: Running Old Java Timer Version");
timeThen = System.currentTimeMillis();
}
}
public void changeFPS(int frameRate) {
fps = frameRate;
}
public void sync() {
if (newVersion) {
long gapTo = 1000000000L / fps + timeThen;
long timeNow = System.nanoTime();
while (gapTo > timeNow) {
try { Thread.sleep(1);
} catch (InterruptedException e) {}
timeNow = System.nanoTime();
}
timeThen = timeNow;
} else {
long gapTo = 1000 / fps + timeThen;
long timeNow = System.currentTimeMillis();
while (gapTo > timeNow) {
try { Thread.sleep(1);
} catch (InterruptedException e) {}
timeNow = System.currentTimeMillis();
}
timeThen = timeNow;
}
}
}

View File

@ -1,31 +0,0 @@
package de.teamteamteam.spacescooter.threads;
import java.awt.EventQueue;
import de.teamteamteam.spacescooter.gui.GameFrame;
/**
* This thread triggers about 60 redraws per second.
*/
public class PaintThread extends Thread {
private GameFrame gf;
BasicTimer timer = new BasicTimer(120);
public PaintThread(GameFrame gf) {
this.gf = gf;
}
public void run() {
final GameFrame gf = this.gf; // :'-(
while (true) {
timer.sync();
//Trigger redrawing the things. Important: AWT-Context needed here!
EventQueue.invokeLater(new Runnable() {
public void run() {
gf.draw();
}
});
}
}
}