|
|
|
@ -6,6 +6,8 @@ import java.awt.geom.Rectangle2D; |
|
|
|
|
import java.awt.font.FontRenderContext; |
|
|
|
|
import java.awt.Font; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
|
@ -55,9 +57,37 @@ public class Canvas extends JPanel implements AudioSpectrumListener{ |
|
|
|
|
SpectrographBar sb = spectrograph.get(i); |
|
|
|
|
sb.draw(g,SPECTROBAR_SIZE*i,SPECTROBAR_SIZE,this.getHeight()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
g.setColor(Color.WHITE); |
|
|
|
|
g.drawString(Double.toString(LLSIG.game.musicPlayer.getPlayPosition()),0,32); |
|
|
|
|
|
|
|
|
|
if (LLSIG.game.EDITOR) { |
|
|
|
|
final int MARGIN_X = 32; |
|
|
|
|
final int BEAT_RANGE = 6; |
|
|
|
|
final int BEAT_SPACING = 64; |
|
|
|
|
final int NOTE_Y=(int)(MIDDLE_Y-NOTE_SIZE/2); |
|
|
|
|
for (int y=-BEAT_RANGE;y<BEAT_RANGE;y++) { |
|
|
|
|
g.setColor(Color.GRAY); |
|
|
|
|
g.fillRect(MARGIN_X,(int)(NOTE_Y+(y)*BEAT_SPACING),this.getWidth()-MARGIN_X,4); |
|
|
|
|
g.setColor(Color.DARK_GRAY); |
|
|
|
|
for (int yy=0;yy<LLSIG.EDITOR_BEAT_DIVISIONS;yy++) { |
|
|
|
|
g.fillRect(MARGIN_X*2,(int)(NOTE_Y+(y)*BEAT_SPACING)+(BEAT_SPACING/LLSIG.EDITOR_BEAT_DIVISIONS)*yy,this.getWidth()-MARGIN_X*2,2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<9;i++) { |
|
|
|
|
if (LLSIG.keyState[i]) { |
|
|
|
|
g.setColor(Color.MAGENTA); |
|
|
|
|
} else { |
|
|
|
|
g.setColor(Color.GRAY); |
|
|
|
|
} |
|
|
|
|
int NOTE_X=(int)(((this.getWidth()-MARGIN_X*2)/9)*i-NOTE_SIZE/2+MARGIN_X); |
|
|
|
|
g.fillOval(NOTE_X,NOTE_Y,NOTE_SIZE,NOTE_SIZE); |
|
|
|
|
Lane lane = LLSIG.game.lanes.get(i); |
|
|
|
|
List<Note> notes = lane.noteChart.stream().filter((note)->Math.abs(LLSIG.EDITOR_CURSOR_BEAT-note.beatSnapStart)<BEAT_RANGE).collect(Collectors.toList()); |
|
|
|
|
for (Note n : notes) { |
|
|
|
|
g.fillOval(NOTE_X-NOTE_SIZE/2,(int)(NOTE_Y+(LLSIG.EDITOR_CURSOR_BEAT-n.beatSnapStart)*BEAT_SPACING-NOTE_SIZE/2),NOTE_SIZE,NOTE_SIZE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (LLSIG.game.BPM_MEASURE) { |
|
|
|
|
g.drawString("Average BPM: "+LLSIG.approximateBPM(),MIDDLE_X-128,MIDDLE_Y+64); |
|
|
|
|
} else |
|
|
|
@ -133,6 +163,7 @@ public class Canvas extends JPanel implements AudioSpectrumListener{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
public void spectrumDataUpdate(double timestamp, double duration, float[] magnitudes, float[] phases) { |
|
|
|
|
if (spectrograph.size()!=magnitudes.length) { |
|
|
|
|