MapView
Extends:
This is the view of the map, it extends the map which is the raw model and allows to draw it
Constructor Summary
| Public Constructor | ||
| public |
|
|
Member Summary
| Public Members | ||
| public |
DPI of the background cache images, required in some places |
|
| public |
cachedBackgroundCanvas: HTMLCanvasElement The cached background sprite, containing the flat background |
|
| public |
cachedBackgroundContext: CanvasRenderingContext2D |
|
Method Summary
| Public Methods | ||
| public |
cleanup() |
|
| public |
drawBackground(parameters: DrawParameters) Draws the map background |
|
| public |
drawForeground(parameters: DrawParameters) Draws the maps foreground |
|
| public |
drawForegroundLayer(parameters: DrawParameters, layer: Layer) Draws the layer foreground |
|
| public |
drawOverlay(parameters: DrawParameters) Draws the map overlay |
|
| public |
drawStaticEntityDebugOverlays(drawParameters: DrawParameters) Draws all static entities like buildings etc. |
|
| public |
drawVisibleChunks(parameters: DrawParameters, method: function, layer: string=) Calls a given method on all given chunks |
|
| public |
drawWiresForegroundLayer(parameters: DrawParameters) Draws the wires foreground |
|
| public |
Initializes all canvases used for background rendering |
|
| public |
onEntityChanged(entity: Entity) Called when an entity was added, removed or changed |
|
Inherited Summary
| From class BasicSerializableObject | ||
| public static |
|
|
| public static |
getId() |
|
| public static |
Should return the serialization schema |
|
| public static |
|
|
| public |
deserialize(data: any, root: import("./savegame_serializer").GameRoot): string | void |
|
| public |
|
|
| From class BaseMap | ||
| public static |
|
|
| public static |
getSchema(): {"seed": *} |
|
| public |
Mapping of 'X|Y' to chunk |
|
| public |
root: * |
|
| public |
|
|
| public |
Returns the given chunk by index |
|
| public |
getChunkAtTileOrNull(tileX: number, tileY: number): MapChunkView Gets a chunk if not existent for the given tile |
|
| public |
getLayerContentXY(x: number, y: number, layer: Layer): Entity Returns the tile content of a given tile |
|
| public |
getLayersContentsMultipleXY(x: number, y: number): Array<Entity> Returns the tile contents of a given tile |
|
| public |
getLowerLayerContentXY(x: number, y: number): BaseItem= Returns the lower layers content of the given tile |
|
| public |
getOrCreateChunkAtTile(tileX: number, tileY: number): MapChunkView Gets or creates a new chunk if not existent for the given tile |
|
| public |
getTileContent(tile: Vector, layer: Layer): Entity Returns the tile content of a given tile |
|
| public |
internalCheckTile(tile: Vector) Checks a given tile for validty |
|
| public |
isTileUsed(tile: Vector, layer: Layer): boolean Checks if the tile is used |
|
| public |
isTileUsedXY(x: number, y: number, layer: Layer): boolean Checks if the tile is used |
|
| public |
isValidTile(tile: Vector): boolean Checks if a given tile is within the map bounds |
|
| public |
placeStaticEntity(entity: Entity) Places an entity with the StaticMapEntity component |
|
| public |
removeStaticEntity(entity: Entity) Removes an entity with the StaticMapEntity component |
|
| public |
setTileContent(tile: Vector, entity: Entity) Sets the tiles content |
|
Public Constructors
public constructor() source
Fixes typeof DerivedComponent is not assignable to typeof Component, compiled out in non-dev builds
Override:
BaseMap#constructorPublic Members
public backgroundCacheDPI: number source
DPI of the background cache images, required in some places
public cachedBackgroundCanvas: HTMLCanvasElement source
The cached background sprite, containing the flat background
public cachedBackgroundContext: CanvasRenderingContext2D source
Public Methods
public cleanup() source
public drawBackground(parameters: DrawParameters) source
Draws the map background
Params:
| Name | Type | Attribute | Description |
| parameters | DrawParameters |
public drawForeground(parameters: DrawParameters) source
Draws the maps foreground
Params:
| Name | Type | Attribute | Description |
| parameters | DrawParameters |
public drawForegroundLayer(parameters: DrawParameters, layer: Layer) source
Draws the layer foreground
Params:
| Name | Type | Attribute | Description |
| parameters | DrawParameters | ||
| layer | Layer |
public drawOverlay(parameters: DrawParameters) source
Draws the map overlay
Params:
| Name | Type | Attribute | Description |
| parameters | DrawParameters |
public drawStaticEntityDebugOverlays(drawParameters: DrawParameters) source
Draws all static entities like buildings etc.
Params:
| Name | Type | Attribute | Description |
| drawParameters | DrawParameters |
public drawVisibleChunks(parameters: DrawParameters, method: function, layer: string=) source
Calls a given method on all given chunks
Params:
| Name | Type | Attribute | Description |
| parameters | DrawParameters | ||
| method | function | ||
| layer | string= |
public drawWiresForegroundLayer(parameters: DrawParameters) source
Draws the wires foreground
Params:
| Name | Type | Attribute | Description |
| parameters | DrawParameters |
public internalInitializeCachedBackgroundCanvases() source
Initializes all canvases used for background rendering
