diff --git a/source/DiscordClient.hx b/source/DiscordClient.hx index 80316915dc7..56ca9dd89ae 100644 --- a/source/DiscordClient.hx +++ b/source/DiscordClient.hx @@ -73,11 +73,11 @@ class DiscordClient public static function initialize() { - var discordHandlers:DiscordEventHandlers = DiscordEventHandlers.create(); + final discordHandlers:DiscordEventHandlers = new DiscordEventHandlers(); discordHandlers.ready = Function.fromStaticFunction(onReady); discordHandlers.disconnected = Function.fromStaticFunction(onDisconnected); discordHandlers.errored = Function.fromStaticFunction(onError); - Discord.Initialize(clientID, cpp.RawPointer.addressOf(discordHandlers), 1, null); + Discord.Initialize(clientID, cpp.RawPointer.addressOf(discordHandlers), true, null); if(!isInitialized) trace("Discord Client initialized"); @@ -171,7 +171,7 @@ final class DiscordPresence function new() { - __presence = DiscordRichPresence.create(); + __presence = new DiscordRichPresence(); } public function toString():String diff --git a/source/debug/FPSCounter.hx b/source/debug/FPSCounter.hx index 297a81a0c1d..672e9c5a11a 100644 --- a/source/debug/FPSCounter.hx +++ b/source/debug/FPSCounter.hx @@ -10,19 +10,6 @@ class FPSCounter extends TextField { public var currentFPS(default, null):Float; - /* - inline function gay():Float - { - #if (cpp && windows) - return 0; - #elseif cpp - return cpp.vm.Gc.memInfo64(cpp.vm.Gc.MEM_INFO_USAGE); - #else - return cast(openfl.system.System.totalMemory, UInt); - #end - } - */ - /** The current memory usage (WARNING: this is NOT your total program memory usage, rather it shows the garbage collector memory) **/ @@ -56,17 +43,17 @@ class FPSCounter extends TextField var fpsMultiplier:Float = 1.0; var deltaTimeout:Float = 0.0; + public var timeoutDelay:Float = 500; // Event Handlers override function __enterFrame(deltaTime:Float):Void { - if (deltaTimeout > 1000) { - deltaTimeout = 0.0; - return; - } - final now:Float = haxe.Timer.stamp() * 1000; times.push(now); while (times[0] < now - 1000 / fpsMultiplier) times.shift(); + if (deltaTimeout < timeoutDelay) { + deltaTimeout += deltaTime; + return; + } if (Std.isOfType(FlxG.state, PlayState) && !PlayState.instance.trollingMode) { try { fpsMultiplier = PlayState.instance.playbackRate; } @@ -78,7 +65,6 @@ class FPSCounter extends TextField currentFPS = Math.min(FlxG.drawFramerate, times.length) / fpsMultiplier; updateText(); - deltaTimeout += deltaTime; if (ClientPrefs.rainbowFPS) { @@ -97,6 +83,7 @@ class FPSCounter extends TextField if (currentFPS <= ClientPrefs.framerate / 4) textColor = 0xFFFF0000; } + deltaTimeout = 0.0; } public dynamic function updateText():Void { // so people can override it in hscript @@ -113,4 +100,4 @@ class FPSCounter extends TextField text += "\nSystem: " + '${System.platformLabel} ${System.platformVersion}'; } } -} +} \ No newline at end of file