Kleinere Änderungen

This commit is contained in:
toksikk
2014-11-06 20:55:15 +01:00
parent 56f05f7e7e
commit cf6cb9ad67
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -158,15 +158,14 @@ public class GameLoopD extends JFrame implements Runnable {
public void run() { public void run() {
long lastTime = System.nanoTime(); long lastTime = System.nanoTime();
final double fps = 60.0; final double targetTickAmount = 60.0;
double ns = 1000000000 / fps; double ns = 1000000000 / targetTickAmount;
double delta = 0; double delta = 0;
int updates = 0; int updates = 0;
int frames = 0; int frames = 0;
long timer = System.currentTimeMillis(); long timer = System.currentTimeMillis();
while (running) { while (running) {
kb.foo();
long now = System.nanoTime(); long now = System.nanoTime();
delta += (now-lastTime) / ns; delta += (now-lastTime) / ns;
lastTime = now; lastTime = now;
@@ -190,6 +189,7 @@ public class GameLoopD extends JFrame implements Runnable {
} }
// alles was geupdatet werden muss hier rein // alles was geupdatet werden muss hier rein
private void tick() { private void tick() {
kb.checkKeyActivity();
player01.tick(); player01.tick();
} }
+1 -1
View File
@@ -56,7 +56,7 @@ public class KeyBindings extends KeyAdapter {
} }
} }
public void foo() { public void checkKeyActivity() {
/* /*
* rudimentäre kollisionserkennung, exportiere ich gerade in eigenes modul :) * rudimentäre kollisionserkennung, exportiere ich gerade in eigenes modul :)