mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 16:17:53 -05:00
0a19c7a8cb
* hx the codec * fix(ci,html5): use haxe.Timer instead of Sys.time * refactor(compat): use haxe.Timer instead of Sys.time(), introduce TimerUtil to reduce code dupe * fix: redundant types * refactor(style): use TimerTools in place of haxe.Timer * refactor: consistent timer code * feat: build timings * refactor(ci): cleanup ci configs * sigh * sigh, 2 * fix: haxelib deleterepo does not silently fail * retrigger ci * verbose output * debug info after haxelib gti * force haxelib git override * more debug info * force bash * at least haxelib is consistent now * fix the runners first, then do that * update ci-haxe * it is time? * deleterepo may fail * finishing touches
37 lines
761 B
Haxe
37 lines
761 B
Haxe
package funkin.util.plugins;
|
|
|
|
import flixel.FlxBasic;
|
|
import funkin.util.tools.TimerTools;
|
|
|
|
/**
|
|
* A plugin which adds functionality to press `Ins` to immediately perform memory garbage collection.
|
|
*/
|
|
class MemoryGCPlugin extends FlxBasic
|
|
{
|
|
public function new()
|
|
{
|
|
super();
|
|
}
|
|
|
|
public static function initialize():Void
|
|
{
|
|
FlxG.plugins.addPlugin(new MemoryGCPlugin());
|
|
}
|
|
|
|
public override function update(elapsed:Float):Void
|
|
{
|
|
super.update(elapsed);
|
|
|
|
if (FlxG.keys.justPressed.INSERT)
|
|
{
|
|
var perfStart:Float = TimerTools.start();
|
|
funkin.util.MemoryUtil.collect(true);
|
|
trace('Memory GC took: ${TimerTools.seconds(perfStart)}');
|
|
}
|
|
}
|
|
|
|
public override function destroy():Void
|
|
{
|
|
super.destroy();
|
|
}
|
|
}
|