Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Mar 6, 2017
1 parent ca82d2b commit 544bca6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Sources/arm/UITrait.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ class UITrait extends armory.Trait {
var gateObject:armory.object.Object;
var openingGate = false;

var lastTime = 0.0;
var frameTime = 0.0;
var totalTime = 0.0;
var frames = 0;
var frameTimeAvg = 0.0;

public function new() {
super();

Expand Down Expand Up @@ -68,10 +74,23 @@ class UITrait extends armory.Trait {
pin = "DENIED";
}
}
var tt = Std.int(frameTimeAvg * 1000);
ui.text("fps: " + Std.int(1000 / tt) + " (" + tt + "ms)");
ui.unindent();
}
}
ui.end();

totalTime += frameTime;
frames++;
if (totalTime > 1.0) {
var t = totalTime / frames;
frameTimeAvg = t;
totalTime = 0;
frames = 0;
}
frameTime = kha.Scheduler.realTime() - lastTime;
lastTime = kha.Scheduler.realTime();
}

function update() {
Expand Down
Binary file modified armorbench.blend
Binary file not shown.

0 comments on commit 544bca6

Please sign in to comment.