@sepveneto/dao 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ import { Camera } from './Camera';
2
+ import { GameObject } from './GameObject';
3
+ export declare class Container extends GameObject {
4
+ x: number;
5
+ y: number;
6
+ z: number;
7
+ rotation: number;
8
+ scaleX: number;
9
+ scaleY: number;
10
+ private children;
11
+ add(child: any): void;
12
+ private updateBounds;
13
+ remove(child: any): void;
14
+ update(delta: number): void;
15
+ draw(ctx: CanvasRenderingContext2D, camera: Camera): void;
16
+ private drawChild;
17
+ }
package/dist/Display.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { GameObject } from './GameObject';
1
2
  declare abstract class DisplayObject {
2
3
  x: number;
3
4
  y: number;
@@ -18,4 +19,42 @@ export declare class DisplayList {
18
19
  add(obj: DisplayObject): void;
19
20
  render(ctx: CanvasRenderingContext2D): void;
20
21
  }
22
+ interface TextStyle {
23
+ fontFamily: string;
24
+ fontSize: number;
25
+ fontStyle?: string;
26
+ color: string;
27
+ align?: 'left' | 'center' | 'right';
28
+ stroke?: string;
29
+ strokeThickness?: number;
30
+ shadow?: {
31
+ offsetX: number;
32
+ offsetY: number;
33
+ color: string;
34
+ blur: number;
35
+ };
36
+ padding?: {
37
+ left: number;
38
+ right: number;
39
+ top: number;
40
+ bottom: number;
41
+ };
42
+ }
43
+ export declare class Text extends GameObject {
44
+ x: number;
45
+ y: number;
46
+ text: string;
47
+ style: TextStyle;
48
+ visible: boolean;
49
+ width: number;
50
+ height: number;
51
+ private canvas;
52
+ private ctx;
53
+ private dirty;
54
+ constructor(text: string, style: TextStyle);
55
+ setText(text: string): void;
56
+ setStyle(style: TextStyle): void;
57
+ private rebuild;
58
+ render(ctx: CanvasRenderingContext2D): void;
59
+ }
21
60
  export {};
@@ -1,3 +1,4 @@
1
+ import { Camera } from './Camera';
1
2
  export declare class GameObject {
2
3
  x: number;
3
4
  y: number;
@@ -5,13 +6,12 @@ export declare class GameObject {
5
6
  width: number;
6
7
  height: number;
7
8
  zIndex: number;
8
- private originX;
9
- private originY;
10
- texture?: HTMLImageElement;
9
+ protected originX: number;
10
+ protected originY: number;
11
+ texture?: HTMLImageElement | HTMLCanvasElement;
11
12
  rotation: number;
12
- constructor(x: number, y: number, z?: number);
13
13
  setOrigin(x: number, y: number): void;
14
- draw(ctx: CanvasRenderingContext2D): void;
14
+ draw(ctx: CanvasRenderingContext2D, _camera: Camera): void;
15
15
  render(ctx: CanvasRenderingContext2D): void;
16
16
  update(_delta: number): void;
17
17
  }
package/dist/dao.cjs CHANGED
@@ -1 +1,2 @@
1
- var e=class{constructor(e){this.ctx=e}render(e){let t=this.ctx,n=e.camera;t.clearRect(0,0,t.canvas.width,t.canvas.height),n.apply(t),e.displayList.render(t);for(let r of e.world.objects){let{px:e,py:i}=n.projection.project(r.x,r.y,r.z);t.save(),t.translate(e,i),r.draw(t),t.restore()}n.restore(t)}},t=class{constructor(){this.events=new Map}on(e,t){this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(t)}off(e,t){this.events.has(e)&&this.events.get(e).delete(t)}emit(e,...t){if(this.events.has(e))for(let n of this.events.get(e))n(...t)}};function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}function r(e,t){if(n(e)!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||`default`);if(n(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function i(e){var t=r(e,`string`);return n(t)==`symbol`?t:t+``}function a(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?o(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const c={KEY_DOWN:Symbol(`keyDown`),KEY_UP:Symbol(`keyUp`),POINTER_DOWN:Symbol(`pointerDown`),POINTER_MOVE:Symbol(`pointerMove`),POINTER_UP:Symbol(`pointerUp`)};var l=class{constructor(e,t){this.keys=new Set,this.pointer={x:0,y:0,dx:0,dy:0,down:!1,justDown:!1,justUp:!1,id:null},this.target=e,this.events=t,window.addEventListener(`keydown`,e=>{e.preventDefault(),this.keys.add(e.code),this.events.emit(c.KEY_DOWN,e)}),window.addEventListener(`keyup`,e=>{this.keys.delete(e.code),this.events.emit(c.KEY_UP,e)}),e.addEventListener(`mousedown`,this.onDown.bind(this)),e.addEventListener(`mousemove`,this.onMove.bind(this)),e.addEventListener(`mouseup`,this.onUp.bind(this)),e.addEventListener(`touchstart`,this.onDown.bind(this),{passive:!1}),e.addEventListener(`touchmove`,this.onMove.bind(this),{passive:!1}),e.addEventListener(`touchend`,this.onUp.bind(this))}update(){this.pointer.justDown=!1,this.pointer.justUp=!1,this.pointer.dx=0,this.pointer.dy=0}isKeyboardDown(e){return this.keys.has(e)}onDown(e){e.preventDefault();let t=this._getPoint(e);if(!t){console.warn(`missing point`);return}this.pointer.down=!0,this.pointer.justDown=!0,this.pointer.x=t.x,this.pointer.y=t.y,this.pointer.id=t.id,this.events.emit(c.POINTER_DOWN,s({},this.pointer))}onMove(e){if(!this.pointer.down)return;e.preventDefault();let t=this._getPoint(e);if(!t){console.warn(`missing point`);return}this.pointer.dx+=t.x-this.pointer.x,this.pointer.dy+=t.y-this.pointer.y,this.pointer.x=t.x,this.pointer.y=t.y,this.events.emit(c.POINTER_MOVE,s({},this.pointer))}onUp(){this.pointer.down=!1,this.pointer.justUp=!0,this.pointer.id=null,this.events.emit(c.POINTER_UP,s({},this.pointer))}_getPoint(e){let t=this.target.getBoundingClientRect(),n,r,i=`mouse`;if(e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(!t)return;n=t.clientX,r=t.clientY,i=t.identifier}else n=e.clientX,r=e.clientY;return{x:n-t.left,y:r-t.top,id:i}}},u=class{get width(){return this.viewport.width}get height(){return this.viewport.height}constructor(e){this.viewport={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.zoom=1,this._followLerp=1,this._offsetX=0,this._offsetY=0,this.originX=0,this.originY=0,this.projection=e}setOrigin(e,t){this.originX=e,this.originY=t}setViewport(e,t,n,r){this.viewport={x:e,y:t,width:n,height:r}}apply(e){e.save(),e.translate(this.originX*this.viewport.width,this.originY*this.viewport.height),e.scale(this.zoom,this.zoom),e.translate(-Math.round(this.x),-Math.round(this.y))}restore(e){e.restore()}project(e,t,n=0){let{px:r,py:i}=this.projection.project(e,t,n);return{px:r-this.x,py:i-this.y}}follow(e,t){var n,r,i;this._followTarget=e,this._followLerp=(n=t==null?void 0:t.lerp)==null?1:n,this._offsetX=(r=t==null?void 0:t.offsetX)==null?0:r,this._offsetY=(i=t==null?void 0:t.offsetY)==null?0:i}stopFollow(){this._followTarget=void 0}update(){if(!this._followTarget)return;let{x:e,y:t,z:n}=this._followTarget,{px:r,py:i}=this.project(e,t,n),a=r+this._offsetX,o=i+this._offsetY;this.x+=a*this._followLerp,this.y+=o*this._followLerp}},d=class{constructor(e,t){this.speed=300,this.camera=e,this.input=t}update(e){let t=this.speed*e/1e3;this.input.isKeyboardDown(`ArrowUp`)&&(this.camera.y+=t),this.input.isKeyboardDown(`ArrowDown`)&&(this.camera.y-=t),this.input.isKeyboardDown(`ArrowLeft`)&&(this.camera.x+=t),this.input.isKeyboardDown(`ArrowRight`)&&(this.camera.x-=t)}},f=class{constructor(){this.x=0,this.y=0,this.originX=.5,this.originY=.5}},p=class extends f{constructor(e,t,n,r=1){super(),this.resolution=1,this.x=e,this.y=t,this.texture=n,this.resolution=r,this.width=n.width/r,this.height=n.height/r}render(e){e.drawImage(this.texture,this.x-this.width*this.originX,this.y-this.height*this.originY,this.width,this.height)}},m=class{constructor(){this.list=[]}add(e){this.list.push(e)}render(e){this.list.forEach(t=>t.render(e))}};function h(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function g(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){h(a,r,i,o,s,`next`,e)}function s(e){h(a,r,i,o,s,`throw`,e)}o(void 0)})}}var _=class{constructor(e,t){this.key=e,this.url=t}},v=class extends _{load(){return new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t(Error(`Failed to load ${this.url}`)),n.src=this.url})}},y=class{constructor(e){this.queue=[],this.textures=e}image(e,t){return this.queue.push(new v(e,t)),this}load(){var e=this;return g(function*(){let t=e.queue.map(t=>t.load().then(n=>{t instanceof v&&e.textures.add(t.key,n)}));e.queue.length=0,yield Promise.all(t)})()}},b,x=class{constructor(){this.map=new Map}add(e,t){this.map.has(e)||this.map.set(e,t)}get(e){let t=this.map.get(e);if(!t)throw Error(`Asset ${e} not found`);return t}has(e){return this.map.has(e)}remove(e){this.map.delete(e)}clear(){this.map.clear()}},S=class{};b=S,b.textures=new x,b.loader=new y(b.textures);var C=class{constructor(e){this.rm=S,this.displayList=e}image(e,t,n,r=1){let i=new p(e,t,this.rm.textures.get(n),r);return this.displayList.add(i),i}},w=class{constructor(e,t){this.world=e,this.strategy=t}update(){this.world.objects.sort((e,t)=>this.strategy.getKey(e)-this.strategy.getKey(t)),this.world.objects.sort((e,t)=>e.zIndex-t.zIndex)}},T=class{constructor(e){this.elapsed=0,this.target=e.target,this.key=e.key,this.start=e.target[e.key],this.end=e.to,this.duration=e.duration,this.delay=e.delay||0;let t=e.easing||`Linear`;typeof t==`string`?this.easing=E[t]:this.easing=t}update(e){if(this.delay>0)return this.delay-=e,!1;this.elapsed+=e;let t=Math.min(this.elapsed/this.duration,1),n=this.easing(t);return this.target[this.key]=this.start+(this.end-this.start)*n,t===1?(this.target[this.key]=this.end,!0):!1}reset(){this.elapsed=0}};const E={Linear:e=>e,EaseOutBack:e=>{let t=3.70158,n=e-1;return 1+n*n*((t+1)*n+t)}};var D=class{constructor(e){for(let t in this.datas=[],this.finished=!1,this.loop=!1,e.to)this.datas.push(new T({target:e.target,key:t,to:e.to[t],duration:e.duration,easing:e.easing,delay:e.delay}));this.loop=e.loop||!1,this.onComplete=e.onComplete}update(e){if(this.finished)return;let t=!0;for(let n of this.datas)n.update(e)||(t=!1);if(t)if(this.loop)this.datas.forEach(e=>e.reset());else{var n;this.finished=!0,(n=this.onComplete)==null||n.call(this)}}},O=class{constructor(){this.tweens=[]}add(e){let t=new D(e);return this.tweens.push(t),t}update(e){for(let t of this.tweens)t.update(e);this.tweens=this.tweens.filter(e=>!e.finished)}},k=class{constructor(){this.objects=[]}add(e){this.objects.push(e)}update(e){for(let t of this.objects)t.update(e)}},A=class{constructor(e,t){this.world=new k,this.system=[],this.displayList=new m,this.add=new C(this.displayList),this.camera=new u(e),this.tween=new O,this.system.push(new w(this.world,t)),this.system.push(this.tween)}_boot(e){this.input=e.input,this.events=e.events,this.config=e.config}registerSystem(e){this.system.push(e)}create(){}resize(e,t){this.camera.setViewport(0,0,e,t)}update(e){for(let n of this.system){var t;(t=n.update)==null||t.call(n,e)}this.camera.update(),this.world.update(e)}},j=class{constructor(e,t,n=0){this.width=0,this.height=0,this.zIndex=0,this.originX=0,this.originY=0,this.rotation=0,this.x=e,this.y=t,this.z=n}setOrigin(e,t){this.originX=e,this.originY=t}draw(e){e.save(),e.rotate(this.rotation),this.render(e),e.restore()}render(e){if(!this.texture)return;let t=this.width||this.texture.width,n=this.height||this.texture.height;e.drawImage(this.texture,-t*this.originX,-n*this.originY,t,n)}update(e){}},M=class{constructor(e=1,t=1){this.scaleX=e,this.scaleY=t}project(e,t){return{px:e*this.scaleX,py:t*this.scaleY}}},N=class{constructor(e,t,n){this.tileWidth=e,this.tileHeight=t,this.zHeight=n}project(e,t,n=0){return{px:(e-t)*this.tileWidth/2,py:(e+t)*this.tileHeight/2-n*this.zHeight}}},P=class{getKey(e){return e.x+e.y+e.z}},F=class{getKey(e){return e.zIndex}},I=class{constructor(n,r){this.lastTime=0,this.scene=null,this.config=s({width:window.innerWidth,height:window.innerHeight},r);let i=window.innerWidth/this.config.width,a=window.devicePixelRatio;n.width=this.config.width*i*a,n.height=this.config.height*i*a,n.style.width=`${this.config.width*i}px`,n.style.height=`${this.config.height*i}px`;let o=n.getContext(`2d`);if(!o)throw Error(`Canvas 2D context not found`);this.events=new t,this.input=new l(n,this.events),this.renderer=new e(o),o.scale(i*a,i*a)}start(e){this.scene=e,e._boot(this),e.registerSystem(this.input),e.registerSystem(this.events),e.create(),e.resize(this.config.width,this.config.height),window.requestAnimationFrame(this.loop.bind(this))}loop(e){let t=e-this.lastTime;this.lastTime=e,this.scene&&(this.scene.update(t),this.renderer.render(this.scene)),window.requestAnimationFrame(this.loop.bind(this))}};exports.Cache=x,exports.Camera=u,exports.CameraController=d,exports.Easings=E,exports.Game=I,exports.GameObject=j,exports.InputEventType=c,exports.InputSystem=l,exports.IsoProjection=N,exports.IsoStragety=P,exports.Projection2D=M,exports.ResourceManager=S,exports.Scene=A,exports.TweenManager=O,exports.ZIndexStragety=F;
1
+ var e=class{constructor(){this.x=0,this.y=0,this.z=0,this.width=0,this.height=0,this.zIndex=0,this.originX=0,this.originY=0,this.rotation=0}setOrigin(e,t){this.originX=e,this.originY=t}draw(e,t){e.save(),e.rotate(this.rotation),this.render(e),e.restore()}render(e){if(!this.texture)return;let t=this.width||this.texture.width,n=this.height||this.texture.height;e.drawImage(this.texture,-t*this.originX,-n*this.originY,t,n)}update(e){}},t=class extends e{constructor(...e){super(...e),this.x=0,this.y=0,this.z=0,this.rotation=0,this.scaleX=1,this.scaleY=1,this.children=[]}add(e){this.children.push(e),this.updateBounds()}updateBounds(){if(!this.children.length){this.width=0,this.height=0;return}let e=1/0,t=1/0,n=-1/0,r=-1/0;this.children.forEach(i=>{let a=i.width||0,o=i.height||0,s=i.x,c=i.y;e=Math.min(e,s),t=Math.min(t,c),n=Math.max(n,s+a),r=Math.max(r,c+o)}),this.width=n-e,this.height=r-t}remove(e){let t=this.children.indexOf(e);t!==-1&&(this.children.splice(t,1),this.updateBounds())}update(e){this.children.forEach(t=>{var n;return(n=t.update)==null?void 0:n.call(t,e)})}draw(e,t){this.children.forEach(n=>{this.drawChild(n,e,t)})}drawChild(e,t,n){let r=this.width*this.originX,i=this.height*this.originY,a=Math.cos(this.rotation),o=Math.sin(this.rotation),s=(e.x-r)*this.scaleX,c=(e.y-i)*this.scaleY,l=this.x+s*a-c*o,u=this.y+s*o+c*a,d=this.z+e.z,f=this.rotation+e.rotation,{px:p,py:m}=n.projection.project(l,u,d);console.log(l,u,this.x,this.y),t.save(),t.translate(p,m),t.rotate(f),e.render(t),t.restore()}},n=class{constructor(e){this.ctx=e}render(e){let n=this.ctx,r=e.camera;n.clearRect(0,0,n.canvas.width,n.canvas.height),r.apply(n),e.displayList.render(n);for(let i of e.world.objects)if(i instanceof t)i.draw(n,r);else{let{px:e,py:t}=r.projection.project(i.x,i.y,i.z);n.save(),n.translate(e,t),i.draw(n,r),n.restore()}r.restore(n)}},r=class{constructor(){this.events=new Map}on(e,t){this.events.has(e)||this.events.set(e,new Set),this.events.get(e).add(t)}off(e,t){this.events.has(e)&&this.events.get(e).delete(t)}emit(e,...t){if(this.events.has(e))for(let n of this.events.get(e))n(...t)}};function i(e){"@babel/helpers - typeof";return i=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i(e)}function a(e,t){if(i(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(i(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function o(e){var t=a(e,`string`);return i(t)==`symbol`?t:t+``}function s(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?c(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}const u={KEY_DOWN:Symbol(`keyDown`),KEY_UP:Symbol(`keyUp`),POINTER_DOWN:Symbol(`pointerDown`),POINTER_MOVE:Symbol(`pointerMove`),POINTER_UP:Symbol(`pointerUp`)};var d=class{constructor(e,t){this.keys=new Set,this.pointer={x:0,y:0,dx:0,dy:0,down:!1,justDown:!1,justUp:!1,id:null},this.target=e,this.events=t,window.addEventListener(`keydown`,e=>{e.preventDefault(),this.keys.add(e.code),this.events.emit(u.KEY_DOWN,e)}),window.addEventListener(`keyup`,e=>{this.keys.delete(e.code),this.events.emit(u.KEY_UP,e)}),e.addEventListener(`mousedown`,this.onDown.bind(this)),e.addEventListener(`mousemove`,this.onMove.bind(this)),e.addEventListener(`mouseup`,this.onUp.bind(this)),e.addEventListener(`touchstart`,this.onDown.bind(this),{passive:!1}),e.addEventListener(`touchmove`,this.onMove.bind(this),{passive:!1}),e.addEventListener(`touchend`,this.onUp.bind(this))}update(){this.pointer.justDown=!1,this.pointer.justUp=!1,this.pointer.dx=0,this.pointer.dy=0}isKeyboardDown(e){return this.keys.has(e)}onDown(e){e.preventDefault();let t=this._getPoint(e);if(!t){console.warn(`missing point`);return}this.pointer.down=!0,this.pointer.justDown=!0,this.pointer.x=t.x,this.pointer.y=t.y,this.pointer.id=t.id,this.events.emit(u.POINTER_DOWN,l({},this.pointer))}onMove(e){if(!this.pointer.down)return;e.preventDefault();let t=this._getPoint(e);if(!t){console.warn(`missing point`);return}this.pointer.dx+=t.x-this.pointer.x,this.pointer.dy+=t.y-this.pointer.y,this.pointer.x=t.x,this.pointer.y=t.y,this.events.emit(u.POINTER_MOVE,l({},this.pointer))}onUp(){this.pointer.down=!1,this.pointer.justUp=!0,this.pointer.id=null,this.events.emit(u.POINTER_UP,l({},this.pointer))}_getPoint(e){let t=this.target.getBoundingClientRect(),n,r,i=`mouse`;if(e instanceof TouchEvent){let t=e.touches[0]||e.changedTouches[0];if(!t)return;n=t.clientX,r=t.clientY,i=t.identifier}else n=e.clientX,r=e.clientY;return{x:n-t.left,y:r-t.top,id:i}}},f=class{get width(){return this.viewport.width}get height(){return this.viewport.height}constructor(e){this.viewport={x:0,y:0,width:0,height:0},this.x=0,this.y=0,this.zoom=1,this._followLerp=1,this._offsetX=0,this._offsetY=0,this.originX=0,this.originY=0,this.projection=e}setOrigin(e,t){this.originX=e,this.originY=t}setViewport(e,t,n,r){this.viewport={x:e,y:t,width:n,height:r}}apply(e){e.save(),e.translate(this.originX*this.viewport.width,this.originY*this.viewport.height),e.scale(this.zoom,this.zoom),e.translate(-Math.round(this.x),-Math.round(this.y))}restore(e){e.restore()}project(e,t,n=0){let{px:r,py:i}=this.projection.project(e,t,n);return{px:r-this.x,py:i-this.y}}follow(e,t){var n,r,i;this._followTarget=e,this._followLerp=(n=t==null?void 0:t.lerp)==null?1:n,this._offsetX=(r=t==null?void 0:t.offsetX)==null?0:r,this._offsetY=(i=t==null?void 0:t.offsetY)==null?0:i}stopFollow(){this._followTarget=void 0}update(){if(!this._followTarget)return;let{x:e,y:t,z:n}=this._followTarget,{px:r,py:i}=this.project(e,t,n),a=r+this._offsetX,o=i+this._offsetY;this.x+=a*this._followLerp,this.y+=o*this._followLerp}},p=class{constructor(e,t){this.speed=300,this.camera=e,this.input=t}update(e){let t=this.speed*e/1e3;this.input.isKeyboardDown(`ArrowUp`)&&(this.camera.y+=t),this.input.isKeyboardDown(`ArrowDown`)&&(this.camera.y-=t),this.input.isKeyboardDown(`ArrowLeft`)&&(this.camera.x+=t),this.input.isKeyboardDown(`ArrowRight`)&&(this.camera.x-=t)}},m=class{constructor(){this.x=0,this.y=0,this.originX=.5,this.originY=.5}},h=class extends m{constructor(e,t,n,r=1){super(),this.resolution=1,this.x=e,this.y=t,this.texture=n,this.resolution=r,this.width=n.width/r,this.height=n.height/r}render(e){e.drawImage(this.texture,this.x-this.width*this.originX,this.y-this.height*this.originY,this.width,this.height)}},g=class{constructor(){this.list=[]}add(e){this.list.push(e)}render(e){this.list.forEach(t=>t.render(e))}},_=class extends e{constructor(e,t){super(),this.x=0,this.y=0,this.visible=!0,this.width=0,this.height=0,this.dirty=!0,this.text=e,this.style=t,this.canvas=document.createElement(`canvas`),this.ctx=this.canvas.getContext(`2d`),this.texture=this.canvas}setText(e){this.text!==e&&(this.text=e,this.dirty=!0)}setStyle(e){Object.assign(this.style,e),this.dirty=!0}rebuild(){var e,t,n;if(!this.dirty)return;let r=this.ctx,i=this.style,a=this.text.split(`
2
+ `),o=(e=i.padding)==null?{left:0,right:0,top:0,bottom:0}:e;r.font=`${(t=i.fontStyle)==null?``:t} ${i.fontSize}px ${i.fontFamily}`;let s=0;for(let e of a)s=Math.max(s,r.measureText(e).width);let c=i.fontSize*1.2;this.width=s+o.left+o.right,this.height=a.length*c+o.top+o.bottom,this.canvas.width=Math.ceil(this.width),this.canvas.height=Math.ceil(this.height),r.clearRect(0,0,this.canvas.width,this.canvas.height),r.font=`${(n=i.fontStyle)==null?``:n} ${i.fontSize}px ${i.fontFamily}`,r.fillStyle=i.color,r.textBaseline=`top`,i.shadow&&(r.shadowOffsetX=i.shadow.offsetX,r.shadowOffsetY=i.shadow.offsetY,r.shadowColor=i.shadow.color,r.shadowBlur=i.shadow.blur);let l=o.top;for(let e of a){let t=o.left,n=r.measureText(e).width;i.align===`center`?t+=(this.width-o.left-o.right-n)/2:i.align===`right`&&(t+=this.width-o.left-o.right-n),i.stroke&&i.strokeThickness&&(r.lineWidth=i.strokeThickness,r.strokeStyle=i.stroke,r.strokeText(e,t,l)),r.fillText(e,t,l),l+=c}this.dirty=!1}render(e){if(!this.texture)return;this.rebuild();let t=this.width||this.canvas.width,n=this.height;e.drawImage(this.texture,-t*this.originX,-n*this.originY,t,n)}};function v(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){v(a,r,i,o,s,`next`,e)}function s(e){v(a,r,i,o,s,`throw`,e)}o(void 0)})}}var b=class{constructor(e,t){this.key=e,this.url=t}},x=class extends b{load(){return new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t(Error(`Failed to load ${this.url}`)),n.src=this.url})}},S=class{constructor(e){this.queue=[],this.textures=e}image(e,t){return this.queue.push(new x(e,t)),this}load(){var e=this;return y(function*(){let t=e.queue.map(t=>t.load().then(n=>{t instanceof x&&e.textures.add(t.key,n)}));e.queue.length=0,yield Promise.all(t)})()}},C,w=class{constructor(){this.map=new Map}add(e,t){this.map.has(e)||this.map.set(e,t)}get(e){let t=this.map.get(e);if(!t)throw Error(`Asset ${e} not found`);return t}has(e){return this.map.has(e)}remove(e){this.map.delete(e)}clear(){this.map.clear()}},T=class{};C=T,C.textures=new w,C.loader=new S(C.textures);var E=class{constructor(e){this.rm=T,this.displayList=e}image(e,t,n,r=1){let i=new h(e,t,this.rm.textures.get(n),r);return this.displayList.add(i),i}},D=class{constructor(e,t){this.world=e,this.strategy=t}update(){this.world.objects.sort((e,t)=>this.strategy.getKey(e)-this.strategy.getKey(t)),this.world.objects.sort((e,t)=>e.zIndex-t.zIndex)}},O=class{constructor(e){this.elapsed=0,this.target=e.target,this.key=e.key,this.start=e.target[e.key],this.end=e.to,this.duration=e.duration,this.delay=e.delay||0;let t=e.easing||`Linear`;typeof t==`string`?this.easing=k[t]:this.easing=t}update(e){if(this.delay>0)return this.delay-=e,!1;this.elapsed+=e;let t=Math.min(this.elapsed/this.duration,1),n=this.easing(t);return this.target[this.key]=this.start+(this.end-this.start)*n,t===1?(this.target[this.key]=this.end,!0):!1}reset(){this.elapsed=0}};const k={Linear:e=>e,EaseOutBack:e=>{let t=3.70158,n=e-1;return 1+n*n*((t+1)*n+t)}};var A=class{constructor(e){for(let t in this.datas=[],this.finished=!1,this.loop=!1,e.to)this.datas.push(new O({target:e.target,key:t,to:e.to[t],duration:e.duration,easing:e.easing,delay:e.delay}));this.loop=e.loop||!1,this.onComplete=e.onComplete}update(e){if(this.finished)return;let t=!0;for(let n of this.datas)n.update(e)||(t=!1);if(t)if(this.loop)this.datas.forEach(e=>e.reset());else{var n;this.finished=!0,(n=this.onComplete)==null||n.call(this)}}},j=class{constructor(){this.tweens=[]}add(e){let t=new A(e);return this.tweens.push(t),t}update(e){for(let t of this.tweens)t.update(e);this.tweens=this.tweens.filter(e=>!e.finished)}},M=class{constructor(){this.objects=[]}add(e){this.objects.push(e)}update(e){for(let t of this.objects)t.update(e)}},N=class{constructor(e,t){this.world=new M,this.system=[],this.displayList=new g,this.add=new E(this.displayList),this.camera=new f(e),this.tween=new j,this.system.push(new D(this.world,t)),this.system.push(this.tween)}_boot(e){this.input=e.input,this.events=e.events,this.config=e.config}registerSystem(e){this.system.push(e)}create(){}resize(e,t){this.camera.setViewport(0,0,e,t)}update(e){for(let n of this.system){var t;(t=n.update)==null||t.call(n,e)}this.camera.update(),this.world.update(e)}},P=class{constructor(e=1,t=1){this.scaleX=e,this.scaleY=t}project(e,t){return{px:e*this.scaleX,py:t*this.scaleY}}},F=class{constructor(e,t,n){this.tileWidth=e,this.tileHeight=t,this.zHeight=n}project(e,t,n=0){return{px:(e-t)*this.tileWidth/2,py:(e+t)*this.tileHeight/2-n*this.zHeight}}},I=class{getKey(e){return e.x+e.y+e.z}},L=class{getKey(e){return e.zIndex}},R=class{constructor(e,t){this.lastTime=0,this.scene=null,this.config=l({width:window.innerWidth,height:window.innerHeight},t);let i=window.innerWidth/this.config.width,a=window.devicePixelRatio;e.width=this.config.width*i*a,e.height=this.config.height*i*a,e.style.width=`${this.config.width*i}px`,e.style.height=`${this.config.height*i}px`;let o=e.getContext(`2d`);if(!o)throw Error(`Canvas 2D context not found`);this.events=new r,this.input=new d(e,this.events),this.renderer=new n(o),o.scale(i*a,i*a)}start(e){this.scene=e,e._boot(this),e.registerSystem(this.input),e.registerSystem(this.events),e.create(),e.resize(this.config.width,this.config.height),window.requestAnimationFrame(this.loop.bind(this))}loop(e){let t=e-this.lastTime;this.lastTime=e,this.scene&&(this.scene.update(t),this.renderer.render(this.scene)),window.requestAnimationFrame(this.loop.bind(this))}};exports.Cache=w,exports.Camera=f,exports.CameraController=p,exports.DisplayList=g,exports.Easings=k,exports.Game=R,exports.GameObject=e,exports.ImageObject=h,exports.InputEventType=u,exports.InputSystem=d,exports.IsoProjection=F,exports.IsoStragety=I,exports.Projection2D=P,exports.ResourceManager=T,exports.Scene=N,exports.Text=_,exports.TweenManager=j,exports.ZIndexStragety=L;
package/dist/dao.js CHANGED
@@ -1,80 +1,134 @@
1
- var Renderer = class {
2
- constructor(l) {
3
- this.ctx = l;
4
- }
5
- render(l) {
6
- let k = this.ctx, A = l.camera;
7
- k.clearRect(0, 0, k.canvas.width, k.canvas.height), A.apply(k), l.displayList.render(k);
8
- for (let j of l.world.objects) {
9
- let { px: l, py: M } = A.projection.project(j.x, j.y, j.z);
10
- k.save(), k.translate(l, M), j.draw(k), k.restore();
1
+ var GameObject = class {
2
+ constructor() {
3
+ this.x = 0, this.y = 0, this.z = 0, this.width = 0, this.height = 0, this.zIndex = 0, this.originX = 0, this.originY = 0, this.rotation = 0;
4
+ }
5
+ setOrigin(r, T) {
6
+ this.originX = r, this.originY = T;
7
+ }
8
+ draw(r, T) {
9
+ r.save(), r.rotate(this.rotation), this.render(r), r.restore();
10
+ }
11
+ render(r) {
12
+ if (!this.texture) return;
13
+ let T = this.width || this.texture.width, E = this.height || this.texture.height;
14
+ r.drawImage(this.texture, -T * this.originX, -E * this.originY, T, E);
15
+ }
16
+ update(r) {}
17
+ }, Container = class extends GameObject {
18
+ constructor(...r) {
19
+ super(...r), this.x = 0, this.y = 0, this.z = 0, this.rotation = 0, this.scaleX = 1, this.scaleY = 1, this.children = [];
20
+ }
21
+ add(r) {
22
+ this.children.push(r), this.updateBounds();
23
+ }
24
+ updateBounds() {
25
+ if (!this.children.length) {
26
+ this.width = 0, this.height = 0;
27
+ return;
28
+ }
29
+ let r = Infinity, T = Infinity, E = -Infinity, D = -Infinity;
30
+ this.children.forEach((O) => {
31
+ let k = O.width || 0, A = O.height || 0, j = O.x, M = O.y;
32
+ r = Math.min(r, j), T = Math.min(T, M), E = Math.max(E, j + k), D = Math.max(D, M + A);
33
+ }), this.width = E - r, this.height = D - T;
34
+ }
35
+ remove(r) {
36
+ let T = this.children.indexOf(r);
37
+ T !== -1 && (this.children.splice(T, 1), this.updateBounds());
38
+ }
39
+ update(r) {
40
+ this.children.forEach((T) => {
41
+ var E;
42
+ return (E = T.update) == null ? void 0 : E.call(T, r);
43
+ });
44
+ }
45
+ draw(r, T) {
46
+ this.children.forEach((E) => {
47
+ this.drawChild(E, r, T);
48
+ });
49
+ }
50
+ drawChild(r, T, E) {
51
+ let D = this.width * this.originX, O = this.height * this.originY, k = Math.cos(this.rotation), A = Math.sin(this.rotation), j = (r.x - D) * this.scaleX, M = (r.y - O) * this.scaleY, N = this.x + j * k - M * A, P = this.y + j * A + M * k, F = this.z + r.z, I = this.rotation + r.rotation, { px: L, py: R } = E.projection.project(N, P, F);
52
+ console.log(N, P, this.x, this.y), T.save(), T.translate(L, R), T.rotate(I), r.render(T), T.restore();
53
+ }
54
+ }, Renderer = class {
55
+ constructor(r) {
56
+ this.ctx = r;
57
+ }
58
+ render(r) {
59
+ let E = this.ctx, D = r.camera;
60
+ E.clearRect(0, 0, E.canvas.width, E.canvas.height), D.apply(E), r.displayList.render(E);
61
+ for (let O of r.world.objects) if (O instanceof Container) O.draw(E, D);
62
+ else {
63
+ let { px: r, py: T } = D.projection.project(O.x, O.y, O.z);
64
+ E.save(), E.translate(r, T), O.draw(E, D), E.restore();
11
65
  }
12
- A.restore(k);
66
+ D.restore(E);
13
67
  }
14
68
  }, EventSystem = class {
15
69
  constructor() {
16
70
  this.events = /* @__PURE__ */ new Map();
17
71
  }
18
- on(l, k) {
19
- this.events.has(l) || this.events.set(l, /* @__PURE__ */ new Set()), this.events.get(l).add(k);
72
+ on(r, T) {
73
+ this.events.has(r) || this.events.set(r, /* @__PURE__ */ new Set()), this.events.get(r).add(T);
20
74
  }
21
- off(l, k) {
22
- this.events.has(l) && this.events.get(l).delete(k);
75
+ off(r, T) {
76
+ this.events.has(r) && this.events.get(r).delete(T);
23
77
  }
24
- emit(l, ...k) {
25
- if (this.events.has(l)) for (let A of this.events.get(l)) A(...k);
78
+ emit(r, ...T) {
79
+ if (this.events.has(r)) for (let E of this.events.get(r)) E(...T);
26
80
  }
27
81
  };
28
- function _typeof(l) {
82
+ function _typeof(r) {
29
83
  "@babel/helpers - typeof";
30
- return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(l) {
31
- return typeof l;
32
- } : function(l) {
33
- return l && typeof Symbol == "function" && l.constructor === Symbol && l !== Symbol.prototype ? "symbol" : typeof l;
34
- }, _typeof(l);
84
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
85
+ return typeof r;
86
+ } : function(r) {
87
+ return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
88
+ }, _typeof(r);
35
89
  }
36
- function toPrimitive(l, k) {
37
- if (_typeof(l) != "object" || !l) return l;
38
- var j = l[Symbol.toPrimitive];
39
- if (j !== void 0) {
40
- var M = j.call(l, k || "default");
41
- if (_typeof(M) != "object") return M;
90
+ function toPrimitive(r, T) {
91
+ if (_typeof(r) != "object" || !r) return r;
92
+ var E = r[Symbol.toPrimitive];
93
+ if (E !== void 0) {
94
+ var D = E.call(r, T || "default");
95
+ if (_typeof(D) != "object") return D;
42
96
  throw TypeError("@@toPrimitive must return a primitive value.");
43
97
  }
44
- return (k === "string" ? String : Number)(l);
98
+ return (T === "string" ? String : Number)(r);
45
99
  }
46
- function toPropertyKey(l) {
47
- var k = toPrimitive(l, "string");
48
- return _typeof(k) == "symbol" ? k : k + "";
100
+ function toPropertyKey(r) {
101
+ var T = toPrimitive(r, "string");
102
+ return _typeof(T) == "symbol" ? T : T + "";
49
103
  }
50
- function _defineProperty(l, k, A) {
51
- return (k = toPropertyKey(k)) in l ? Object.defineProperty(l, k, {
52
- value: A,
104
+ function _defineProperty(r, T, E) {
105
+ return (T = toPropertyKey(T)) in r ? Object.defineProperty(r, T, {
106
+ value: E,
53
107
  enumerable: !0,
54
108
  configurable: !0,
55
109
  writable: !0
56
- }) : l[k] = A, l;
110
+ }) : r[T] = E, r;
57
111
  }
58
- function ownKeys(l, k) {
59
- var A = Object.keys(l);
112
+ function ownKeys(r, T) {
113
+ var E = Object.keys(r);
60
114
  if (Object.getOwnPropertySymbols) {
61
- var j = Object.getOwnPropertySymbols(l);
62
- k && (j = j.filter(function(k) {
63
- return Object.getOwnPropertyDescriptor(l, k).enumerable;
64
- })), A.push.apply(A, j);
115
+ var D = Object.getOwnPropertySymbols(r);
116
+ T && (D = D.filter(function(T) {
117
+ return Object.getOwnPropertyDescriptor(r, T).enumerable;
118
+ })), E.push.apply(E, D);
65
119
  }
66
- return A;
120
+ return E;
67
121
  }
68
- function _objectSpread2(l) {
69
- for (var k = 1; k < arguments.length; k++) {
70
- var A = arguments[k] == null ? {} : arguments[k];
71
- k % 2 ? ownKeys(Object(A), !0).forEach(function(k) {
72
- _defineProperty(l, k, A[k]);
73
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(l, Object.getOwnPropertyDescriptors(A)) : ownKeys(Object(A)).forEach(function(k) {
74
- Object.defineProperty(l, k, Object.getOwnPropertyDescriptor(A, k));
122
+ function _objectSpread2(r) {
123
+ for (var T = 1; T < arguments.length; T++) {
124
+ var E = arguments[T] == null ? {} : arguments[T];
125
+ T % 2 ? ownKeys(Object(E), !0).forEach(function(T) {
126
+ _defineProperty(r, T, E[T]);
127
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(E)) : ownKeys(Object(E)).forEach(function(T) {
128
+ Object.defineProperty(r, T, Object.getOwnPropertyDescriptor(E, T));
75
129
  });
76
130
  }
77
- return l;
131
+ return r;
78
132
  }
79
133
  const InputEventType = {
80
134
  KEY_DOWN: Symbol("keyDown"),
@@ -84,7 +138,7 @@ const InputEventType = {
84
138
  POINTER_UP: Symbol("pointerUp")
85
139
  };
86
140
  var InputSystem = class {
87
- constructor(l, k) {
141
+ constructor(r, T) {
88
142
  this.keys = /* @__PURE__ */ new Set(), this.pointer = {
89
143
  x: 0,
90
144
  y: 0,
@@ -94,51 +148,51 @@ var InputSystem = class {
94
148
  justDown: !1,
95
149
  justUp: !1,
96
150
  id: null
97
- }, this.target = l, this.events = k, window.addEventListener("keydown", (l) => {
98
- l.preventDefault(), this.keys.add(l.code), this.events.emit(InputEventType.KEY_DOWN, l);
99
- }), window.addEventListener("keyup", (l) => {
100
- this.keys.delete(l.code), this.events.emit(InputEventType.KEY_UP, l);
101
- }), l.addEventListener("mousedown", this.onDown.bind(this)), l.addEventListener("mousemove", this.onMove.bind(this)), l.addEventListener("mouseup", this.onUp.bind(this)), l.addEventListener("touchstart", this.onDown.bind(this), { passive: !1 }), l.addEventListener("touchmove", this.onMove.bind(this), { passive: !1 }), l.addEventListener("touchend", this.onUp.bind(this));
151
+ }, this.target = r, this.events = T, window.addEventListener("keydown", (r) => {
152
+ r.preventDefault(), this.keys.add(r.code), this.events.emit(InputEventType.KEY_DOWN, r);
153
+ }), window.addEventListener("keyup", (r) => {
154
+ this.keys.delete(r.code), this.events.emit(InputEventType.KEY_UP, r);
155
+ }), r.addEventListener("mousedown", this.onDown.bind(this)), r.addEventListener("mousemove", this.onMove.bind(this)), r.addEventListener("mouseup", this.onUp.bind(this)), r.addEventListener("touchstart", this.onDown.bind(this), { passive: !1 }), r.addEventListener("touchmove", this.onMove.bind(this), { passive: !1 }), r.addEventListener("touchend", this.onUp.bind(this));
102
156
  }
103
157
  update() {
104
158
  this.pointer.justDown = !1, this.pointer.justUp = !1, this.pointer.dx = 0, this.pointer.dy = 0;
105
159
  }
106
- isKeyboardDown(l) {
107
- return this.keys.has(l);
160
+ isKeyboardDown(r) {
161
+ return this.keys.has(r);
108
162
  }
109
- onDown(l) {
110
- l.preventDefault();
111
- let k = this._getPoint(l);
112
- if (!k) {
163
+ onDown(r) {
164
+ r.preventDefault();
165
+ let T = this._getPoint(r);
166
+ if (!T) {
113
167
  console.warn("missing point");
114
168
  return;
115
169
  }
116
- this.pointer.down = !0, this.pointer.justDown = !0, this.pointer.x = k.x, this.pointer.y = k.y, this.pointer.id = k.id, this.events.emit(InputEventType.POINTER_DOWN, _objectSpread2({}, this.pointer));
170
+ this.pointer.down = !0, this.pointer.justDown = !0, this.pointer.x = T.x, this.pointer.y = T.y, this.pointer.id = T.id, this.events.emit(InputEventType.POINTER_DOWN, _objectSpread2({}, this.pointer));
117
171
  }
118
- onMove(l) {
172
+ onMove(r) {
119
173
  if (!this.pointer.down) return;
120
- l.preventDefault();
121
- let k = this._getPoint(l);
122
- if (!k) {
174
+ r.preventDefault();
175
+ let T = this._getPoint(r);
176
+ if (!T) {
123
177
  console.warn("missing point");
124
178
  return;
125
179
  }
126
- this.pointer.dx += k.x - this.pointer.x, this.pointer.dy += k.y - this.pointer.y, this.pointer.x = k.x, this.pointer.y = k.y, this.events.emit(InputEventType.POINTER_MOVE, _objectSpread2({}, this.pointer));
180
+ this.pointer.dx += T.x - this.pointer.x, this.pointer.dy += T.y - this.pointer.y, this.pointer.x = T.x, this.pointer.y = T.y, this.events.emit(InputEventType.POINTER_MOVE, _objectSpread2({}, this.pointer));
127
181
  }
128
182
  onUp() {
129
183
  this.pointer.down = !1, this.pointer.justUp = !0, this.pointer.id = null, this.events.emit(InputEventType.POINTER_UP, _objectSpread2({}, this.pointer));
130
184
  }
131
- _getPoint(l) {
132
- let k = this.target.getBoundingClientRect(), A, j, M = "mouse";
133
- if (l instanceof TouchEvent) {
134
- let k = l.touches[0] || l.changedTouches[0];
135
- if (!k) return;
136
- A = k.clientX, j = k.clientY, M = k.identifier;
137
- } else A = l.clientX, j = l.clientY;
185
+ _getPoint(r) {
186
+ let T = this.target.getBoundingClientRect(), E, D, O = "mouse";
187
+ if (r instanceof TouchEvent) {
188
+ let T = r.touches[0] || r.changedTouches[0];
189
+ if (!T) return;
190
+ E = T.clientX, D = T.clientY, O = T.identifier;
191
+ } else E = r.clientX, D = r.clientY;
138
192
  return {
139
- x: A - k.left,
140
- y: j - k.top,
141
- id: M
193
+ x: E - T.left,
194
+ y: D - T.top,
195
+ id: O
142
196
  };
143
197
  }
144
198
  }, Camera = class {
@@ -148,148 +202,185 @@ var InputSystem = class {
148
202
  get height() {
149
203
  return this.viewport.height;
150
204
  }
151
- constructor(l) {
205
+ constructor(r) {
152
206
  this.viewport = {
153
207
  x: 0,
154
208
  y: 0,
155
209
  width: 0,
156
210
  height: 0
157
- }, this.x = 0, this.y = 0, this.zoom = 1, this._followLerp = 1, this._offsetX = 0, this._offsetY = 0, this.originX = 0, this.originY = 0, this.projection = l;
211
+ }, this.x = 0, this.y = 0, this.zoom = 1, this._followLerp = 1, this._offsetX = 0, this._offsetY = 0, this.originX = 0, this.originY = 0, this.projection = r;
158
212
  }
159
- setOrigin(l, k) {
160
- this.originX = l, this.originY = k;
213
+ setOrigin(r, T) {
214
+ this.originX = r, this.originY = T;
161
215
  }
162
- setViewport(l, k, A, j) {
216
+ setViewport(r, T, E, D) {
163
217
  this.viewport = {
164
- x: l,
165
- y: k,
166
- width: A,
167
- height: j
218
+ x: r,
219
+ y: T,
220
+ width: E,
221
+ height: D
168
222
  };
169
223
  }
170
- apply(l) {
171
- l.save(), l.translate(this.originX * this.viewport.width, this.originY * this.viewport.height), l.scale(this.zoom, this.zoom), l.translate(-Math.round(this.x), -Math.round(this.y));
224
+ apply(r) {
225
+ r.save(), r.translate(this.originX * this.viewport.width, this.originY * this.viewport.height), r.scale(this.zoom, this.zoom), r.translate(-Math.round(this.x), -Math.round(this.y));
172
226
  }
173
- restore(l) {
174
- l.restore();
227
+ restore(r) {
228
+ r.restore();
175
229
  }
176
- project(l, k, A = 0) {
177
- let { px: j, py: M } = this.projection.project(l, k, A);
230
+ project(r, T, E = 0) {
231
+ let { px: D, py: O } = this.projection.project(r, T, E);
178
232
  return {
179
- px: j - this.x,
180
- py: M - this.y
233
+ px: D - this.x,
234
+ py: O - this.y
181
235
  };
182
236
  }
183
- follow(l, k) {
184
- var A, j, M;
185
- this._followTarget = l, this._followLerp = (A = k == null ? void 0 : k.lerp) == null ? 1 : A, this._offsetX = (j = k == null ? void 0 : k.offsetX) == null ? 0 : j, this._offsetY = (M = k == null ? void 0 : k.offsetY) == null ? 0 : M;
237
+ follow(r, T) {
238
+ var E, D, O;
239
+ this._followTarget = r, this._followLerp = (E = T == null ? void 0 : T.lerp) == null ? 1 : E, this._offsetX = (D = T == null ? void 0 : T.offsetX) == null ? 0 : D, this._offsetY = (O = T == null ? void 0 : T.offsetY) == null ? 0 : O;
186
240
  }
187
241
  stopFollow() {
188
242
  this._followTarget = void 0;
189
243
  }
190
244
  update() {
191
245
  if (!this._followTarget) return;
192
- let { x: l, y: k, z: A } = this._followTarget, { px: j, py: M } = this.project(l, k, A), N = j + this._offsetX, P = M + this._offsetY;
193
- this.x += N * this._followLerp, this.y += P * this._followLerp;
246
+ let { x: r, y: T, z: E } = this._followTarget, { px: D, py: O } = this.project(r, T, E), k = D + this._offsetX, A = O + this._offsetY;
247
+ this.x += k * this._followLerp, this.y += A * this._followLerp;
194
248
  }
195
249
  }, CameraController = class {
196
- constructor(l, k) {
197
- this.speed = 300, this.camera = l, this.input = k;
250
+ constructor(r, T) {
251
+ this.speed = 300, this.camera = r, this.input = T;
198
252
  }
199
- update(l) {
200
- let k = this.speed * l / 1e3;
201
- this.input.isKeyboardDown("ArrowUp") && (this.camera.y += k), this.input.isKeyboardDown("ArrowDown") && (this.camera.y -= k), this.input.isKeyboardDown("ArrowLeft") && (this.camera.x += k), this.input.isKeyboardDown("ArrowRight") && (this.camera.x -= k);
253
+ update(r) {
254
+ let T = this.speed * r / 1e3;
255
+ this.input.isKeyboardDown("ArrowUp") && (this.camera.y += T), this.input.isKeyboardDown("ArrowDown") && (this.camera.y -= T), this.input.isKeyboardDown("ArrowLeft") && (this.camera.x += T), this.input.isKeyboardDown("ArrowRight") && (this.camera.x -= T);
202
256
  }
203
257
  }, DisplayObject = class {
204
258
  constructor() {
205
259
  this.x = 0, this.y = 0, this.originX = .5, this.originY = .5;
206
260
  }
207
261
  }, ImageObject = class extends DisplayObject {
208
- constructor(l, k, A, j = 1) {
209
- super(), this.resolution = 1, this.x = l, this.y = k, this.texture = A, this.resolution = j, this.width = A.width / j, this.height = A.height / j;
262
+ constructor(r, T, E, D = 1) {
263
+ super(), this.resolution = 1, this.x = r, this.y = T, this.texture = E, this.resolution = D, this.width = E.width / D, this.height = E.height / D;
210
264
  }
211
- render(l) {
212
- l.drawImage(this.texture, this.x - this.width * this.originX, this.y - this.height * this.originY, this.width, this.height);
265
+ render(r) {
266
+ r.drawImage(this.texture, this.x - this.width * this.originX, this.y - this.height * this.originY, this.width, this.height);
213
267
  }
214
268
  }, DisplayList = class {
215
269
  constructor() {
216
270
  this.list = [];
217
271
  }
218
- add(l) {
219
- this.list.push(l);
272
+ add(r) {
273
+ this.list.push(r);
274
+ }
275
+ render(r) {
276
+ this.list.forEach((T) => T.render(r));
277
+ }
278
+ }, Text = class extends GameObject {
279
+ constructor(r, T) {
280
+ super(), this.x = 0, this.y = 0, this.visible = !0, this.width = 0, this.height = 0, this.dirty = !0, this.text = r, this.style = T, this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), this.texture = this.canvas;
281
+ }
282
+ setText(r) {
283
+ this.text !== r && (this.text = r, this.dirty = !0);
284
+ }
285
+ setStyle(r) {
286
+ Object.assign(this.style, r), this.dirty = !0;
287
+ }
288
+ rebuild() {
289
+ var r, T, E;
290
+ if (!this.dirty) return;
291
+ let D = this.ctx, O = this.style, k = this.text.split("\n"), A = (r = O.padding) == null ? {
292
+ left: 0,
293
+ right: 0,
294
+ top: 0,
295
+ bottom: 0
296
+ } : r;
297
+ D.font = `${(T = O.fontStyle) == null ? "" : T} ${O.fontSize}px ${O.fontFamily}`;
298
+ let j = 0;
299
+ for (let r of k) j = Math.max(j, D.measureText(r).width);
300
+ let M = O.fontSize * 1.2;
301
+ this.width = j + A.left + A.right, this.height = k.length * M + A.top + A.bottom, this.canvas.width = Math.ceil(this.width), this.canvas.height = Math.ceil(this.height), D.clearRect(0, 0, this.canvas.width, this.canvas.height), D.font = `${(E = O.fontStyle) == null ? "" : E} ${O.fontSize}px ${O.fontFamily}`, D.fillStyle = O.color, D.textBaseline = "top", O.shadow && (D.shadowOffsetX = O.shadow.offsetX, D.shadowOffsetY = O.shadow.offsetY, D.shadowColor = O.shadow.color, D.shadowBlur = O.shadow.blur);
302
+ let N = A.top;
303
+ for (let r of k) {
304
+ let T = A.left, E = D.measureText(r).width;
305
+ O.align === "center" ? T += (this.width - A.left - A.right - E) / 2 : O.align === "right" && (T += this.width - A.left - A.right - E), O.stroke && O.strokeThickness && (D.lineWidth = O.strokeThickness, D.strokeStyle = O.stroke, D.strokeText(r, T, N)), D.fillText(r, T, N), N += M;
306
+ }
307
+ this.dirty = !1;
220
308
  }
221
- render(l) {
222
- this.list.forEach((k) => k.render(l));
309
+ render(r) {
310
+ if (!this.texture) return;
311
+ this.rebuild();
312
+ let T = this.width || this.canvas.width, E = this.height;
313
+ r.drawImage(this.texture, -T * this.originX, -E * this.originY, T, E);
223
314
  }
224
315
  };
225
- function asyncGeneratorStep(l, k, A, j, M, N, P) {
316
+ function asyncGeneratorStep(r, T, E, D, O, k, A) {
226
317
  try {
227
- var F = l[N](P), I = F.value;
228
- } catch (l) {
229
- A(l);
318
+ var j = r[k](A), M = j.value;
319
+ } catch (r) {
320
+ E(r);
230
321
  return;
231
322
  }
232
- F.done ? k(I) : Promise.resolve(I).then(j, M);
323
+ j.done ? T(M) : Promise.resolve(M).then(D, O);
233
324
  }
234
- function _asyncToGenerator(l) {
325
+ function _asyncToGenerator(r) {
235
326
  return function() {
236
- var k = this, A = arguments;
237
- return new Promise(function(j, M) {
238
- var N = l.apply(k, A);
239
- function P(l) {
240
- asyncGeneratorStep(N, j, M, P, F, "next", l);
327
+ var T = this, E = arguments;
328
+ return new Promise(function(D, O) {
329
+ var k = r.apply(T, E);
330
+ function A(r) {
331
+ asyncGeneratorStep(k, D, O, A, j, "next", r);
241
332
  }
242
- function F(l) {
243
- asyncGeneratorStep(N, j, M, P, F, "throw", l);
333
+ function j(r) {
334
+ asyncGeneratorStep(k, D, O, A, j, "throw", r);
244
335
  }
245
- P(void 0);
336
+ A(void 0);
246
337
  });
247
338
  };
248
339
  }
249
340
  var File = class {
250
- constructor(l, k) {
251
- this.key = l, this.url = k;
341
+ constructor(r, T) {
342
+ this.key = r, this.url = T;
252
343
  }
253
344
  }, ImageFile = class extends File {
254
345
  load() {
255
- return new Promise((l, k) => {
256
- let A = new Image();
257
- A.onload = () => l(A), A.onerror = () => k(/* @__PURE__ */ Error(`Failed to load ${this.url}`)), A.src = this.url;
346
+ return new Promise((r, T) => {
347
+ let E = new Image();
348
+ E.onload = () => r(E), E.onerror = () => T(/* @__PURE__ */ Error(`Failed to load ${this.url}`)), E.src = this.url;
258
349
  });
259
350
  }
260
351
  }, Loader = class {
261
- constructor(l) {
262
- this.queue = [], this.textures = l;
352
+ constructor(r) {
353
+ this.queue = [], this.textures = r;
263
354
  }
264
- image(l, k) {
265
- return this.queue.push(new ImageFile(l, k)), this;
355
+ image(r, T) {
356
+ return this.queue.push(new ImageFile(r, T)), this;
266
357
  }
267
358
  load() {
268
- var l = this;
359
+ var r = this;
269
360
  return _asyncToGenerator(function* () {
270
- let k = l.queue.map((k) => k.load().then((A) => {
271
- k instanceof ImageFile && l.textures.add(k.key, A);
361
+ let T = r.queue.map((T) => T.load().then((E) => {
362
+ T instanceof ImageFile && r.textures.add(T.key, E);
272
363
  }));
273
- l.queue.length = 0, yield Promise.all(k);
364
+ r.queue.length = 0, yield Promise.all(T);
274
365
  })();
275
366
  }
276
367
  }, _ResourceManager, Cache = class {
277
368
  constructor() {
278
369
  this.map = /* @__PURE__ */ new Map();
279
370
  }
280
- add(l, k) {
281
- this.map.has(l) || this.map.set(l, k);
371
+ add(r, T) {
372
+ this.map.has(r) || this.map.set(r, T);
282
373
  }
283
- get(l) {
284
- let k = this.map.get(l);
285
- if (!k) throw Error(`Asset ${l} not found`);
286
- return k;
374
+ get(r) {
375
+ let T = this.map.get(r);
376
+ if (!T) throw Error(`Asset ${r} not found`);
377
+ return T;
287
378
  }
288
- has(l) {
289
- return this.map.has(l);
379
+ has(r) {
380
+ return this.map.has(r);
290
381
  }
291
- remove(l) {
292
- this.map.delete(l);
382
+ remove(r) {
383
+ this.map.delete(r);
293
384
  }
294
385
  clear() {
295
386
  this.map.clear();
@@ -297,170 +388,154 @@ var File = class {
297
388
  }, ResourceManager = class {};
298
389
  _ResourceManager = ResourceManager, _ResourceManager.textures = new Cache(), _ResourceManager.loader = new Loader(_ResourceManager.textures);
299
390
  var AddFactory = class {
300
- constructor(l) {
301
- this.rm = ResourceManager, this.displayList = l;
391
+ constructor(r) {
392
+ this.rm = ResourceManager, this.displayList = r;
302
393
  }
303
- image(l, k, A, j = 1) {
304
- let M = new ImageObject(l, k, this.rm.textures.get(A), j);
305
- return this.displayList.add(M), M;
394
+ image(r, T, E, D = 1) {
395
+ let O = new ImageObject(r, T, this.rm.textures.get(E), D);
396
+ return this.displayList.add(O), O;
306
397
  }
307
398
  }, SortSystem = class {
308
- constructor(l, k) {
309
- this.world = l, this.strategy = k;
399
+ constructor(r, T) {
400
+ this.world = r, this.strategy = T;
310
401
  }
311
402
  update() {
312
- this.world.objects.sort((l, k) => this.strategy.getKey(l) - this.strategy.getKey(k)), this.world.objects.sort((l, k) => l.zIndex - k.zIndex);
403
+ this.world.objects.sort((r, T) => this.strategy.getKey(r) - this.strategy.getKey(T)), this.world.objects.sort((r, T) => r.zIndex - T.zIndex);
313
404
  }
314
405
  }, TweenData = class {
315
- constructor(l) {
316
- this.elapsed = 0, this.target = l.target, this.key = l.key, this.start = l.target[l.key], this.end = l.to, this.duration = l.duration, this.delay = l.delay || 0;
317
- let k = l.easing || "Linear";
318
- typeof k == "string" ? this.easing = Easings[k] : this.easing = k;
406
+ constructor(r) {
407
+ this.elapsed = 0, this.target = r.target, this.key = r.key, this.start = r.target[r.key], this.end = r.to, this.duration = r.duration, this.delay = r.delay || 0;
408
+ let T = r.easing || "Linear";
409
+ typeof T == "string" ? this.easing = Easings[T] : this.easing = T;
319
410
  }
320
- update(l) {
321
- if (this.delay > 0) return this.delay -= l, !1;
322
- this.elapsed += l;
323
- let k = Math.min(this.elapsed / this.duration, 1), A = this.easing(k);
324
- return this.target[this.key] = this.start + (this.end - this.start) * A, k === 1 ? (this.target[this.key] = this.end, !0) : !1;
411
+ update(r) {
412
+ if (this.delay > 0) return this.delay -= r, !1;
413
+ this.elapsed += r;
414
+ let T = Math.min(this.elapsed / this.duration, 1), E = this.easing(T);
415
+ return this.target[this.key] = this.start + (this.end - this.start) * E, T === 1 ? (this.target[this.key] = this.end, !0) : !1;
325
416
  }
326
417
  reset() {
327
418
  this.elapsed = 0;
328
419
  }
329
420
  };
330
421
  const Easings = {
331
- Linear: (l) => l,
332
- EaseOutBack: (l) => {
333
- let k = 3.70158, A = l - 1;
334
- return 1 + A * A * ((k + 1) * A + k);
422
+ Linear: (r) => r,
423
+ EaseOutBack: (r) => {
424
+ let T = 3.70158, E = r - 1;
425
+ return 1 + E * E * ((T + 1) * E + T);
335
426
  }
336
427
  };
337
428
  var Tween = class {
338
- constructor(l) {
339
- for (let k in this.datas = [], this.finished = !1, this.loop = !1, l.to) this.datas.push(new TweenData({
340
- target: l.target,
341
- key: k,
342
- to: l.to[k],
343
- duration: l.duration,
344
- easing: l.easing,
345
- delay: l.delay
429
+ constructor(r) {
430
+ for (let T in this.datas = [], this.finished = !1, this.loop = !1, r.to) this.datas.push(new TweenData({
431
+ target: r.target,
432
+ key: T,
433
+ to: r.to[T],
434
+ duration: r.duration,
435
+ easing: r.easing,
436
+ delay: r.delay
346
437
  }));
347
- this.loop = l.loop || !1, this.onComplete = l.onComplete;
438
+ this.loop = r.loop || !1, this.onComplete = r.onComplete;
348
439
  }
349
- update(l) {
440
+ update(r) {
350
441
  if (this.finished) return;
351
- let k = !0;
352
- for (let A of this.datas) A.update(l) || (k = !1);
353
- if (k) if (this.loop) this.datas.forEach((l) => l.reset());
442
+ let T = !0;
443
+ for (let E of this.datas) E.update(r) || (T = !1);
444
+ if (T) if (this.loop) this.datas.forEach((r) => r.reset());
354
445
  else {
355
- var A;
356
- this.finished = !0, (A = this.onComplete) == null || A.call(this);
446
+ var E;
447
+ this.finished = !0, (E = this.onComplete) == null || E.call(this);
357
448
  }
358
449
  }
359
450
  }, TweenManager = class {
360
451
  constructor() {
361
452
  this.tweens = [];
362
453
  }
363
- add(l) {
364
- let k = new Tween(l);
365
- return this.tweens.push(k), k;
454
+ add(r) {
455
+ let T = new Tween(r);
456
+ return this.tweens.push(T), T;
366
457
  }
367
- update(l) {
368
- for (let k of this.tweens) k.update(l);
369
- this.tweens = this.tweens.filter((l) => !l.finished);
458
+ update(r) {
459
+ for (let T of this.tweens) T.update(r);
460
+ this.tweens = this.tweens.filter((r) => !r.finished);
370
461
  }
371
462
  }, World = class {
372
463
  constructor() {
373
464
  this.objects = [];
374
465
  }
375
- add(l) {
376
- this.objects.push(l);
466
+ add(r) {
467
+ this.objects.push(r);
377
468
  }
378
- update(l) {
379
- for (let k of this.objects) k.update(l);
469
+ update(r) {
470
+ for (let T of this.objects) T.update(r);
380
471
  }
381
472
  }, Scene = class {
382
- constructor(l, k) {
383
- this.world = new World(), this.system = [], this.displayList = new DisplayList(), this.add = new AddFactory(this.displayList), this.camera = new Camera(l), this.tween = new TweenManager(), this.system.push(new SortSystem(this.world, k)), this.system.push(this.tween);
473
+ constructor(r, T) {
474
+ this.world = new World(), this.system = [], this.displayList = new DisplayList(), this.add = new AddFactory(this.displayList), this.camera = new Camera(r), this.tween = new TweenManager(), this.system.push(new SortSystem(this.world, T)), this.system.push(this.tween);
384
475
  }
385
- _boot(l) {
386
- this.input = l.input, this.events = l.events, this.config = l.config;
476
+ _boot(r) {
477
+ this.input = r.input, this.events = r.events, this.config = r.config;
387
478
  }
388
- registerSystem(l) {
389
- this.system.push(l);
479
+ registerSystem(r) {
480
+ this.system.push(r);
390
481
  }
391
482
  create() {}
392
- resize(l, k) {
393
- this.camera.setViewport(0, 0, l, k);
483
+ resize(r, T) {
484
+ this.camera.setViewport(0, 0, r, T);
394
485
  }
395
- update(l) {
396
- for (let A of this.system) {
397
- var k;
398
- (k = A.update) == null || k.call(A, l);
486
+ update(r) {
487
+ for (let E of this.system) {
488
+ var T;
489
+ (T = E.update) == null || T.call(E, r);
399
490
  }
400
- this.camera.update(), this.world.update(l);
401
- }
402
- }, GameObject = class {
403
- constructor(l, k, A = 0) {
404
- this.width = 0, this.height = 0, this.zIndex = 0, this.originX = 0, this.originY = 0, this.rotation = 0, this.x = l, this.y = k, this.z = A;
405
- }
406
- setOrigin(l, k) {
407
- this.originX = l, this.originY = k;
408
- }
409
- draw(l) {
410
- l.save(), l.rotate(this.rotation), this.render(l), l.restore();
411
- }
412
- render(l) {
413
- if (!this.texture) return;
414
- let k = this.width || this.texture.width, A = this.height || this.texture.height;
415
- l.drawImage(this.texture, -k * this.originX, -A * this.originY, k, A);
491
+ this.camera.update(), this.world.update(r);
416
492
  }
417
- update(l) {}
418
493
  }, Projection2D = class {
419
- constructor(l = 1, k = 1) {
420
- this.scaleX = l, this.scaleY = k;
494
+ constructor(r = 1, T = 1) {
495
+ this.scaleX = r, this.scaleY = T;
421
496
  }
422
- project(l, k) {
497
+ project(r, T) {
423
498
  return {
424
- px: l * this.scaleX,
425
- py: k * this.scaleY
499
+ px: r * this.scaleX,
500
+ py: T * this.scaleY
426
501
  };
427
502
  }
428
503
  }, IsoProjection = class {
429
- constructor(l, k, A) {
430
- this.tileWidth = l, this.tileHeight = k, this.zHeight = A;
504
+ constructor(r, T, E) {
505
+ this.tileWidth = r, this.tileHeight = T, this.zHeight = E;
431
506
  }
432
- project(l, k, A = 0) {
507
+ project(r, T, E = 0) {
433
508
  return {
434
- px: (l - k) * this.tileWidth / 2,
435
- py: (l + k) * this.tileHeight / 2 - A * this.zHeight
509
+ px: (r - T) * this.tileWidth / 2,
510
+ py: (r + T) * this.tileHeight / 2 - E * this.zHeight
436
511
  };
437
512
  }
438
513
  }, IsoStragety = class {
439
- getKey(l) {
440
- return l.x + l.y + l.z;
514
+ getKey(r) {
515
+ return r.x + r.y + r.z;
441
516
  }
442
517
  }, ZIndexStragety = class {
443
- getKey(l) {
444
- return l.zIndex;
518
+ getKey(r) {
519
+ return r.zIndex;
445
520
  }
446
521
  }, Game = class {
447
- constructor(A, j) {
522
+ constructor(r, T) {
448
523
  this.lastTime = 0, this.scene = null, this.config = _objectSpread2({
449
524
  width: window.innerWidth,
450
525
  height: window.innerHeight
451
- }, j);
452
- let M = window.innerWidth / this.config.width, N = window.devicePixelRatio;
453
- A.width = this.config.width * M * N, A.height = this.config.height * M * N, A.style.width = `${this.config.width * M}px`, A.style.height = `${this.config.height * M}px`;
454
- let P = A.getContext("2d");
455
- if (!P) throw Error("Canvas 2D context not found");
456
- this.events = new EventSystem(), this.input = new InputSystem(A, this.events), this.renderer = new Renderer(P), P.scale(M * N, M * N);
526
+ }, T);
527
+ let O = window.innerWidth / this.config.width, k = window.devicePixelRatio;
528
+ r.width = this.config.width * O * k, r.height = this.config.height * O * k, r.style.width = `${this.config.width * O}px`, r.style.height = `${this.config.height * O}px`;
529
+ let A = r.getContext("2d");
530
+ if (!A) throw Error("Canvas 2D context not found");
531
+ this.events = new EventSystem(), this.input = new InputSystem(r, this.events), this.renderer = new Renderer(A), A.scale(O * k, O * k);
457
532
  }
458
- start(l) {
459
- this.scene = l, l._boot(this), l.registerSystem(this.input), l.registerSystem(this.events), l.create(), l.resize(this.config.width, this.config.height), window.requestAnimationFrame(this.loop.bind(this));
533
+ start(r) {
534
+ this.scene = r, r._boot(this), r.registerSystem(this.input), r.registerSystem(this.events), r.create(), r.resize(this.config.width, this.config.height), window.requestAnimationFrame(this.loop.bind(this));
460
535
  }
461
- loop(l) {
462
- let k = l - this.lastTime;
463
- this.lastTime = l, this.scene && (this.scene.update(k), this.renderer.render(this.scene)), window.requestAnimationFrame(this.loop.bind(this));
536
+ loop(r) {
537
+ let T = r - this.lastTime;
538
+ this.lastTime = r, this.scene && (this.scene.update(T), this.renderer.render(this.scene)), window.requestAnimationFrame(this.loop.bind(this));
464
539
  }
465
540
  };
466
- export { Cache, Camera, CameraController, Easings, Game, GameObject, InputEventType, InputSystem, IsoProjection, IsoStragety, Projection2D, ResourceManager, Scene, TweenManager, ZIndexStragety };
541
+ export { Cache, Camera, CameraController, DisplayList, Easings, Game, GameObject, ImageObject, InputEventType, InputSystem, IsoProjection, IsoStragety, Projection2D, ResourceManager, Scene, Text, TweenManager, ZIndexStragety };
package/dist/main.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './ResourceManager';
9
9
  export * from './SortStragety';
10
10
  export * from './system/TweenManager';
11
11
  export * from './Camera';
12
+ export * from './Display';
12
13
  export type GameConfig = {
13
14
  width?: number;
14
15
  height?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sepveneto/dao",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",