cutechicken commited on
Commit
10f6358
β€’
1 Parent(s): e52c580

Update game.js

Browse files
Files changed (1) hide show
  1. game.js +11 -0
game.js CHANGED
@@ -847,6 +847,13 @@ class Particle {
847
  // Game 클래슀
848
  class Game {
849
  constructor() {
 
 
 
 
 
 
 
850
  // κ²Œμž„ μ‹œμž‘ μ—¬λΆ€λ₯Ό μΆ”μ ν•˜λŠ” ν”Œλž˜κ·Έ μΆ”κ°€
851
  this.isStarted = false;
852
  // μ˜€λ””μ˜€ κ΄€λ ¨ 속성 μΆ”κ°€
@@ -1801,6 +1808,9 @@ class Game {
1801
  }
1802
  return;
1803
  }
 
 
 
1804
 
1805
  this.animationFrameId = requestAnimationFrame(() => this.animate());
1806
  // κ²Œμž„μ΄ μ‹œμž‘λ˜μ§€ μ•Šμ•˜μœΌλ©΄ λ Œλ”λ§λ§Œ μˆ˜ν–‰
@@ -1833,6 +1843,7 @@ class Game {
1833
  }
1834
 
1835
  this.renderer.render(this.scene, this.camera);
 
1836
  }
1837
  }
1838
 
 
847
  // Game 클래슀
848
  class Game {
849
  constructor() {
850
+ // Stats μ΄ˆκΈ°ν™” μΆ”κ°€
851
+ this.stats = new Stats();
852
+ this.stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom
853
+ this.stats.dom.style.position = 'absolute';
854
+ this.stats.dom.style.left = '0px';
855
+ this.stats.dom.style.top = '0px';
856
+ document.body.appendChild(this.stats.dom);
857
  // κ²Œμž„ μ‹œμž‘ μ—¬λΆ€λ₯Ό μΆ”μ ν•˜λŠ” ν”Œλž˜κ·Έ μΆ”κ°€
858
  this.isStarted = false;
859
  // μ˜€λ””μ˜€ κ΄€λ ¨ 속성 μΆ”κ°€
 
1808
  }
1809
  return;
1810
  }
1811
+ this.stats.begin();
1812
+
1813
+ this.animationFrameId = requestAnimationFrame(() => this.animate())
1814
 
1815
  this.animationFrameId = requestAnimationFrame(() => this.animate());
1816
  // κ²Œμž„μ΄ μ‹œμž‘λ˜μ§€ μ•Šμ•˜μœΌλ©΄ λ Œλ”λ§λ§Œ μˆ˜ν–‰
 
1843
  }
1844
 
1845
  this.renderer.render(this.scene, this.camera);
1846
+ this.stats.end();
1847
  }
1848
  }
1849