-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance changes, note folder changed, memory monitor, new boyfrie…
…nd, etc. Performance changes, note folder changed, memory monitor, new boyfriend, etc.
- Loading branch information
Showing
39 changed files
with
641 additions
and
869 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package; | ||
|
||
import cpp.vm.Gc; | ||
import openfl.events.Event; | ||
import openfl.text.TextField; | ||
import openfl.text.TextFormat; | ||
|
||
//Code from Indie Cross | ||
// https://imgur.com/a/LVkQmqe | ||
#if windows | ||
@:headerCode(" | ||
#define WIN32_LEAN_AND_MEAN | ||
#include <windows.h> | ||
#include <psapi.h> | ||
// are you serious?? | ||
// do i have to include this after windows.h to not get outrageous compilation errors?????? | ||
// one side of my brains loves c++ and the other one hates it | ||
") | ||
#end | ||
class MemoryMonitor extends TextField | ||
{ | ||
private var times:Array<Float>; | ||
private var memPeak:Float = 0; | ||
|
||
public function new(inX:Float = 10.0, inY:Float = 10.0, inCol:Int = 0x000000) | ||
{ | ||
super(); | ||
|
||
x = inX; | ||
y = inY; | ||
selectable = false; | ||
defaultTextFormat = new TextFormat("_sans", 12, inCol); | ||
|
||
addEventListener(Event.ENTER_FRAME, onEnter); | ||
width = 150; | ||
height = 70; | ||
} | ||
|
||
private function onEnter(_) | ||
{ | ||
#if windows | ||
// now be an ACTUAL real man and get the memory from plain & straight c++ | ||
var actualMem:Float = obtainMemory(); | ||
#else | ||
// be a real man and calculate memory from hxcpp | ||
var actualMem:Float = Gc.memInfo64(3); // update: this sucks | ||
#end | ||
var mem:Float = Math.round(actualMem / 1024 / 1024 * 100) / 100; | ||
if (mem > memPeak) | ||
memPeak = mem; | ||
|
||
if (visible) | ||
{ | ||
text = "\nMEM: " + mem + " MB\nMEM peak: " + memPeak + " MB"; | ||
} | ||
} | ||
|
||
#if windows // planning to do the same for linux but im lazy af so rn it'll use the hxcpp gc | ||
@:functionCode(" | ||
// ily windows api <3 | ||
auto memhandle = GetCurrentProcess(); | ||
PROCESS_MEMORY_COUNTERS pmc; | ||
if (GetProcessMemoryInfo(memhandle, &pmc, sizeof(pmc))) | ||
return(pmc.WorkingSetSize); | ||
else | ||
return 0; | ||
") | ||
function obtainMemory():Dynamic | ||
{ | ||
return 0; | ||
} | ||
#end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.