Przeglądaj źródła

fixes #1161

tags/v0.5.1^2
Shaun 4 lat temu
rodzic
commit
1b26411b3d
1 zmienionych plików z 11 dodań i 0 usunięć
  1. +11
    -0
      src/client/js/main.js

+ 11
- 0
src/client/js/main.js Wyświetl plik

@@ -27,6 +27,8 @@ define([
) {
return {
hasFocus: true,
lastRender: 0,
msPerFrame: ~~(1000 / 60),

init: function () {
if (isMobile)
@@ -89,6 +91,13 @@ define([
},

update: function () {
const time = +new Date();
if (time - this.lastRender < this.msPerFrame - 1) {
requestAnimationFrame(this.update.bind(this));

return;
}

objects.update();
renderer.update();
uiFactory.update();
@@ -96,6 +105,8 @@ define([
numbers.render();
renderer.render();

this.lastRender = time;

requestAnimationFrame(this.update.bind(this));
}
};


Ładowanie…
Anuluj
Zapisz