-
Notifications
You must be signed in to change notification settings - Fork 34
/
Spine2d.ts
45 lines (35 loc) · 922 Bytes
/
Spine2d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
///<reference types="pixi-spine"/>
import {Graphics} from "@pixi/graphics";
module pixi_projection {
export interface Sprite2d {
region: PIXI.spine.core.TextureRegion;
}
export interface Mesh2d {
region: PIXI.spine.core.TextureRegion;
}
export class Spine2d extends PIXI.spine.Spine {
constructor(spineData: PIXI.spine.core.SkeletonData) {
super(spineData);
this.convertTo2d();
}
proj: Projection2d;
newContainer() {
return new Container2d();
}
newSprite(tex: Texture) {
return new Sprite2d(tex);
}
newGraphics() {
//TODO: make Graphics2d
const graphics = new Graphics();
graphics.convertTo2d();
return graphics;
}
newMesh(texture: PIXI.Texture, vertices?: Float32Array, uvs?: Float32Array, indices?: Uint16Array, drawMode?: number) {
return new SimpleMesh2d(texture, vertices, uvs, indices, drawMode) as any;
}
transformHack() {
return 2;
}
}
}