Skip to content

Commit d405d83

Browse files
committed
show stats in development mode only
1 parent 912daec commit d405d83

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/scripts/Setup.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ async function Setup (game) {
3030
game.camera.rotation.order = 'YXZ'
3131
game.camera.position.set(26, 26, 26)
3232
game.scene.add(new AmbientLight(0xdddddd))
33-
game.stats = new Stats()
34-
game.drawcalls = game.stats.addPanel(
35-
new Stats.Panel('calls', '#ff8', '#221')
36-
)
37-
game.stats.showPanel(0)
38-
document.body.appendChild(game.stats.dom)
33+
if (!game.production) {
34+
game.stats = new Stats()
35+
game.drawcalls = game.stats.addPanel(
36+
new Stats.Panel('calls', '#ff8', '#221')
37+
)
38+
game.stats.showPanel(0)
39+
document.body.appendChild(game.stats.dom)
40+
}
3941
game.distanceBasedFog = new DistanceBasedFog(game)
4042
UrlParams(game).then((password) => {
4143
game.password = password

src/scripts/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ class Game {
129129
}
130130

131131
animate () {
132-
if (this.stats !== null) {
132+
if (this.stats) {
133133
this.stats.begin()
134134
this.render()
135135
this.stats.end()
136+
} else {
137+
this.render()
136138
}
137139
window.requestAnimationFrame(() => {
138140
this.animate()
@@ -159,7 +161,9 @@ class Game {
159161
})
160162
this.world.updateChunksAroundPlayer(this.params.chunkdist)
161163
TWEEN.update()
162-
this.drawcalls.update(this.renderer.info.render.calls, 100)
164+
if (!this.production) {
165+
this.drawcalls.update(this.renderer.info.render.calls, 100)
166+
}
163167
if (this.eh.gameState === 'inventory') {
164168
this.pii.render()
165169
}

0 commit comments

Comments
 (0)