LogoPixi’VN
indexClasses

Class: CanvasBaseItem<T2>

Defined in: src/canvas/classes/CanvasBaseItem.ts:31

This class is used to create a canvas element to add into a Pixi Application. You can use () to add this element into the application. This class should be implemented and the memory method should be overridden. You must use the canvasComponentDecorator to register the canvas in the game. In Ren'Py is a displayable.

Example

const CANVAS_EXAMPLE_ID = "CanvasExample";

\@canvasComponentDecorator({
    name: CANVAS_EXAMPLE_ID,
})
export class CanvasExample extends Container implements CanvasBaseItem<Memory> {
    get memory(): Memory {
        return {
            pixivnId: CANVAS_EXAMPLE_ID,
            // ... other properties
        }
    }
    async setMemory(value: Memory) {
        // ... set other properties
    }
}

Extended by

Type Parameters

T2

T2 extends CanvasBaseItemMemory

Constructors

Constructor

> new CanvasBaseItem<T2>(..._options): CanvasBaseItem<T2>

Defined in: src/canvas/classes/CanvasBaseItem.ts:32

Parameters

_options

...any

Returns

CanvasBaseItem<T2>

Properties

pixivnId

> pixivnId: string = "canvas_element_id_not_set"

Defined in: src/canvas/classes/CanvasBaseItem.ts:56

Get the id of the canvas element. This variable is used in the system to get the canvas element by id

Accessors

memory

Get Signature

> get memory(): T2

Defined in: src/canvas/classes/CanvasBaseItem.ts:37

This method return the memory of the canvas element.

Throws

when the method is not overridden in the subclass.

Returns

T2

Methods

setMemory()

> setMemory(_value): void | Promise<void>

Defined in: src/canvas/classes/CanvasBaseItem.ts:47

This method set the memory of the canvas element.

Parameters

_value

T2

Returns

void | Promise<void>

Throws

when the method is not overridden in the subclass.