truncate float refactor
This commit is contained in:
@ -93,12 +93,6 @@ class OptionsMenu extends MusicBeatState
|
||||
|
||||
var isCat:Bool = false;
|
||||
|
||||
public static function truncateFloat( number : Float, precision : Int): Float {
|
||||
var num = number;
|
||||
num = num * Math.pow(10, precision);
|
||||
num = Math.round( num ) / Math.pow(10, precision);
|
||||
return num;
|
||||
}
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
@ -159,7 +153,7 @@ class OptionsMenu extends MusicBeatState
|
||||
else if (FlxG.keys.pressed.LEFT)
|
||||
FlxG.save.data.offset -= 0.1;
|
||||
|
||||
versionShit.text = "Offset (Left, Right, Shift for slow): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -176,7 +170,7 @@ class OptionsMenu extends MusicBeatState
|
||||
else if (FlxG.keys.pressed.LEFT)
|
||||
FlxG.save.data.offset -= 0.1;
|
||||
|
||||
versionShit.text = "Offset (Left, Right, Shift for slow): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||
}
|
||||
|
||||
|
||||
@ -234,7 +228,7 @@ class OptionsMenu extends MusicBeatState
|
||||
currentDescription = currentSelectedCat.getOptions()[curSelected].getDescription();
|
||||
else
|
||||
currentDescription = "Please select a catagory";
|
||||
versionShit.text = "Offset (Left, Right, Shift for slow): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||
versionShit.text = "Offset (Left, Right, Shift for slow): " + HelperFunctions.truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription;
|
||||
|
||||
// selector.y = (70 * curSelected) + 30;
|
||||
|
||||
|
Reference in New Issue
Block a user