@drincs/pixi-vn
Version:
Pixi'VN is a npm package that provides various features for creating visual novels.
46 lines (43 loc) • 1.71 kB
TypeScript
import { Container } from 'pixi.js';
import CanvasBaseItemMemory from '../../interface/canvas/memory/CanvasBaseItemMemory.js';
/**
* This class is used to create a canvas element to add into a Pixi Application.
* You can use {@link canvas.add()} to add this element into the application.
* This class should be implemented and the memory method should be overridden.
* You must use the {@link canvasComponentDecorator} to register the canvas in the game.
* In Ren'Py is a displayable.
* @example
* ```typescript
* \@canvasComponentDecorator() // this is equivalent to canvasComponentDecorator("CanvasExample")
* export class CanvasExample extends Container implements CanvasBaseItem<ICanvasExampleMemory> {
* get memory(): ICanvasExampleMemory {
* return {
* pixivnId: "CanvasExample",
* // ... other properties
* }
* }
* set memory(value: ICanvasExampleMemory) {
* // ... set other properties
* }
* }
* ```
*/
declare class CanvasBaseItem<T2 extends CanvasBaseItemMemory> extends Container {
/**
* This method return the memory of the canvas element.
*/
get memory(): T2;
/**
* This method set the memory of the canvas element.
*/
set memory(_value: T2);
/**
* This method set the memory of the canvas element. Is equivalent to the {@link CanvasBaseItem.memory} method, but this method is async.
*/
setMemory(_value: T2): Promise<void> | void;
/**
* Get the id of the canvas element. This variable is used in the system to get the canvas element by id, {@link getCanvasElementInstanceById}
*/
pixivnId: string;
}
export { CanvasBaseItem as default };