build minify version

This commit is contained in:
Alexander Popov 2023-11-14 00:16:47 +03:00
parent 87bc10094e
commit 37e14215b6
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
6 changed files with 453 additions and 55 deletions

467
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,8 @@
"docs-serve": "docsify serve docs"
},
"devDependencies": {
"prettier": "2.8.7",
"docsify-cli": "^4.4.4"
"@rollup/plugin-terser": "^0.4.4",
"docsify-cli": "^4.4.4",
"prettier": "2.8.7"
}
}

View File

@ -1,9 +1,17 @@
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`,
format: 'es',
},
output: [
{
file: `dist/engine-${pkg.version}.js`,
format: 'es',
},
{
file: `dist/engine-${pkg.version}.min.js`,
format: 'es',
plugins: [terser()],
},
],
};

View File

@ -12,7 +12,7 @@ export class App {
options = {
backgroundColor: '#ffcc68',
welcome: true,
}
},
) {
this.#version = 'beeeeeeta';

View File

@ -1,4 +1,4 @@
class Object {
class DefaultObject {
constructor(x, y, w, h) {
this.x = x;
this.y = y;
@ -14,7 +14,7 @@ export class Empty {
}
}
export class Rect extends Object {
export class Rect extends DefaultObject {
constructor(x, y, w, h, fillColor = 'white') {
super(x, y, w, h);
@ -135,10 +135,10 @@ export class TiledSprite extends Sprite {
let copyUpByY = Math.ceil(this.y / this.image().height);
let copyUpByX = Math.ceil(this.y / this.image().width);
let copyDownByY = Math.ceil(
(context.canvas.height - this.y - this.image().height) / this.image().height
(context.canvas.height - this.y - this.image().height) / this.image().height,
);
let copyDownByX = Math.ceil(
(context.canvas.width - this.y - this.image().width) / this.image().width
(context.canvas.width - this.y - this.image().width) / this.image().width,
);
for (let iy = 0; iy <= copyUpByY; iy++) {
@ -163,12 +163,12 @@ export class TiledSprite extends Sprite {
context.drawImage(
this.image(),
this.x + this.image().width * ix,
this.y - this.image().height * iy
this.y - this.image().height * iy,
);
context.drawImage(
this.image(),
this.x - this.image().width * ix,
this.y - this.image().height * iy
this.y - this.image().height * iy,
);
break;
}
@ -197,12 +197,12 @@ export class TiledSprite extends Sprite {
context.drawImage(
this.image(),
this.x + this.image().width * ix,
this.y + this.image().height * iy
this.y + this.image().height * iy,
);
context.drawImage(
this.image(),
this.x - this.image().width * ix,
this.y + this.image().height * iy
this.y + this.image().height * iy,
);
break;
}

View File

@ -54,7 +54,7 @@ export class SceneLayer {
objects = Array(),
options = {
debug: false,
}
},
) {
// TODO: check types
this.#objects = Array();