MCPcopy Index your code
hub / github.com/4ian/GDevelop / constructor

Method constructor

Extensions/TileMap/JsExtension.js:1640–1689  ·  view source on GitHub ↗
(
        project,
        instance,
        associatedObjectConfiguration,
        pixiContainer,
        pixiResourcesLoader
      )

Source from the content-addressed store, hash-verified

1638 */
1639 class RenderedTileMapInstance extends RenderedInstance {
1640 constructor(
1641 project,
1642 instance,
1643 associatedObjectConfiguration,
1644 pixiContainer,
1645 pixiResourcesLoader
1646 ) {
1647 super(
1648 project,
1649 instance,
1650 associatedObjectConfiguration,
1651 pixiContainer,
1652 pixiResourcesLoader
1653 );
1654
1655 // This setting allows tile maps with more than 16K tiles.
1656 Tilemap.settings.use32bitIndex = true;
1657
1658 this.tileMapPixiObject = new Tilemap.CompositeTilemap();
1659 this._pixiObject = this.tileMapPixiObject;
1660 this._editableTileMap = null;
1661
1662 // Implement `containsPoint` so that we can set `interactive` to true and
1663 // the Tilemap will properly emit events when hovered/clicked.
1664 // By default, this is not implemented in pixi-tilemap.
1665 this._pixiObject.containsPoint = (position) => {
1666 if (!this._pixiObject) {
1667 // Ease debugging by throwing now rather than waiting for an exception later.
1668 throw new Error(
1669 'containsPoint called on a destroyed PIXI object - this object was not properly removed from the PIXI container.'
1670 );
1671 return;
1672 }
1673
1674 // Turns the world position to the local object coordinates
1675 const localPosition = new PIXI.Point();
1676 this._pixiObject.worldTransform.applyInverse(position, localPosition);
1677
1678 return (
1679 localPosition.x >= 0 &&
1680 localPosition.x < this.width &&
1681 localPosition.y >= 0 &&
1682 localPosition.y < this.height
1683 );
1684 };
1685 this._pixiContainer.addChild(this._pixiObject);
1686 this.width = 48;
1687 this.height = 48;
1688 this.update();
1689 }
1690
1691 onRemovedFromScene() {
1692 super.onRemovedFromScene();

Callers

nothing calls this directly

Calls 3

updateMethod · 0.95
applyInverseMethod · 0.80
addChildMethod · 0.45

Tested by

no test coverage detected