@safe-engine/pixi 7.0.3 → 8.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.
package/dist/app.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { Constructor, System } from 'entityx-ts';
2
2
  import { Application } from 'pixi.js';
3
- export declare const app: Application<import("pixi.js").ICanvas>;
3
+ export declare const app: Application<import("pixi.js").Renderer>;
4
+ export declare function addGameCanvasTo(id?: string): Promise<void>;
4
5
  export declare function setupResolution(designedResolution?: {
5
6
  width: number;
6
7
  height: number;
7
8
  }): void;
8
- export declare function addGameCanvasTo(id?: string): Promise<void>;
9
9
  export declare function startGameWithSystems(systemsList: Constructor<System>[]): void;
10
10
  //# sourceMappingURL=app.d.ts.map
package/dist/app.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAKrC,eAAO,MAAM,GAAG,wCAKd,CAAA;AAEF,wBAAgB,eAAe,CAAC,kBAAkB;;;CAA+B,QAGhF;AAED,wBAAsB,eAAe,CAAC,EAAE,SAAS,iBAUhD;AAYD,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,QAWtE"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAKrC,eAAO,MAAM,GAAG,yCAAoB,CAAA;AAEpC,wBAAsB,eAAe,CAAC,EAAE,SAAS,iBAehD;AAED,wBAAgB,eAAe,CAAC,kBAAkB;;;CAA+B,QAKhF;AAYD,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,QAWtE"}
package/dist/app.js CHANGED
@@ -10,35 +10,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.app = void 0;
13
- exports.setupResolution = setupResolution;
14
13
  exports.addGameCanvasTo = addGameCanvasTo;
14
+ exports.setupResolution = setupResolution;
15
15
  exports.startGameWithSystems = startGameWithSystems;
16
16
  const core_1 = require("@safe-engine/core");
17
17
  const pixi_js_1 = require("pixi.js");
18
18
  const pixi_action_ease_1 = require("pixi-action-ease");
19
19
  const NodeComp_1 = require("./components/NodeComp");
20
- exports.app = new pixi_js_1.Application({
21
- width: 1080,
22
- height: 1920,
23
- antialias: true,
24
- resolution: window.devicePixelRatio,
25
- });
26
- function setupResolution(designedResolution = { width: 720, height: 1280 }) {
27
- const { width, height } = designedResolution;
28
- exports.app.renderer.resize(width, height);
29
- }
20
+ exports.app = new pixi_js_1.Application();
30
21
  function addGameCanvasTo() {
31
22
  return __awaiter(this, arguments, void 0, function* (id = 'game') {
32
- Object.assign(exports.app.view.style, {
33
- width: `${window.innerWidth}px`,
34
- // height: `${window.innerHeight}px`,
35
- overflow: 'hidden',
23
+ yield exports.app.init({
24
+ antialias: true,
25
+ resolution: window.devicePixelRatio,
26
+ resizeTo: window,
27
+ eventFeatures: {
28
+ move: true,
29
+ /** disables the global move events which can be very expensive in large scenes */
30
+ globalMove: false,
31
+ click: true,
32
+ wheel: false,
33
+ },
34
+ canvas: document.getElementById(id)
36
35
  });
37
- const gameDiv = document.getElementById(id);
38
- gameDiv.appendChild(exports.app.view);
39
36
  core_1.GameWorld.Instance.setup(NodeComp_1.NodeComp, exports.app.stage);
40
37
  });
41
38
  }
39
+ function setupResolution(designedResolution = { width: 720, height: 1280 }) {
40
+ const { width, height } = designedResolution;
41
+ exports.app.renderer.resize(width, height);
42
+ // app.stage.position.y = app.renderer.height / app.renderer.resolution
43
+ // app.stage.scale.y = -1
44
+ }
42
45
  function startGameLoop(world) {
43
46
  // Listen for frame updates
44
47
  exports.app.ticker.add(() => {
@@ -32,7 +32,7 @@ export declare class LabelComp extends ComponentX<NodeComp<Text>> {
32
32
  size: number;
33
33
  getString(): string;
34
34
  setString(val: string): void;
35
- getSize(): string | number;
35
+ getSize(): number;
36
36
  setSize(val: any): void;
37
37
  getFont(): string;
38
38
  setFont(val: string): void;
@@ -228,7 +228,7 @@ class NodeComp {
228
228
  // return box
229
229
  // }
230
230
  getContentSize() {
231
- return this.instance.getBounds();
231
+ return this.instance.boundsArea;
232
232
  }
233
233
  // setContentSize(size: cc.Size | number, height?: number) {
234
234
  // this.instance.setContentSize(size, height)
@@ -14,7 +14,7 @@ export declare class SpriteRender extends ComponentX<NodeComp<Sprite>> {
14
14
  fillCenter: Point;
15
15
  loadingBar: LoadingBar;
16
16
  setFillRange(val: number): void;
17
- getSpriteFrame(): TextureSource;
17
+ getSpriteFrame(): TextureSource<any>;
18
18
  setSpriteFrame(frame: any): void;
19
19
  }
20
20
  export declare class GraphicsRender extends ComponentX<NodeComp<Graphics>> {
@@ -13,17 +13,17 @@ class LoadingBar extends pixi_js_1.Graphics {
13
13
  this.fillCenter = new pixi_js_1.Point(0.5, 0.5);
14
14
  this.spriteComp = spriteComp;
15
15
  this.mode = mode || LoadingBarMode.BAR;
16
- this.beginFill(0xffffff);
17
- this.drawRect(0, 0, spriteComp.width, spriteComp.height);
16
+ this.fill(0xffffff);
17
+ this.rect(0, 0, spriteComp.width, spriteComp.height);
18
18
  spriteComp.mask = this;
19
19
  spriteComp.addChild(this);
20
20
  }
21
21
  set progress(val) {
22
22
  this.clear();
23
- this.beginFill(0xffffff);
23
+ this.fill(0xffffff);
24
24
  if (this.mode === LoadingBarMode.BAR) {
25
25
  const spriteComp = this.spriteComp;
26
- this.drawRect(0, 0, spriteComp.width * val, spriteComp.height);
26
+ this.rect(0, 0, spriteComp.width * val, spriteComp.height);
27
27
  // console.log('new length', spriteComp.width)
28
28
  this.x = -spriteComp.width * 0.5;
29
29
  this.y = -spriteComp.height * 0.5;
@@ -39,8 +39,8 @@ class ProgressTimer extends pixi_js_1.Container {
39
39
  this.spriteComp = pixi_js_1.Sprite.from(texture);
40
40
  this.graphics = new pixi_js_1.Graphics();
41
41
  this.mode = mode || LoadingBarMode.BAR;
42
- this.graphics.beginFill(0xffffff);
43
- this.graphics.drawRect(0, 0, this.spriteComp.width, this.spriteComp.height);
42
+ this.graphics.fill(0xffffff);
43
+ this.graphics.rect(0, 0, this.spriteComp.width, this.spriteComp.height);
44
44
  this.spriteComp.mask = this.graphics;
45
45
  this.addChild(this.graphics);
46
46
  this.addChild(this.spriteComp);
@@ -50,9 +50,9 @@ class ProgressTimer extends pixi_js_1.Container {
50
50
  set progress(val) {
51
51
  this.graphics.clear();
52
52
  if (this.mode === LoadingBarMode.BAR) {
53
- this.graphics.beginFill(0xffffff);
54
- this.graphics.drawRect(0, 0, this.spriteComp.width * val, this.spriteComp.height);
53
+ this.graphics.rect(0, 0, this.spriteComp.width * val, this.spriteComp.height);
55
54
  // console.log('new length', this.width)
55
+ this.graphics.fill(0xffffff);
56
56
  }
57
57
  }
58
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/systems/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,MAAM,EACP,MAAM,YAAY,CAAA;AAOnB,oBAAY,WAAW;IACrB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,qBAAa,YAAa,YAAW,MAAM;IACzC,SAAS,CAAC,aAAa,EAAE,YAAY;CAgDtC"}
1
+ {"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/systems/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAEZ,MAAM,EACP,MAAM,YAAY,CAAA;AAOnB,oBAAY,WAAW;IACrB,MAAM,IAAA;IACN,MAAM,IAAA;IACN,KAAK,IAAA;IACL,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,qBAAa,YAAa,YAAW,MAAM;IACzC,SAAS,CAAC,aAAa,EAAE,YAAY;CAiDtC"}
@@ -51,8 +51,9 @@ class RenderSystem {
51
51
  event_manager.subscribe(entityx_ts_1.EventTypes.ComponentAdded, RenderComponent_1.GraphicsRender, ({ entity, component }) => {
52
52
  const { lineWidth, strokeColor, fillColor } = component;
53
53
  const node = new pixi_js_1.Graphics();
54
- node.beginFill(fillColor);
55
- node.lineStyle(lineWidth, strokeColor);
54
+ node.fill(fillColor);
55
+ node.fillStyle = strokeColor;
56
+ node.width = lineWidth;
56
57
  component.node = entity.assign(new __1.NodeComp(node, entity));
57
58
  // node.drawCircle(0, 0, 100)
58
59
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@safe-engine/pixi",
3
- "version": "7.0.3",
3
+ "version": "8.0.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -16,12 +16,13 @@
16
16
  "author": "",
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
- "@pixi/ui": "^1.1.5",
20
- "@safe-engine/core": "1.0.2",
21
- "entityx-ts": "2.0.3",
19
+ "@pixi/ui": "^2.1.5",
20
+ "@safe-engine/core": "workspace:*",
21
+ "@safe-engine/pixi-dragonbones": "workspace:*",
22
+ "entityx-ts": "workspace:*",
22
23
  "lodash": "^4.17.21",
23
24
  "pixi-action-ease": "^1.0.12",
24
- "pixi.js": "^7.4.2"
25
+ "pixi.js": "^8.4.0"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/lodash": "^4.17.7",
package/src/app.ts CHANGED
@@ -5,30 +5,32 @@ import { actionManager } from 'pixi-action-ease'
5
5
 
6
6
  import { NodeComp } from './components/NodeComp'
7
7
 
8
- export const app = new Application({
9
- width: 1080,
10
- height: 1920,
11
- antialias: true,
12
- resolution: window.devicePixelRatio,
13
- })
14
-
15
- export function setupResolution(designedResolution = { width: 720, height: 1280 }) {
16
- const { width, height } = designedResolution
17
- app.renderer.resize(width, height)
18
- }
8
+ export const app = new Application()
19
9
 
20
10
  export async function addGameCanvasTo(id = 'game') {
21
- Object.assign(app.view.style, {
22
- width: `${window.innerWidth}px`,
23
- // height: `${window.innerHeight}px`,
24
- overflow: 'hidden',
11
+ await app.init({
12
+ antialias: true,
13
+ resolution: window.devicePixelRatio,
14
+ resizeTo: window,
15
+ eventFeatures: {
16
+ move: true,
17
+ /** disables the global move events which can be very expensive in large scenes */
18
+ globalMove: false,
19
+ click: true,
20
+ wheel: false,
21
+ },
22
+ canvas: document.getElementById(id) as HTMLCanvasElement
25
23
  })
26
-
27
- const gameDiv = document.getElementById(id)
28
- gameDiv.appendChild(app.view as never)
29
24
  GameWorld.Instance.setup(NodeComp, app.stage)
30
25
  }
31
26
 
27
+ export function setupResolution(designedResolution = { width: 720, height: 1280 }) {
28
+ const { width, height } = designedResolution
29
+ app.renderer.resize(width, height)
30
+ // app.stage.position.y = app.renderer.height / app.renderer.resolution
31
+ // app.stage.scale.y = -1
32
+ }
33
+
32
34
  function startGameLoop(world: GameWorld) {
33
35
  // Listen for frame updates
34
36
  app.ticker.add(() => {