NERDDISCO commited on
Commit
ae0898c
•
1 Parent(s): 08726c4

feat: make sure that "createGameLoop" will not be removed by AI

Browse files
public/js/utils.js CHANGED
@@ -29,6 +29,8 @@ function createGameLoop(callback) {
29
  return gameLoop;
30
  }
31
 
 
 
32
  function downloadCanvasImage() {
33
  // Get the canvas element
34
  const canvas = document.getElementById('canvas');
@@ -46,14 +48,12 @@ function downloadCanvasImage() {
46
  link.click();
47
  }
48
 
49
-
50
  const clients = {
51
  host: "__ESDEKA::host__",
52
  guest: "__ESDEKA::guest__",
53
  };
54
 
55
  // Shared communicators
56
-
57
  function subscribe(channel, callback) {
58
  function handleMessage(event) {
59
  if (
 
29
  return gameLoop;
30
  }
31
 
32
+ window.createGameLoop = createGameLoop;
33
+
34
  function downloadCanvasImage() {
35
  // Get the canvas element
36
  const canvas = document.getElementById('canvas');
 
48
  link.click();
49
  }
50
 
 
51
  const clients = {
52
  host: "__ESDEKA::host__",
53
  guest: "__ESDEKA::guest__",
54
  };
55
 
56
  // Shared communicators
 
57
  function subscribe(channel, callback) {
58
  function handleMessage(event) {
59
  if (
src/constants/baseGame.ts CHANGED
@@ -7,7 +7,7 @@ function draw(delta) {
7
  // TODO: Add drawing logic here
8
  }
9
 
10
- // NEVER stop the gameloop
11
- requestAnimationFrame(createGameLoop(draw));
12
  `.trim(),
13
  };
 
7
  // TODO: Add drawing logic here
8
  }
9
 
10
+ // DO NOT CHANGE THE FOLLOWING LINE
11
+ requestAnimationFrame(window.createGameLoop(draw));
12
  `.trim(),
13
  };
src/utils/share.tsx CHANGED
@@ -126,6 +126,8 @@ function createGameLoop(callback) {
126
  return gameLoop;
127
  }
128
 
 
 
129
 
130
  /**
131
  * Generated 2D game
 
126
  return gameLoop;
127
  }
128
 
129
+ window.createGameLoop = createGameLoop;
130
+
131
 
132
  /**
133
  * Generated 2D game