Rearrange core loop.

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 3 years ago
parent 6f20bee15b
commit a1d251cf6f
  1. 18
      LLSIG/src/main/java/LLSIG/LLSIG.java

@ -139,6 +139,7 @@ public class LLSIG implements KeyListener{
while (true) { while (true) {
long startTime = System.nanoTime(); long startTime = System.nanoTime();
frameCount++; frameCount++;
canvas.update();
if (PLAYING&&EDITOR) { if (PLAYING&&EDITOR) {
if (!musicPlayer.isPaused()) { if (!musicPlayer.isPaused()) {
EDITOR_CURSOR_BEAT = (musicPlayer.getPlayPosition()-offset)/beatDelay; EDITOR_CURSOR_BEAT = (musicPlayer.getPlayPosition()-offset)/beatDelay;
@ -159,9 +160,15 @@ public class LLSIG implements KeyListener{
} }
} }
} }
} } else
canvas.update();
if (PLAYING) { if (PLAYING) {
for (int i=0;i<9;i++) {
Lane l =lanes.get(i);
l.markMissedNotes();
/*if (!EDITMODE) {
l.clearOutInactiveNotes();
}*/
}
for (BeatTiming bt : timings) { for (BeatTiming bt : timings) {
if (bt.active&&musicPlayer.getPlayPosition()>=bt.offset&&bt.offset>offset) { if (bt.active&&musicPlayer.getPlayPosition()>=bt.offset&&bt.offset>offset) {
bt.active=false; bt.active=false;
@ -185,13 +192,6 @@ public class LLSIG implements KeyListener{
} }
} }
} }
for (int i=0;i<9;i++) {
Lane l =lanes.get(i);
l.markMissedNotes();
/*if (!EDITMODE) {
l.clearOutInactiveNotes();
}*/
}
window.repaint(); window.repaint();
long endTime = System.nanoTime(); long endTime = System.nanoTime();
long diff = endTime-startTime; long diff = endTime-startTime;

Loading…
Cancel
Save