testing
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
2060
|
||||
2069
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user