新增prototypespriteRenderer

This commit is contained in:
yhh
2020-09-30 18:31:58 +08:00
parent dd994cb16d
commit c9c745c730
4 changed files with 86 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
module es {
export class PrototypeSpriteRenderer extends SpriteRenderer {
public get width(): number {
return this._width;
}
public get height(): number {
return this._height;
}
public get bounds(): Rectangle {
if (this._areBoundsDirty){
this._bounds.calculateBounds(this.entity.transform.position, this._localOffset, this._origin, this.entity.transform.scale,
this.entity.transform.rotation, this._width, this._height);
this._areBoundsDirty = false;
}
return this._bounds;
}
public skewTopX: number = 0;
public skewBottomX: number = 0;
public skewLeftY: number = 0;
public skewRightY: number = 0;
public _width: number = 0;
public _height: number = 0;
constructor(width: number = 50, height: number = 50){
super(Graphics.Instance.pixelTexture);
this._width = width;
this._height = height;
}
public setWidth(width: number): PrototypeSpriteRenderer {
this._width = width;
return this;
}
public setHeight(height: number): PrototypeSpriteRenderer {
this._height = height;
return this;
}
public setSkew(skewTopX: number, skewBottomX: number, skewLeftY: number, skewRightY: number): PrototypeSpriteRenderer{
this.skewTopX = skewTopX;
this.skewBottomX = skewBottomX;
this.skewLeftY = skewLeftY;
this.skewRightY = skewRightY;
return this;
}
public onAddedToEntity() {
this.originNormalized = Vector2Ext.halfVector();
}
public render(camera: es.Camera) {
}
}
}

View File

@@ -228,6 +228,7 @@ module es {
}
protected initialize() {
Graphics.Instance = new Graphics();
}
protected async update() {