This commit is contained in:
Yoshman29
2023-01-17 14:41:17 +01:00
parent a10e8c0101
commit 3c513bc77b
4 changed files with 31 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
2060
2069
+2 -2
View File
@@ -16,14 +16,14 @@ class Strum extends FlxSprite {
public var lastDrawCameras(default, null):Array<FlxCamera> = [];
public function getScrollSpeed(?note:Note) {
public inline function getScrollSpeed(?note:Note):Float {
if (note != null && note.scrollSpeed != null) return note.scrollSpeed;
if (scrollSpeed != null) return scrollSpeed;
if (PlayState.instance != null) return PlayState.instance.scrollSpeed;
return 1;
}
public function getNotesAngle(?note:Note) {
public inline function getNotesAngle(?note:Note):Float {
if (note != null && note.noteAngle != null) return note.noteAngle;
if (noteAngle != null) return noteAngle;
return angle;
+2
View File
@@ -129,6 +129,7 @@ class Main extends Sprite
}
public function loadGameSettings() {
MemoryUtil.init();
@:privateAccess
FlxG.game.getTimer = getTimer;
#if ALLOW_MULTITHREADING
@@ -244,6 +245,7 @@ class Main extends Sprite
Paths.assetsTree.clearCache();
MemoryUtil.destroyFlixelZombies();
MemoryUtil.clearMajor();
}
}
+26
View File
@@ -12,6 +12,11 @@ import neko.vm.Gc;
import openfl.system.System;
class MemoryUtil {
public static function init() {
#if cpp
// cpp.NativeGc.addFinalizable(new MemoryUtil(), false);
#end
}
public static function clearMinor() {
#if (cpp || java || neko)
Gc.run(false);
@@ -50,4 +55,25 @@ class MemoryUtil {
return 0;
#end
}
private static var _nb:Int = 0;
private static var _nbD:Int = 0;
private static var _zombie:Dynamic;
public static function destroyFlixelZombies() {
#if cpp
Gc.enterGCFreeZone();
while ((_zombie = Gc.getNextZombie()) != null) {
_nb++;
if (_zombie is flixel.util.FlxDestroyUtil.IFlxDestroyable) {
flixel.util.FlxDestroyUtil.destroy(cast(_zombie, flixel.util.FlxDestroyUtil.IFlxDestroyable));
_nbD++;
}
}
Sys.println('Zombies: ${_nb}; IFlxDestroyable Zombies: ${_nbD}');
Gc.exitGCFreeZone();
#end
}
}