new chart editor, sm file support, bpm changes, and scroll speed changes.
This commit is contained in:
55
source/TimingStruct.hx
Normal file
55
source/TimingStruct.hx
Normal 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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user