From 4555e8792f1e2e44a07f4d980f4678c101bd0dc7 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Fri, 24 Oct 2014 11:54:02 +0200 Subject: [PATCH] Delete unneeded files that went through the merge. --- .../spacescooter/threads/BasicTimer.java | 48 ------------------- .../spacescooter/threads/PaintThread.java | 31 ------------ 2 files changed, 79 deletions(-) delete mode 100644 src/de/teamteamteam/spacescooter/threads/BasicTimer.java delete mode 100644 src/de/teamteamteam/spacescooter/threads/PaintThread.java diff --git a/src/de/teamteamteam/spacescooter/threads/BasicTimer.java b/src/de/teamteamteam/spacescooter/threads/BasicTimer.java deleted file mode 100644 index a47ae4e..0000000 --- a/src/de/teamteamteam/spacescooter/threads/BasicTimer.java +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/src/de/teamteamteam/spacescooter/threads/PaintThread.java b/src/de/teamteamteam/spacescooter/threads/PaintThread.java deleted file mode 100644 index e01b3e5..0000000 --- a/src/de/teamteamteam/spacescooter/threads/PaintThread.java +++ /dev/null @@ -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(); - } - }); - } - } -}