From 5d95cfff9fc4a3335604ccbe1f929b6549bc1a94 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Tue, 9 Jan 2024 19:46:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D1=82=D0=BE=D0=B4=20#run=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D1=81=D1=81=D0=B0=20App=20=D1=81=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BD=20=D0=BF=D1=80=D0=B8=D0=B2=D0=B0=D1=82=D0=BD=D1=8B?= =?UTF-8?q?=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/simple_scene/game.js | 2 +- examples/simple_scene/ujs.js | 1 + rollup.config.js | 5 ++--- src/main.js | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) create mode 120000 examples/simple_scene/ujs.js diff --git a/examples/simple_scene/game.js b/examples/simple_scene/game.js index dc248ac..5573f28 100644 --- a/examples/simple_scene/game.js +++ b/examples/simple_scene/game.js @@ -1,4 +1,4 @@ -import * as ujs from './engine.js'; +import * as ujs from './ujs.js'; let app = new ujs.App(400, 400); diff --git a/examples/simple_scene/ujs.js b/examples/simple_scene/ujs.js new file mode 120000 index 0000000..3d5e11c --- /dev/null +++ b/examples/simple_scene/ujs.js @@ -0,0 +1 @@ +../../dist/ujs.js \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index 8060df2..fee1515 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,15 +1,14 @@ import terser from '@rollup/plugin-terser'; -import pkg from './package.json' assert { type: 'json' }; export default { input: 'src/main.js', output: [ { - file: `dist/engine-${pkg.version}.js`, + file: `dist/ujs.js`, format: 'es', }, { - file: `dist/engine-${pkg.version}.min.js`, + file: `dist/ujs.min.js`, format: 'es', plugins: [terser()], }, diff --git a/src/main.js b/src/main.js index bec3a3a..45675f2 100644 --- a/src/main.js +++ b/src/main.js @@ -49,10 +49,10 @@ export class App { Settings.fpsPrevTime = Date.now(); // Start :) - this.run(); + this.#run(); } - run = () => { + #run = () => { // Calculating FPS let fpsNewTime = Date.now(); Settings.fpsDelta = (fpsNewTime - Settings.fpsPrevTime) / 1000; @@ -69,7 +69,7 @@ export class App { // Draw scene this.scene.run(); - requestAnimationFrame(this.run); + requestAnimationFrame(this.#run); }; }