@safe-engine/cocos 2.2.2 → 2.2.4
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.
|
@@ -15,8 +15,8 @@ export declare class SpriteRender extends ComponentX<SpriteRenderProps & BaseCom
|
|
|
15
15
|
updateTiled(): void;
|
|
16
16
|
}
|
|
17
17
|
interface MaskRenderProps {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
spriteFrame: string;
|
|
19
|
+
alphaThreshold?: number;
|
|
20
20
|
inverted?: boolean;
|
|
21
21
|
}
|
|
22
22
|
export declare class MaskRender extends ComponentX<MaskRenderProps, cc.ClippingNode> {
|
|
@@ -32,10 +32,11 @@ interface GraphicsRenderProps {
|
|
|
32
32
|
fillColor?: ColorSource;
|
|
33
33
|
}
|
|
34
34
|
export declare class GraphicsRender extends ComponentX<GraphicsRenderProps & BaseComponentProps<GraphicsRender>, cc.DrawNode> {
|
|
35
|
-
drawDot(
|
|
35
|
+
drawDot(center: Vec2, r: number): void;
|
|
36
36
|
drawLine(origin: Vec2, destination: Vec2, thickness?: Float, color?: Color4B): void;
|
|
37
37
|
drawRect(origin: Vec2, destination: Vec2, color?: Color4B): void;
|
|
38
38
|
drawCircle(center: Vec2, radius: Float, angle?: number, segments?: number, drawLineToCenter?: boolean, lineWidth?: Float, color?: Color4B): void;
|
|
39
|
+
drawSolidCircle(center: Vec2, radius: Float, angle?: number, segments?: number, color?: Color4B): void;
|
|
39
40
|
drawPoly(points: Vec2[], color?: Color4B, thickness?: Float): void;
|
|
40
41
|
clear(): void;
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderComponent.d.ts","sourceRoot":"","sources":["../../src/render/RenderComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAU,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClD,OA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,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,KAAK;IAa3D,KAAK;CAKN;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,QAAS,SAAQ,UAAU,CAAC,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAE,EAAE,EAAE,CAAC,WAAW,CAAC;CAAG;AAEhG,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AACD,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,iBAAiB,GAAG;IAAE,IAAI,CAAC,EAAE,gBAAgB,CAAA;CAAE,EAAE,EAAE,CAAC,YAAY,CAAC;IAChH,KAAK;CAGN"}
|
|
@@ -21,13 +21,9 @@ export class MaskRender extends ComponentX {
|
|
|
21
21
|
export class ParticleComp extends ComponentX {
|
|
22
22
|
}
|
|
23
23
|
export class GraphicsRender extends ComponentX {
|
|
24
|
-
drawDot(
|
|
25
|
-
this.node.instance.drawDot(
|
|
24
|
+
drawDot(center, r) {
|
|
25
|
+
this.node.instance.drawDot(center, r, this.props.fillColor);
|
|
26
26
|
}
|
|
27
|
-
// drawPoint(position: Vec2, pointSize: Float, color: Color4B, pointType = PointType.Rect) {
|
|
28
|
-
// }
|
|
29
|
-
// // drawPoints(points: Vec2[], color: Color4B) {
|
|
30
|
-
// // }
|
|
31
27
|
drawLine(origin, destination, thickness, color) {
|
|
32
28
|
this.node.instance.drawSegment(origin, destination, thickness || this.props.lineWidth, color || this.props.strokeColor);
|
|
33
29
|
}
|
|
@@ -39,8 +35,10 @@ export class GraphicsRender extends ComponentX {
|
|
|
39
35
|
drawCircle(center, radius, angle = 0, segments = 64, drawLineToCenter = true, lineWidth, color) {
|
|
40
36
|
this.node.instance.drawCircle(center, radius, angle, segments, drawLineToCenter, lineWidth || this.props.lineWidth, color || this.props.fillColor);
|
|
41
37
|
}
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
drawSolidCircle(center, radius, angle = 0, segments = 64, color) {
|
|
39
|
+
this.node.instance.drawCircle(center, radius, angle, segments, true, this.props.lineWidth, color || this.props.fillColor);
|
|
40
|
+
this.node.instance.drawDot(center, radius, this.props.fillColor);
|
|
41
|
+
}
|
|
44
42
|
// drawQuadBezier(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
45
43
|
// }
|
|
46
44
|
// drawCubicBezier(origin: Vec2, destination: Vec2, color: Color4B) {
|
|
@@ -50,13 +48,11 @@ export class GraphicsRender extends ComponentX {
|
|
|
50
48
|
// drawCatmullRom(points: Vec2[], color: Color4B) {
|
|
51
49
|
// }
|
|
52
50
|
drawPoly(points, color, thickness) {
|
|
53
|
-
this.node.instance.drawPoly(points, color || this.props.fillColor, thickness || this.props.lineWidth);
|
|
51
|
+
this.node.instance.drawPoly(points, color || this.props.fillColor, thickness || this.props.lineWidth, this.props.strokeColor);
|
|
54
52
|
}
|
|
55
53
|
// drawSolidPoly(points: Vec2[], color: Color4B) {
|
|
56
54
|
// this.node.instance.drawPoly(points, color)
|
|
57
55
|
// }
|
|
58
|
-
// drawDot(points: Vec2[], color: Color4B) {
|
|
59
|
-
// }
|
|
60
56
|
// drawSegment(from: Vec2, to: Vec2, color: Color4B) {
|
|
61
57
|
// }
|
|
62
58
|
// drawTriangle(p1: Vec2, p2: Vec2, p3: Vec2, color: Color4B) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;AAOlG,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;IAWrC,OAAO,CAAC,eAAe,CAKtB;IAED,OAAO,CAAC,iBAAiB,CAgBxB;IAED,OAAO,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"RenderSystem.d.ts","sourceRoot":"","sources":["../../src/render/RenderSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAoC,MAAM,EAAE,MAAM,YAAY,CAAA;AAOlG,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;IAWrC,OAAO,CAAC,eAAe,CAKtB;IAED,OAAO,CAAC,iBAAiB,CAgBxB;IAED,OAAO,CAAC,eAAe,CAOtB;IAED,OAAO,CAAC,mBAAmB,CAQ1B;IAED,OAAO,CAAC,iBAAiB,CAKxB;IAED,OAAO,CAAC,aAAa,CAKpB;IAED,OAAO,CAAC,iBAAiB,CAUxB;IAED,OAAO,CAAC,iBAAiB,CAKxB;IAED,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM;CAIjE"}
|
|
@@ -49,10 +49,12 @@ export class RenderSystem {
|
|
|
49
49
|
spriteComp.node = ett.assign(new NodeComp(node, ett));
|
|
50
50
|
};
|
|
51
51
|
onAddMaskRender = ({ entity, component: maskComp }) => {
|
|
52
|
-
const { inverted } = maskComp.props;
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const { inverted = false, spriteFrame, alphaThreshold = 0.05 } = maskComp.props;
|
|
53
|
+
const stencil = new cc.Sprite(spriteFrame);
|
|
54
|
+
const clipper = new cc.ClippingNode(stencil);
|
|
55
|
+
clipper.setAlphaThreshold(alphaThreshold);
|
|
56
|
+
clipper.setInverted(inverted);
|
|
57
|
+
maskComp.node = entity.assign(new NodeComp(clipper, entity));
|
|
56
58
|
};
|
|
57
59
|
onAddGraphicsRender = ({ entity }) => {
|
|
58
60
|
const graphicsComp = entity.getComponent(GraphicsRender);
|