build minify version
This commit is contained in:
parent
87bc10094e
commit
37e14215b6
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,8 @@
|
||||||
"docs-serve": "docsify serve docs"
|
"docs-serve": "docsify serve docs"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "2.8.7",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"docsify-cli": "^4.4.4"
|
"docsify-cli": "^4.4.4",
|
||||||
|
"prettier": "2.8.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
|
import terser from '@rollup/plugin-terser';
|
||||||
import pkg from './package.json' assert { type: 'json' };
|
import pkg from './package.json' assert { type: 'json' };
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: 'src/main.js',
|
input: 'src/main.js',
|
||||||
output: {
|
output: [
|
||||||
file: `dist/engine-${pkg.version}.js`,
|
{
|
||||||
format: 'es',
|
file: `dist/engine-${pkg.version}.js`,
|
||||||
},
|
format: 'es',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
file: `dist/engine-${pkg.version}.min.js`,
|
||||||
|
format: 'es',
|
||||||
|
plugins: [terser()],
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,7 +12,7 @@ export class App {
|
||||||
options = {
|
options = {
|
||||||
backgroundColor: '#ffcc68',
|
backgroundColor: '#ffcc68',
|
||||||
welcome: true,
|
welcome: true,
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
this.#version = 'beeeeeeta';
|
this.#version = 'beeeeeeta';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class Object {
|
class DefaultObject {
|
||||||
constructor(x, y, w, h) {
|
constructor(x, y, w, h) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
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') {
|
constructor(x, y, w, h, fillColor = 'white') {
|
||||||
super(x, y, w, h);
|
super(x, y, w, h);
|
||||||
|
|
||||||
|
@ -135,10 +135,10 @@ export class TiledSprite extends Sprite {
|
||||||
let copyUpByY = Math.ceil(this.y / this.image().height);
|
let copyUpByY = Math.ceil(this.y / this.image().height);
|
||||||
let copyUpByX = Math.ceil(this.y / this.image().width);
|
let copyUpByX = Math.ceil(this.y / this.image().width);
|
||||||
let copyDownByY = Math.ceil(
|
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(
|
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++) {
|
for (let iy = 0; iy <= copyUpByY; iy++) {
|
||||||
|
@ -163,12 +163,12 @@ export class TiledSprite extends Sprite {
|
||||||
context.drawImage(
|
context.drawImage(
|
||||||
this.image(),
|
this.image(),
|
||||||
this.x + this.image().width * ix,
|
this.x + this.image().width * ix,
|
||||||
this.y - this.image().height * iy
|
this.y - this.image().height * iy,
|
||||||
);
|
);
|
||||||
context.drawImage(
|
context.drawImage(
|
||||||
this.image(),
|
this.image(),
|
||||||
this.x - this.image().width * ix,
|
this.x - this.image().width * ix,
|
||||||
this.y - this.image().height * iy
|
this.y - this.image().height * iy,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -197,12 +197,12 @@ export class TiledSprite extends Sprite {
|
||||||
context.drawImage(
|
context.drawImage(
|
||||||
this.image(),
|
this.image(),
|
||||||
this.x + this.image().width * ix,
|
this.x + this.image().width * ix,
|
||||||
this.y + this.image().height * iy
|
this.y + this.image().height * iy,
|
||||||
);
|
);
|
||||||
context.drawImage(
|
context.drawImage(
|
||||||
this.image(),
|
this.image(),
|
||||||
this.x - this.image().width * ix,
|
this.x - this.image().width * ix,
|
||||||
this.y + this.image().height * iy
|
this.y + this.image().height * iy,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ export class SceneLayer {
|
||||||
objects = Array(),
|
objects = Array(),
|
||||||
options = {
|
options = {
|
||||||
debug: false,
|
debug: false,
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
// TODO: check types
|
// TODO: check types
|
||||||
this.#objects = Array();
|
this.#objects = Array();
|
||||||
|
|
Loading…
Reference in New Issue