improve fps display
This commit is contained in:
@@ -28,12 +28,12 @@ window.GameWindow = class {
|
|||||||
this.statsFps = new Stats()
|
this.statsFps = new Stats()
|
||||||
this.statsFps.showPanel(0);
|
this.statsFps.showPanel(0);
|
||||||
this.statsFps.domElement.style.cssText = 'position:absolute;top:0px;right:80px;float:right';
|
this.statsFps.domElement.style.cssText = 'position:absolute;top:0px;right:80px;float:right';
|
||||||
this.wrapper.appendChild(this.statsFps.dom);
|
//this.wrapper.appendChild(this.statsFps.dom);
|
||||||
|
|
||||||
this.statsMs = new Stats()
|
this.statsMs = new Stats()
|
||||||
this.statsMs.showPanel(1);
|
this.statsMs.showPanel(1);
|
||||||
this.statsMs.domElement.style.cssText = 'position:absolute;top:0px;right:160px;float:right';
|
this.statsMs.domElement.style.cssText = 'position:absolute;top:0px;right:160px;float:right';
|
||||||
this.wrapper.appendChild(this.statsMs.dom);
|
//this.wrapper.appendChild(this.statsMs.dom);
|
||||||
|
|
||||||
// On resize
|
// On resize
|
||||||
let scope = this;
|
let scope = this;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ window.Minecraft = class {
|
|||||||
this.currentScreen = null;
|
this.currentScreen = null;
|
||||||
this.loadingScreen = null;
|
this.loadingScreen = null;
|
||||||
|
|
||||||
|
this.fps = 0;
|
||||||
|
|
||||||
// Tick timer
|
// Tick timer
|
||||||
this.timer = new Timer(20);
|
this.timer = new Timer(20);
|
||||||
|
|
||||||
@@ -96,8 +98,7 @@ window.Minecraft = class {
|
|||||||
|
|
||||||
// Loop if a second passed
|
// Loop if a second passed
|
||||||
while (Date.now() >= this.lastTime + 1000) {
|
while (Date.now() >= this.lastTime + 1000) {
|
||||||
//console.log(this.frames + " fps");
|
this.fps = this.frames;
|
||||||
|
|
||||||
this.lastTime += 1000;
|
this.lastTime += 1000;
|
||||||
this.frames = 0;
|
this.frames = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ window.IngameOverlay = class extends Gui {
|
|||||||
this.renderHotbar(stack, this.window.width / 2 - 91, this.window.height - 22);
|
this.renderHotbar(stack, this.window.width / 2 - 91, this.window.height - 22);
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
this.drawString(stack, Math.floor(this.minecraft.timer.fps) + " fps," +
|
this.drawString(stack, Math.floor(this.minecraft.fps) + " fps," +
|
||||||
" " + this.minecraft.world.lightUpdateQueue.length + " light updates," +
|
" " + this.minecraft.world.lightUpdateQueue.length + " light updates," +
|
||||||
" " + this.minecraft.worldRenderer.chunkSectionUpdateQueue.length + " chunk updates", 1, 1);
|
" " + this.minecraft.worldRenderer.chunkSectionUpdateQueue.length + " chunk updates", 1, 1);
|
||||||
this.drawString(stack, Math.floor(this.minecraft.player.x) + ", " + Math.floor(this.minecraft.player.y) + ", " + Math.floor(this.minecraft.player.z)
|
this.drawString(stack, Math.floor(this.minecraft.player.x) + ", " + Math.floor(this.minecraft.player.y) + ", " + Math.floor(this.minecraft.player.z)
|
||||||
|
|||||||
Reference in New Issue
Block a user