@hiddentao/clockwork-engine
Version:
A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering
58 lines • 2.4 kB
TypeScript
/**
* Display Node
*
* OOP-style wrapper around NodeId providing fluent interface for rendering operations.
* All methods delegate to the underlying RenderingLayer.
*/
import type { RenderingLayer } from "./RenderingLayer";
import type { BlendMode, Color, NodeId, TextureFiltering, TextureId } from "./types";
export declare class DisplayNode {
private readonly id;
private readonly rendering;
constructor(id: NodeId, rendering: RenderingLayer);
addChild(child: DisplayNode): this;
removeChild(child: DisplayNode): this;
destroy(): void;
setPosition(x: number, y: number): this;
setRotation(radians: number): this;
setScale(scaleX: number, scaleY?: number): this;
getRotation(): number;
getScale(): {
x: number;
y: number;
};
setAnchor(anchorX: number, anchorY: number): this;
setAlpha(alpha: number): this;
setVisible(visible: boolean): this;
setZIndex(z: number): this;
setSize(width: number, height: number): this;
getSize(): {
width: number;
height: number;
};
setTint(color: Color): this;
setBlendMode(mode: BlendMode): this;
setTextureFiltering(filtering: TextureFiltering): this;
getBounds(): {
x: number;
y: number;
width: number;
height: number;
};
setSprite(textureId: TextureId): this;
setAnimatedSprite(textureIds: TextureId[], ticksPerFrame: number): this;
playAnimation(loop?: boolean): this;
stopAnimation(): this;
setAnimationCompleteCallback(callback: ((id: NodeId) => void) | null): this;
drawRectangle(x: number, y: number, width: number, height: number, fill?: Color, stroke?: Color, strokeWidth?: number): this;
drawCircle(x: number, y: number, radius: number, fill?: Color, stroke?: Color, strokeWidth?: number): this;
drawPolygon(points: number[], fill?: Color, stroke?: Color, strokeWidth?: number): this;
drawRoundRect(x: number, y: number, width: number, height: number, radius: number, fill?: Color, stroke?: Color, strokeWidth?: number): this;
drawLine(x1: number, y1: number, x2: number, y2: number, color: Color, width?: number): this;
drawPolyline(points: number[], color: Color, width?: number): this;
clearGraphics(): this;
getId(): NodeId;
getNodeId(): NodeId;
getRendering(): RenderingLayer;
}
//# sourceMappingURL=DisplayNode.d.ts.map