Skip to content

Commit

Permalink
port over some v3^2 engine changes
Browse files Browse the repository at this point in the history
  • Loading branch information
x8c8r committed Sep 12, 2024
1 parent 94013f0 commit 122a1c2
Show file tree
Hide file tree
Showing 7 changed files with 464 additions and 424 deletions.
2 changes: 1 addition & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- ____________________________ Window Settings ___________________________ -->

<!--These window settings apply to all targets-->
<window width="1280" height="720" fps="" background="#000000" hardware="true" vsync="false" />
<window width="1280" height="720" background="#000000" hardware="true" vsync="false" />

<!--HTML5-specific-->
<window if="html5" resizable="true" />
Expand Down
37 changes: 37 additions & 0 deletions RAM.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import openfl.text.TextFormat;
import openfl.system.System;
import haxe.Timer;
import openfl.events.Event;
import openfl.text.TextField;

class RAM extends TextField {
public var curRAM:Float;
private var times:Array<Float>;

public function new(x:Float, y:Float) {
super();
this.x = x;
this.y = y;

defaultTextFormat = new TextFormat("_sans", 12, 0xFFFFFF);
selectable = false;
mouseEnabled = false;
autoSize = LEFT;

times = [];

addEventListener(Event.ENTER_FRAME, onEnter);
}
private function onEnter(_) {
var now = Timer.stamp();
times.push(now);

while(times[0] < now - 1)
times.shift();

var mem:Float = Math.round(System.totalMemory / 1024 / 1024 * 100)/100;

if (visible)
text = "Memory: " + mem + "MB";
}
}
Loading

0 comments on commit 122a1c2

Please sign in to comment.