Changed memory calculation and fixed gc not being reenabled after death
This commit is contained in:
parent
903970c542
commit
0e56a7336b
@ -23,10 +23,6 @@ class GameOverState extends FlxTransitionableState
|
||||
|
||||
override function create()
|
||||
{
|
||||
if (!FlxG.save.data.GC) {
|
||||
Gc.enable(true);
|
||||
trace("Player died. We can reenable the garbage collector");
|
||||
}
|
||||
var loser:FlxSprite = new FlxSprite(100, 100);
|
||||
var loseTex = Paths.getSparrowAtlas('lose');
|
||||
loser.frames = loseTex;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import cpp.vm.Gc;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxObject;
|
||||
import flixel.FlxSubState;
|
||||
@ -16,6 +17,10 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
|
||||
public function new(x:Float, y:Float)
|
||||
{
|
||||
if (!FlxG.save.data.GC) {
|
||||
Gc.enable(true);
|
||||
trace("Player died. We can reenable the garbage collector");
|
||||
}
|
||||
var daStage = PlayState.curStage;
|
||||
var daBf:String = '';
|
||||
switch (PlayState.SONG.player1)
|
||||
|
@ -50,7 +50,8 @@ class KadeEngineData
|
||||
FlxG.save.data.fpsCap = 120;*/
|
||||
|
||||
if (FlxG.save.data.fpsCap > 1000 || FlxG.save.data.fpsCap < 60)
|
||||
FlxG.save.data.fpsCap = 120; // baby proof so you can't hard lock ur copy of kade engine
|
||||
//FlxG.save.data.fpsCap = 120; // baby proof so you can't hard lock ur copy of kade engine
|
||||
trace("nerd");
|
||||
|
||||
if (FlxG.save.data.scrollSpeed == null)
|
||||
FlxG.save.data.scrollSpeed = 1;
|
||||
|
@ -8,8 +8,8 @@ import openfl.text.TextField;
|
||||
import openfl.Lib;
|
||||
|
||||
class Memory extends TextField {
|
||||
private var overCounter = 0;
|
||||
private var isOver = false;
|
||||
//private var overCounter = 0;
|
||||
//private var isOver = false;
|
||||
|
||||
@:noCompletion private var cacheCount:Int;
|
||||
@:noCompletion private var currentTime:Float;
|
||||
@ -20,13 +20,14 @@ class Memory extends TextField {
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = 150;
|
||||
|
||||
defaultTextFormat = new TextFormat("_sans", 12, color);
|
||||
text = "Memory: ";
|
||||
|
||||
addEventListener(Event.ENTER_FRAME, function(e)
|
||||
{
|
||||
var usedMemory:Float = Gc.memUsage();
|
||||
/*var usedMemory:Float = Gc.memUsage();
|
||||
if (Gc.memUsage() < 0 && !isOver)
|
||||
{
|
||||
isOver = true;
|
||||
@ -38,8 +39,11 @@ class Memory extends TextField {
|
||||
}
|
||||
if (isOver) {
|
||||
usedMemory = 2147483647+(2147483647-(Math.abs(Gc.memUsage()))); // funny math to represent values over 2GB
|
||||
}
|
||||
text = "Memory: " + FlxStringUtil.formatBytes(usedMemory + 4294967296*overCounter);
|
||||
}*/
|
||||
text = "Memory: " + FlxStringUtil.formatBytes(/*usedMemory + 4294967296*overCounter*/ Gc.memInfo64(0));
|
||||
/*for (i in 0...4) {
|
||||
text += "\nMemory info " + i + ": " + FlxStringUtil.formatBytes(Gc.memInfo64(i));
|
||||
}*/
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user