new chart editor, sm file support, bpm changes, and scroll speed changes.

This commit is contained in:
KadeDeveloper
2021-07-19 21:19:03 -07:00
parent c69e83d8e0
commit aa2119d034
25 changed files with 2046 additions and 355 deletions

55
source/TimingStruct.hx Normal file
View File

@ -0,0 +1,55 @@
import flixel.FlxG;
class TimingStruct
{
public static var AllTimings:Array<TimingStruct> = [];
public var bpm:Float = 0;
public var startBeat:Float = 0;
public var endBeat:Float = Math.POSITIVE_INFINITY;
public var startTime:Float = 0;
public var length:Float = Math.POSITIVE_INFINITY; // in beats
public static function clearTimings()
{
AllTimings = [];
}
public static function addTiming(startBeat,bpm,endBeat:Float, offset:Float)
{
var pog = new TimingStruct(startBeat,bpm,endBeat, offset);
AllTimings.push(pog);
}
public function new(startBeat,bpm,endBeat:Float, offset:Float)
{
this.bpm = bpm;
this.startBeat = startBeat;
if (endBeat != -1)
this.endBeat = endBeat;
startTime = offset;
}
public static function getTimingAtTimestamp(msTime:Float):TimingStruct
{
for(i in AllTimings)
{
if (msTime >= i.startTime * 1000 && msTime < (i.startTime + i.length) * 1000)
return i;
}
trace('Apparently ' + msTime + ' is out of any segs');
return null;
}
public static function getTimingAtBeat(beat):TimingStruct
{
for(i in AllTimings)
{
if (i.startBeat <= beat && i.endBeat >= beat)
return i;
}
return null;
}
}