1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 08:13:45 +00:00

sidebar preview

This commit is contained in:
Cameron Taylor 2022-02-03 19:13:39 -05:00
parent d0134a3701
commit 42d89426a4

View file

@ -36,6 +36,7 @@ class ChartingState extends MusicBeatState
var _file:FileReference; var _file:FileReference;
var UI_box:FlxUITabMenu; var UI_box:FlxUITabMenu;
var sidePreview:FlxSprite;
/** /**
* Array of notes showing when each section STARTS in STEPS * Array of notes showing when each section STARTS in STEPS
@ -413,9 +414,14 @@ class ChartingState extends MusicBeatState
// musSpec.visType = FREQUENCIES; // musSpec.visType = FREQUENCIES;
add(musSpec); add(musSpec);
sidePreview = new FlxSprite(0, 0).makeGraphic(40, FlxG.height, FlxColor.GRAY);
sidePreview.scrollFactor.set();
add(sidePreview);
// trace(audioBuf.data.length); // trace(audioBuf.data.length);
playheadTest = new FlxSprite(0, 0).makeGraphic(30, 2, FlxColor.RED); playheadTest = new FlxSprite(0, 0).makeGraphic(30, 2, FlxColor.RED);
playheadTest.scrollFactor.set(); playheadTest.scrollFactor.set();
playheadTest.alpha = 0.5;
add(playheadTest); add(playheadTest);
// WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER // WONT WORK FOR TUTORIAL OR TEST SONG!!! REDO LATER
@ -550,11 +556,19 @@ class ChartingState extends MusicBeatState
else else
return SongLoad.getSong()[curSection].lengthInSteps; return SongLoad.getSong()[curSection].lengthInSteps;
}*/ }*/
function sectionStartTime():Float /**
* Gets the start time of section, defaults to the curSection
* @param section
* @return position of the song in... either seconds or milliseconds.... woops
*/
function sectionStartTime(?funnySection:Int):Float
{ {
if (funnySection == null)
funnySection = curSection;
var daBPM:Float = _song.bpm; var daBPM:Float = _song.bpm;
var daPos:Float = 0; var daPos:Float = 0;
for (i in 0...curSection) for (i in 0...funnySection)
{ {
if (SongLoad.getSong()[i].changeBPM) if (SongLoad.getSong()[i].changeBPM)
{ {
@ -1128,6 +1142,46 @@ class ChartingState extends MusicBeatState
curRenderedSustains.remove(curRenderedSustains.members[0], true); curRenderedSustains.remove(curRenderedSustains.members[0], true);
} }
// generates the cool sidebar shit
if (sidePreview != null)
{
sidePreview.drawRect(0, 0, 40, FlxG.height, 0xFF444444);
/*
var sectionsNeeded:Int = Std.int(FlxG.sound.music.length / (sectionCalc(_song.bpm) * 4));
while (sectionsNeeded > 0)
{
sidePreview.drawRect(0, sectionsNeeded * (FlxG.height / sectionsNeeded), 40, FlxG.height / sectionsNeeded,
(sectionsNeeded % 2 == 0 ? 0xFF000000 : 0xFFFFFFFF));
sectionsNeeded--;
}
*/
for (secIndex => sideSection in SongLoad.getSong())
{
for (notes in sideSection.sectionNotes)
{
var col:Int = switch (notes.noteData % 4)
{
case 0:
0xFFFF22AA;
case 1:
0xFF00EEFF;
case 2:
0xFF00CC00;
case 3:
0xFFCC1111;
default:
0xFFFF0000;
}
sidePreview.drawRect(5 * notes.noteData, FlxMath.remapToRange(notes.strumTime, 0, FlxG.sound.music.length, 0, FlxG.height), 5, 1, col);
}
}
}
var sectionInfo:Array<NoteData> = SongLoad.getSong()[curSection].sectionNotes; var sectionInfo:Array<NoteData> = SongLoad.getSong()[curSection].sectionNotes;
if (SongLoad.getSong()[curSection].changeBPM && SongLoad.getSong()[curSection].bpm > 0) if (SongLoad.getSong()[curSection].changeBPM && SongLoad.getSong()[curSection].bpm > 0)