Home Reference Source
import {ShapezAPI} from 'shapez.io/js/modloader/mod.js'
public class | source

ShapezAPI

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public

exports: {"AtlasDefinition": *, "BackgroundResourcesLoader": *, "ClickDetector": *, "DrawParameters": *, "ExplainedResult": *, "Factory": *, "InputDistributor": *, "InputReceiver": *, "Dialog": *, "DialogOptionChooser": *, "DialogLoading": *, "DialogWithForm": *, "FormElement": *, "FormElementInput": *, "FormElementCheckbox": *, "FormElementItemChooser": *, "ReadWriteProxy": *, "Rectangle": *, "RequestChannel": *, "RestrictionManager": *, "RandomNumberGenerator": *, "Signal": *, "SingletonFactory": *, "BaseSprite": *, "SpriteAtlasLink": *, "AtlasSprite": *, "RegularSprite": *, "StaleAreaDetector": *, "StateManager": *, "TextualGameState": *, "TrackedState": *, "Vector": *, "GameState": *, "enableImageSmoothing": *, "disableImageSmoothing": *, "getBufferVramUsageBytes": *, "getBufferStats": *, "clearBufferBacklog": *, "makeOffscreenBuffer": *, "registerCanvas": *, "freeCanvas": *, "getDeviceDPI": *, "smoothenDpi": *, "prepareHighDPIContext": *, "resizeHighDPICanvas": *, "resizeCanvas": *, "resizeCanvasAndClear": *, "initDrawUtils": *, "drawRotatedSprite": *, "drawSpriteClipped": *, "initBuildingsByCategory": *, "setGlobalApp": *, "createLogger": *, "serializeError": *, "stringifyObjectContainingErrors": *, "globalDebug": *, "globalLog": *, "globalWarn": *, "globalError": *, "logSection": *, "compressU8": *, "compressU8WHeader": *, "decompressU8WHeader": *, "compressX64": *, "decompressX64": *, "sha1": *, "getNameOfProvider": *, "computeCrc": *, "isAndroid": *, "isIos": *, "getPlatformName": *, "getIPCRenderer": *, "make2DUndefinedArray": *, "newEmptyMap": *, "randomInt": *, "accessNestedPropertyReverse": *, "randomChoice": *, "fastArrayDelete": *, "fastArrayDeleteValue": *, "fastArrayDeleteValueIfContained": *, "arrayDelete": *, "arrayDeleteValue": *, "epsilonCompare": *, "lerp": *, "findNiceValue": *, "findNiceIntegerValue": *, "formatBigNumber": *, "formatBigNumberFull": *, "waitNextFrame": *, "round1Digit": *, "round2Digits": *, "round3Digits": *, "round4Digits": *, "clamp": *, "makeDiv": *, "makeButtonElement": *, "makeButton": *, "removeAllChildren": *, "isSupportedBrowser": *, "formatSecondsToTimeAgo": *, "formatSeconds": *, "round1DigitLocalized": *, "formatItemsPerSecond": *, "rotateFlatMatrix3x3": *, "generateMatrixRotations": *, "rotateDirectionalObject": *, "safeModulo": *, "smoothPulse": *, "fillInLinkIntoTranslation": *, "generateFileDownload": *, "startFileChoose": *, "getRomanNumber": *, "mixVector": *, "queryParamOptions": *, "PROMISE_ABORTED": *, "CRC_PREFIX": *, "ORIGINAL_SPRITE_SCALE": *, "FULL_CLIP_RECT": *, "enumDirection": *, "enumInvertedDirections": *, "enumDirectionToAngle": *, "enumAngleToDirection": *, "arrayAllDirections": *, "enumDirectionToVector": *, "atlasFiles": *, "MAX_MOVE_DISTANCE_PX": *, "clickDetectorGlobals": *, "IS_DEBUG": *, "SUPPORT_TOUCH": *, "IS_MAC": *, "THIRDPARTY_URLS": *, "A_B_TESTING_LINK_TYPE": *, "globalConfig": *, "IS_MOBILE": *, "APPLICATION_ERROR_OCCURED": *, "gMetaBuildingRegistry": *, "gBuildingsByCategory": *, "gComponentRegistry": *, "gGameModeRegistry": *, "gGameSpeedRegistry": *, "gItemRegistry": *, "GLOBAL_APP": *, "Loader": *, "AdinplayAdProvider": *, "GamedistributionAdProvider": *, "NoAdProvider": *, "AdProviderInterface": *, "ShapezGameAnalytics": *, "GoogleAnalyticsImpl": *, "NoGameAnalytics": *, "SoundImplBrowser": *, "StorageImplBrowserIndexedDB": *, "StorageImplBrowser": *, "PlatformWrapperImplBrowser": *, "StorageImplElectron": *, "PlatformWrapperImplElectron": *, "AnalyticsInterface": *, "GameAnalyticsInterface": *, "SoundInstanceInterface": *, "MusicInstanceInterface": *, "SoundInterface": *, "StorageInterface": *, "PlatformWrapperInterface": *, "MUSIC": *, "ApplicationSettings": *, "allApplicationSettings": *, "getApplicationSettingById": *, "uiScales": *, "scrollWheelSensitivities": *, "movementSpeeds": *, "autosaveIntervals": *, "BaseSavegameInterface": *, "SavegameInterface_V1000": *, "SavegameInterface_V1001": *, "SavegameInterface_V1002": *, "SavegameInterface_V1003": *, "SavegameInterface_V1004": *, "SavegameInterface_V1005": *, "SavegameInterface_V1006": *, "SavegameInterface_V1007": *, "SavegameInterface_ML01": *, "SerializerInternal": *, "SavegameManager": *, "SavegameSerializer": *, "Savegame": *, "BaseDataType": *, "TypeInteger": *, "TypeBoolean": *, "TypePositiveInteger": *, "TypeString": *, "TypeVector": *, "TypeTileVector": *, "TypeNumber": *, "TypePositiveNumber": *, "TypeEnum": *, "TypeEntity": *, "TypeEntityWeakref": *, "TypeClass": *, "TypeClassData": *, "TypeClassFromMetaclass": *, "TypeMetaClass": *, "TypeArray": *, "TypeFixedClass": *, "TypeKeyValueMap": *, "TypeClassId": *, "TypePair": *, "TypeNullable": *, "TypeStructuredObject": *, "BasicSerializableObject": *, "getSavegameInterface": *, "compressObject": *, "decompressObject": *, "schemaToJsonSchema": *, "serializeSchema": *, "deserializeSchema": *, "verifySchema": *, "extendSchema": *, "savegameInterfaces": *, "AutomaticSave": *, "BeltPath": *, "Blueprint": *, "Camera": *, "GameCore": *, "DynamicTickrate": *, "EntityManager": *, "Entity": *, "GameLoadingOverlay": *, "GameSystemManager": *, "Keybinding": *, "KeyActionMapper": *, "GameLogic": *, "MapChunkView": *, "MapView": *, "BaseMap": *, "ProductionAnalytics": *, "GameRoot": *, "ShapeDefinitionManager": *, "enumShortcodeToSubShape": *, "enumSubShapeToShortcode": *, "enumSubShape": *, "ShapeDefinition": *, "SoundProxy": *, "itemResolverSingleton": *, "createSimpleShape": *, "applyGameTheme": *, "getRandomHint": *, "registerBuildingVariant": *, "getBuildingDataFromCode": *, "getCodeFromBuildingData": *, "typeItemSingleton": *, "gBuildingVariants": *, "USER_INTERACT_MOVE": *, "USER_INTERACT_ZOOM": *, "USER_INTERACT_TOUCHEND": *, "MetaBuilding": *, "Component": *, "BaseItem": *, "BaseGameSpeed": *, "GameSystemWithFilter": *, "GameSystem": *, "GameMode": *, "HUDBaseToolbar": *, "BaseHUDPart": *, "GameHUD": *, "HUDSettingsMenu": *, "HUDBetaOverlay": *, "HUDBlueprintPlacer": *, "HUDBuildingPlacer": *, "HUDBuildingPlacerLogic": *, "HUDCatMemes": *, "HUDChangesDebugger": *, "HUDColorBlindHelper": *, "HUDConstantSignalEdit": *, "HUDDebugInfo": *, "HUDEntityDebugger": *, "HUDGameMenu": *, "HUDInteractiveTutorial": *, "HUDKeybindingOverlay": *, "HUDLayerPreview": *, "HUDLeverToggle": *, "HUDMassSelector": *, "HUDMinerHighlight": *, "HUDModalDialogs": *, "HUDNotifications": *, "HUDPartTutorialHints": *, "HUDPinnedShapes": *, "HUDSandboxController": *, "HUDScreenshotExporter": *, "HUDShapeStatisticsHandle": *, "HUDShapeViewer": *, "HUDShop": *, "HUDStandaloneAdvantages": *, "HUDStatistics": *, "HUDTutorialVideoOffer": *, "HUDUnlockNotification": *, "HUDVignetteOverlay": *, "HUDWatermark": *, "HUDWaypoints": *, "HUDWireInfo": *, "HUDWiresOverlay": *, "EnumSetting": *, "BoolSetting": *, "RangeSetting": *, "BaseSetting": *, "cachebust": *, "matchOverwriteRecursiveSettings": *, "defaultBuildingVariant": *, "types": *, "STOP_PROPAGATION": *, "SOUNDS": *, "BOOL_TRUE_SINGLETON": *, "BOOL_FALSE_SINGLETON": *, "RegularGameMode": *, "PausedGameSpeed": *, "FastForwardGameSpeed": *, "RegularGameSpeed": *, "ShapeItem": *, "BooleanItem": *, "ColorItem": *, "InGameState": *, "SettingsState": *, "AboutState": *, "MainMenuState": *, "ChangelogState": *, "KeybindingsState": *, "PreloadState": *, "MobileWarningState": *, "ItemAcceptorSystem": *, "BeltSystem": *, "UndergroundBeltSystem": *, "MinerSystem": *, "StorageSystem": *, "ItemProcessorSystem": *, "FilterSystem": *, "ItemProducerSystem": *, "ItemEjectorSystem": *, "HubSystem": *, "StaticMapEntitySystem": *, "WiredPinsSystem": *, "BeltUnderlaysSystem": *, "ConstantSignalSystem": *, "LeverSystem": *, "WireSystem": *, "LogicGateSystem": *, "BeltReaderSystem": *, "DisplaySystem": *, "ItemProcessorOverlaysSystem": *, "BeltReaderComponent": *, "BeltUnderlaysComponent": *, "BeltComponent": *, "ConstantSignalComponent": *, "DisplayComponent": *, "FilterComponent": *, "HubComponent": *, "ItemAcceptorComponent": *, "ItemEjectorComponent": *, "ItemProcessorComponent": *, "ItemProducerComponent": *, "LeverComponent": *, "LogicGateComponent": *, "MinerComponent": *, "StaticMapEntityComponent": *, "StorageComponent": *, "UndergroundBeltComponent": *, "WireTunnelComponent": *, "WireComponent": *, "WiredPinsComponent": *, "enumHubGoalRewards": *, "enumAnalyticsDataSource": *, "enumCategories": *, "enumClippedBeltUnderlayType": *, "enumColorMixingResults": *, "enumColors": *, "enumColorsToHexCode": *, "enumColorToShortcode": *, "enumDisplayMode": *, "enumHubGoalRewardsToContentUnlocked": *, "enumItemProcessorRequirements": *, "enumItemProcessorTypes": *, "enumLocalSavegameStatus": *, "enumMouseButton": *, "enumNotificationType": *, "enumSavePriority": *}

public
public

ingame: {"buildings": *, "components": *, "systems": *, "items": *, "gamemodes": *, "gamespeed": *, "layers": *, "hub_goals": *}

public

map: {"MapChunk": *, "MapResourcesSystem": *}

public

modOrder: *[]

public

mods: *

public

states: *

public

themes: *

public

toolbars: {"buildings": *, "wires": *}

public
public

user: *

Method Summary

Public Methods
public

Generates rotated variants of the matrix

public

Returns a regular sprite by its id

public

Returns a regular sprite by its id

public

Adds css to the page

public

registerAtlas(atlasDataString: string)

Registers a new atlas

public

registerAtlases(atlasDataStrings: string[])

Registers a new atlases

public

registerBuilding(buildingClass: *, iconDataURL: *, key: *)

public

registerIcon(id: string, iconDataURL: string)

Registers a new icon

public

registerSprite(spriteId: string, sourceImage: HTMLImageElement | HTMLCanvasElement): RegularSprite

Registers a new sprite

public

trackClicks(element: HTMLElement, clickHandler: function)

Tracks clicks on a element (e.g.

Public Constructors

public constructor() source

Public Members

public KEYMAPPINGS: * source

public clickDetectors: *[] source

public exports: {"AtlasDefinition": *, "BackgroundResourcesLoader": *, "ClickDetector": *, "DrawParameters": *, "ExplainedResult": *, "Factory": *, "InputDistributor": *, "InputReceiver": *, "Dialog": *, "DialogOptionChooser": *, "DialogLoading": *, "DialogWithForm": *, "FormElement": *, "FormElementInput": *, "FormElementCheckbox": *, "FormElementItemChooser": *, "ReadWriteProxy": *, "Rectangle": *, "RequestChannel": *, "RestrictionManager": *, "RandomNumberGenerator": *, "Signal": *, "SingletonFactory": *, "BaseSprite": *, "SpriteAtlasLink": *, "AtlasSprite": *, "RegularSprite": *, "StaleAreaDetector": *, "StateManager": *, "TextualGameState": *, "TrackedState": *, "Vector": *, "GameState": *, "enableImageSmoothing": *, "disableImageSmoothing": *, "getBufferVramUsageBytes": *, "getBufferStats": *, "clearBufferBacklog": *, "makeOffscreenBuffer": *, "registerCanvas": *, "freeCanvas": *, "getDeviceDPI": *, "smoothenDpi": *, "prepareHighDPIContext": *, "resizeHighDPICanvas": *, "resizeCanvas": *, "resizeCanvasAndClear": *, "initDrawUtils": *, "drawRotatedSprite": *, "drawSpriteClipped": *, "initBuildingsByCategory": *, "setGlobalApp": *, "createLogger": *, "serializeError": *, "stringifyObjectContainingErrors": *, "globalDebug": *, "globalLog": *, "globalWarn": *, "globalError": *, "logSection": *, "compressU8": *, "compressU8WHeader": *, "decompressU8WHeader": *, "compressX64": *, "decompressX64": *, "sha1": *, "getNameOfProvider": *, "computeCrc": *, "isAndroid": *, "isIos": *, "getPlatformName": *, "getIPCRenderer": *, "make2DUndefinedArray": *, "newEmptyMap": *, "randomInt": *, "accessNestedPropertyReverse": *, "randomChoice": *, "fastArrayDelete": *, "fastArrayDeleteValue": *, "fastArrayDeleteValueIfContained": *, "arrayDelete": *, "arrayDeleteValue": *, "epsilonCompare": *, "lerp": *, "findNiceValue": *, "findNiceIntegerValue": *, "formatBigNumber": *, "formatBigNumberFull": *, "waitNextFrame": *, "round1Digit": *, "round2Digits": *, "round3Digits": *, "round4Digits": *, "clamp": *, "makeDiv": *, "makeButtonElement": *, "makeButton": *, "removeAllChildren": *, "isSupportedBrowser": *, "formatSecondsToTimeAgo": *, "formatSeconds": *, "round1DigitLocalized": *, "formatItemsPerSecond": *, "rotateFlatMatrix3x3": *, "generateMatrixRotations": *, "rotateDirectionalObject": *, "safeModulo": *, "smoothPulse": *, "fillInLinkIntoTranslation": *, "generateFileDownload": *, "startFileChoose": *, "getRomanNumber": *, "mixVector": *, "queryParamOptions": *, "PROMISE_ABORTED": *, "CRC_PREFIX": *, "ORIGINAL_SPRITE_SCALE": *, "FULL_CLIP_RECT": *, "enumDirection": *, "enumInvertedDirections": *, "enumDirectionToAngle": *, "enumAngleToDirection": *, "arrayAllDirections": *, "enumDirectionToVector": *, "atlasFiles": *, "MAX_MOVE_DISTANCE_PX": *, "clickDetectorGlobals": *, "IS_DEBUG": *, "SUPPORT_TOUCH": *, "IS_MAC": *, "THIRDPARTY_URLS": *, "A_B_TESTING_LINK_TYPE": *, "globalConfig": *, "IS_MOBILE": *, "APPLICATION_ERROR_OCCURED": *, "gMetaBuildingRegistry": *, "gBuildingsByCategory": *, "gComponentRegistry": *, "gGameModeRegistry": *, "gGameSpeedRegistry": *, "gItemRegistry": *, "GLOBAL_APP": *, "Loader": *, "AdinplayAdProvider": *, "GamedistributionAdProvider": *, "NoAdProvider": *, "AdProviderInterface": *, "ShapezGameAnalytics": *, "GoogleAnalyticsImpl": *, "NoGameAnalytics": *, "SoundImplBrowser": *, "StorageImplBrowserIndexedDB": *, "StorageImplBrowser": *, "PlatformWrapperImplBrowser": *, "StorageImplElectron": *, "PlatformWrapperImplElectron": *, "AnalyticsInterface": *, "GameAnalyticsInterface": *, "SoundInstanceInterface": *, "MusicInstanceInterface": *, "SoundInterface": *, "StorageInterface": *, "PlatformWrapperInterface": *, "MUSIC": *, "ApplicationSettings": *, "allApplicationSettings": *, "getApplicationSettingById": *, "uiScales": *, "scrollWheelSensitivities": *, "movementSpeeds": *, "autosaveIntervals": *, "BaseSavegameInterface": *, "SavegameInterface_V1000": *, "SavegameInterface_V1001": *, "SavegameInterface_V1002": *, "SavegameInterface_V1003": *, "SavegameInterface_V1004": *, "SavegameInterface_V1005": *, "SavegameInterface_V1006": *, "SavegameInterface_V1007": *, "SavegameInterface_ML01": *, "SerializerInternal": *, "SavegameManager": *, "SavegameSerializer": *, "Savegame": *, "BaseDataType": *, "TypeInteger": *, "TypeBoolean": *, "TypePositiveInteger": *, "TypeString": *, "TypeVector": *, "TypeTileVector": *, "TypeNumber": *, "TypePositiveNumber": *, "TypeEnum": *, "TypeEntity": *, "TypeEntityWeakref": *, "TypeClass": *, "TypeClassData": *, "TypeClassFromMetaclass": *, "TypeMetaClass": *, "TypeArray": *, "TypeFixedClass": *, "TypeKeyValueMap": *, "TypeClassId": *, "TypePair": *, "TypeNullable": *, "TypeStructuredObject": *, "BasicSerializableObject": *, "getSavegameInterface": *, "compressObject": *, "decompressObject": *, "schemaToJsonSchema": *, "serializeSchema": *, "deserializeSchema": *, "verifySchema": *, "extendSchema": *, "savegameInterfaces": *, "AutomaticSave": *, "BeltPath": *, "Blueprint": *, "Camera": *, "GameCore": *, "DynamicTickrate": *, "EntityManager": *, "Entity": *, "GameLoadingOverlay": *, "GameSystemManager": *, "Keybinding": *, "KeyActionMapper": *, "GameLogic": *, "MapChunkView": *, "MapView": *, "BaseMap": *, "ProductionAnalytics": *, "GameRoot": *, "ShapeDefinitionManager": *, "enumShortcodeToSubShape": *, "enumSubShapeToShortcode": *, "enumSubShape": *, "ShapeDefinition": *, "SoundProxy": *, "itemResolverSingleton": *, "createSimpleShape": *, "applyGameTheme": *, "getRandomHint": *, "registerBuildingVariant": *, "getBuildingDataFromCode": *, "getCodeFromBuildingData": *, "typeItemSingleton": *, "gBuildingVariants": *, "USER_INTERACT_MOVE": *, "USER_INTERACT_ZOOM": *, "USER_INTERACT_TOUCHEND": *, "MetaBuilding": *, "Component": *, "BaseItem": *, "BaseGameSpeed": *, "GameSystemWithFilter": *, "GameSystem": *, "GameMode": *, "HUDBaseToolbar": *, "BaseHUDPart": *, "GameHUD": *, "HUDSettingsMenu": *, "HUDBetaOverlay": *, "HUDBlueprintPlacer": *, "HUDBuildingPlacer": *, "HUDBuildingPlacerLogic": *, "HUDCatMemes": *, "HUDChangesDebugger": *, "HUDColorBlindHelper": *, "HUDConstantSignalEdit": *, "HUDDebugInfo": *, "HUDEntityDebugger": *, "HUDGameMenu": *, "HUDInteractiveTutorial": *, "HUDKeybindingOverlay": *, "HUDLayerPreview": *, "HUDLeverToggle": *, "HUDMassSelector": *, "HUDMinerHighlight": *, "HUDModalDialogs": *, "HUDNotifications": *, "HUDPartTutorialHints": *, "HUDPinnedShapes": *, "HUDSandboxController": *, "HUDScreenshotExporter": *, "HUDShapeStatisticsHandle": *, "HUDShapeViewer": *, "HUDShop": *, "HUDStandaloneAdvantages": *, "HUDStatistics": *, "HUDTutorialVideoOffer": *, "HUDUnlockNotification": *, "HUDVignetteOverlay": *, "HUDWatermark": *, "HUDWaypoints": *, "HUDWireInfo": *, "HUDWiresOverlay": *, "EnumSetting": *, "BoolSetting": *, "RangeSetting": *, "BaseSetting": *, "cachebust": *, "matchOverwriteRecursiveSettings": *, "defaultBuildingVariant": *, "types": *, "STOP_PROPAGATION": *, "SOUNDS": *, "BOOL_TRUE_SINGLETON": *, "BOOL_FALSE_SINGLETON": *, "RegularGameMode": *, "PausedGameSpeed": *, "FastForwardGameSpeed": *, "RegularGameSpeed": *, "ShapeItem": *, "BooleanItem": *, "ColorItem": *, "InGameState": *, "SettingsState": *, "AboutState": *, "MainMenuState": *, "ChangelogState": *, "KeybindingsState": *, "PreloadState": *, "MobileWarningState": *, "ItemAcceptorSystem": *, "BeltSystem": *, "UndergroundBeltSystem": *, "MinerSystem": *, "StorageSystem": *, "ItemProcessorSystem": *, "FilterSystem": *, "ItemProducerSystem": *, "ItemEjectorSystem": *, "HubSystem": *, "StaticMapEntitySystem": *, "WiredPinsSystem": *, "BeltUnderlaysSystem": *, "ConstantSignalSystem": *, "LeverSystem": *, "WireSystem": *, "LogicGateSystem": *, "BeltReaderSystem": *, "DisplaySystem": *, "ItemProcessorOverlaysSystem": *, "BeltReaderComponent": *, "BeltUnderlaysComponent": *, "BeltComponent": *, "ConstantSignalComponent": *, "DisplayComponent": *, "FilterComponent": *, "HubComponent": *, "ItemAcceptorComponent": *, "ItemEjectorComponent": *, "ItemProcessorComponent": *, "ItemProducerComponent": *, "LeverComponent": *, "LogicGateComponent": *, "MinerComponent": *, "StaticMapEntityComponent": *, "StorageComponent": *, "UndergroundBeltComponent": *, "WireTunnelComponent": *, "WireComponent": *, "WiredPinsComponent": *, "enumHubGoalRewards": *, "enumAnalyticsDataSource": *, "enumCategories": *, "enumClippedBeltUnderlayType": *, "enumColorMixingResults": *, "enumColors": *, "enumColorsToHexCode": *, "enumColorToShortcode": *, "enumDisplayMode": *, "enumHubGoalRewardsToContentUnlocked": *, "enumItemProcessorRequirements": *, "enumItemProcessorTypes": *, "enumLocalSavegameStatus": *, "enumMouseButton": *, "enumNotificationType": *, "enumSavePriority": *} source

public firstState: string source

public ingame: {"buildings": *, "components": *, "systems": *, "items": *, "gamemodes": *, "gamespeed": *, "layers": *, "hub_goals": *} source

public map: {"MapChunk": *, "MapResourcesSystem": *} source

public modOrder: *[] source

public mods: * source

public states: * source

public themes: * source

public toolbars: {"buildings": *, "wires": *} source

public translations: * source

public user: * source

Public Methods

public generateMatrixRotations(originalMatrix: Array<number>): Object<number, Array<number>> source

Generates rotated variants of the matrix

Params:

NameTypeAttributeDescription
originalMatrix Array<number>

Return:

Object<number, Array<number>>

public getRegularSprite(id: string): RegularSprite source

Returns a regular sprite by its id

Params:

NameTypeAttributeDescription
id string

Return:

RegularSprite

public getSprite(id: string): AtlasSprite source

Returns a regular sprite by its id

Params:

NameTypeAttributeDescription
id string

Return:

AtlasSprite

public injectCss(css: string) source

Adds css to the page

Params:

NameTypeAttributeDescription
css string

public registerAtlas(atlasDataString: string) source

Registers a new atlas

Params:

NameTypeAttributeDescription
atlasDataString string

public registerAtlases(atlasDataStrings: string[]) source

Registers a new atlases

Params:

NameTypeAttributeDescription
atlasDataStrings string[]

public registerBuilding(buildingClass: *, iconDataURL: *, key: *) source

Params:

NameTypeAttributeDescription
buildingClass *
iconDataURL *
key *

public registerIcon(id: string, iconDataURL: string) source

Registers a new icon

Params:

NameTypeAttributeDescription
id string
iconDataURL string

public registerSprite(spriteId: string, sourceImage: HTMLImageElement | HTMLCanvasElement): RegularSprite source

Registers a new sprite

Params:

NameTypeAttributeDescription
spriteId string
sourceImage HTMLImageElement | HTMLCanvasElement

Return:

RegularSprite

public trackClicks(element: HTMLElement, clickHandler: function) source

Tracks clicks on a element (e.g. button). Useful because you should both support touch and mouse events.

Params:

NameTypeAttributeDescription
element HTMLElement
clickHandler function