Editor modifications and spectrograph mirroring added.
This commit is contained in:
parent
5203f4fd26
commit
30572f3806
@ -51,11 +51,11 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
|
||||
g.setColor(Color.BLACK);
|
||||
g.fillRect(0,0,this.getWidth(),this.getHeight());
|
||||
|
||||
final int SPECTROBAR_SIZE = this.getWidth()/spectrograph.size();
|
||||
final int SPECTROBAR_SIZE = spectrograph.size()>0?this.getWidth()/spectrograph.size():0;
|
||||
|
||||
for (int i=0;i<spectrograph.size();i++) {
|
||||
SpectrographBar sb = spectrograph.get(i);
|
||||
sb.draw(g,SPECTROBAR_SIZE*i,SPECTROBAR_SIZE,this.getHeight());
|
||||
sb.draw(g,SPECTROBAR_SIZE*i,SPECTROBAR_SIZE,this.getHeight(),this.getWidth()-SPECTROBAR_SIZE*i);
|
||||
}
|
||||
g.setColor(Color.WHITE);
|
||||
g.drawString(Double.toString(LLSIG.game.musicPlayer.getPlayPosition()),0,32);
|
||||
@ -63,14 +63,14 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
|
||||
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);
|
||||
final int BEAT_SPACING = 164;
|
||||
final int NOTE_Y=(int)(MIDDLE_Y);
|
||||
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.fillRect(MARGIN_X,(int)(NOTE_Y+(y-LLSIG.EDITOR_CURSOR_BEAT%1)*BEAT_SPACING)+NOTE_SIZE/2,this.getWidth()-MARGIN_X*2,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 yy=1;yy<=LLSIG.EDITOR_BEAT_DIVISIONS;yy++) {
|
||||
g.fillRect(MARGIN_X*2,(int)(NOTE_Y+(y-LLSIG.EDITOR_CURSOR_BEAT%1)*BEAT_SPACING)+(BEAT_SPACING/LLSIG.EDITOR_BEAT_DIVISIONS)*yy+NOTE_SIZE/2,this.getWidth()-MARGIN_X*4,2);
|
||||
}
|
||||
}
|
||||
for (int i=0;i<9;i++) {
|
||||
@ -79,12 +79,12 @@ public class Canvas extends JPanel implements AudioSpectrumListener{
|
||||
} else {
|
||||
g.setColor(Color.GRAY);
|
||||
}
|
||||
int NOTE_X=(int)(((this.getWidth()-MARGIN_X*2)/9)*i-NOTE_SIZE/2+MARGIN_X);
|
||||
int NOTE_X=(int)(((this.getWidth()-MARGIN_X)/9)*i+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);
|
||||
g.fillOval(NOTE_X,(int)(NOTE_Y+(n.beatSnapStart-LLSIG.EDITOR_CURSOR_BEAT)*BEAT_SPACING),NOTE_SIZE,NOTE_SIZE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -50,7 +50,7 @@ public class LLSIG implements KeyListener{
|
||||
public boolean METRONOME = false;
|
||||
public boolean BPM_MEASURE = false;
|
||||
public boolean PLAYING = true; //Whether or not a song is loaded and playing.
|
||||
public boolean EDITOR = false; //Whether or not we are in beatmap editing mode.
|
||||
public boolean EDITOR = true; //Whether or not we are in beatmap editing mode.
|
||||
|
||||
public static double EDITOR_CURSOR_BEAT = 0;
|
||||
public static int EDITOR_BEAT_DIVISIONS = 4;
|
||||
@ -212,10 +212,15 @@ public class LLSIG implements KeyListener{
|
||||
lanes.add(new Lane(new ArrayList<Note>()));
|
||||
}
|
||||
if (noteType==NoteType.HOLD) {
|
||||
offset2 = (int)Math.round(Double.parseDouble(split[2])*beatDelay+LLSIG.offset);
|
||||
lanes.get(lane-1).addNote(new Note(noteType,offset,offset2));
|
||||
offset2 = (int)Math.round(Double.parseDouble(split[3])*beatDelay+LLSIG.offset);
|
||||
Note n = new Note(noteType,offset,offset2);
|
||||
n.beatSnapStart = Double.parseDouble(split[2]);
|
||||
n.beatSnapEnd = Double.parseDouble(split[3]);
|
||||
lanes.get(lane-1).addNote(n);
|
||||
} else {
|
||||
lanes.get(lane-1).addNote(new Note(noteType,offset));
|
||||
Note n = new Note(noteType,offset);
|
||||
n.beatSnapStart = Double.parseDouble(split[2]);
|
||||
lanes.get(lane-1).addNote(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@ import java.awt.Color;
|
||||
public class SpectrographBar {
|
||||
final float NO_UPDATE = 999f;
|
||||
float current_magnitude = 0.0f;
|
||||
final double CHANGE_SPD = 1.05d;
|
||||
float target_magnitude = 0.0f;
|
||||
final double CHANGE_SPD = 1d;
|
||||
SpectrographBar() {
|
||||
this(0f);
|
||||
}
|
||||
@ -17,22 +18,22 @@ public class SpectrographBar {
|
||||
update(NO_UPDATE);
|
||||
}
|
||||
public void update(float value) {
|
||||
if (value==NO_UPDATE) {
|
||||
if (current_magnitude>-59.7f) {
|
||||
current_magnitude=(float)(CHANGE_SPD/(-60-current_magnitude)+current_magnitude);
|
||||
} else {
|
||||
current_magnitude=-60f;
|
||||
}
|
||||
} else {
|
||||
current_magnitude=value;
|
||||
if (current_magnitude<target_magnitude) {
|
||||
current_magnitude=(float)Math.min(0,current_magnitude+CHANGE_SPD);
|
||||
} else {
|
||||
current_magnitude=(float)Math.max(-60f,current_magnitude-CHANGE_SPD);
|
||||
}
|
||||
if (value!=NO_UPDATE) {
|
||||
target_magnitude=value;
|
||||
}
|
||||
}
|
||||
public void draw(Graphics g,int x,int w,int h) {
|
||||
public void draw(Graphics g,int x,int w,int h,int x2) {
|
||||
if (current_magnitude!=NO_UPDATE) {
|
||||
//System.out.println(current_magnitude);
|
||||
int colVal = (int)(((60d-Math.abs(current_magnitude))/60d)*255);
|
||||
g.setColor(new Color(colVal,colVal,colVal,colVal));
|
||||
g.setColor(new Color(colVal,colVal,colVal,Math.min(255,colVal*2)));
|
||||
g.fillRect(x,0,w,h);
|
||||
g.fillRect(x2,0,w,h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user