mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-21 17:45:25 -04:00
deb802cfec
* For now, this is limited to instances inside custom objects. This will be made available in the future for all instances in scenes if this works well.
37 lines
1013 B
TypeScript
37 lines
1013 B
TypeScript
namespace gdjs {
|
|
/**
|
|
* Base class for 2D custom objects.
|
|
* @category Objects > Custom Object
|
|
*/
|
|
export class CustomRuntimeObject2D extends gdjs.CustomRuntimeObject {
|
|
constructor(
|
|
parent: gdjs.RuntimeInstanceContainer,
|
|
objectData: ObjectData & CustomObjectConfiguration,
|
|
instanceData?: InstanceData
|
|
) {
|
|
super(parent, objectData, instanceData);
|
|
}
|
|
|
|
protected override _createRender(): gdjs.CustomRuntimeObject2DRenderer {
|
|
const parent = this._runtimeScene;
|
|
return new gdjs.CustomRuntimeObject2DRenderer(
|
|
this,
|
|
this._instanceContainer,
|
|
parent
|
|
);
|
|
}
|
|
|
|
protected override _reinitializeRenderer(): void {
|
|
this.getRenderer().reinitialize(this, this.getParent());
|
|
}
|
|
|
|
override getRenderer(): gdjs.CustomRuntimeObject2DRenderer {
|
|
return super.getRenderer() as gdjs.CustomRuntimeObject2DRenderer;
|
|
}
|
|
|
|
override getRendererObject() {
|
|
return this.getRenderer().getRendererObject();
|
|
}
|
|
}
|
|
}
|