This commit is contained in:
Pan 2019-04-09 00:17:26 +12:00
parent ceb9a95dcf
commit 21f87d8ce8

View File

@ -105,7 +105,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
} }
frameIndex = 0; frameIndex = 0;
frameInterval = 35; frameInterval = 28;
lastDraw = 0; lastDraw = 0;
@ -130,6 +130,8 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
PPT = new postProcessingThread(); PPT = new postProcessingThread();
Thread theTread = new Thread(PPT); Thread theTread = new Thread(PPT);
//start threads //start threads
t.start(); t.start();
//dt.start(); //dt.start();
@ -179,7 +181,7 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
if(gameStarted) if(gameStarted)
gameFrame++; gameFrame++;
timeString = secondsToString(gameFrame/35); timeString = secondsToString((int)(gameFrame*0.028));
//handle user's interaction with game GUI //handle user's interaction with game GUI
if(gameFrame == 1 && gameStarted){ if(gameFrame == 1 && gameStarted){
@ -250,6 +252,8 @@ public class mainThread extends JFrame implements KeyListener, ActionListener, M
//g2.setColor(Color.WHITE); //g2.setColor(Color.WHITE);
//g2.drawString("FPS: " + framePerSecond + " " + "Polygons: " + theAssetManager.polygonCount + " " + "Thread1 Sleep: " + sleepTime + "ms " + "Thread2 Sleep: " + postProcessingThread.sleepTime + "ms " , 5, 15); //g2.drawString("FPS: " + framePerSecond + " " + "Polygons: " + theAssetManager.polygonCount + " " + "Thread1 Sleep: " + sleepTime + "ms " + "Thread2 Sleep: " + postProcessingThread.sleepTime + "ms " , 5, 15);
System.out.println(framePerSecond);
//copy the screen buffer to video memory //copy the screen buffer to video memory
g.drawImage(bf, 0, 0, this); g.drawImage(bf, 0, 0, this);
} }