Home Reference Source
import {BaseHUDPart} from 'shapez.io/js/game/hud/base_hud_part.js'
public class | source

BaseHUDPart

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

root: *

Method Summary

Public Methods
public

Cleans up the hud element, if overridden make sure to call super.cleanup

public

Cleans up all click detectors

public

close()

Should close the element, in case its supported

public

closeOnBackgroundClick(element: HTMLElement, closeMethod: function)

Closes this element when its background is clicked

public

createElements(parent: HTMLElement)

Should create all require elements

public

draw(parameters: DrawParameters)

Should draw the hud

public

Should draw any overlays (screen space)

public

Forwards the game speed keybindings so you can toggle pause / Fastforward in the building tooltip and such

public

Forwards the map movement keybindings so you can move the map with the arrow keys

public

Should initialize the element, called after the elements have been created

public

Should return true if this overlay is open and currently blocking any user interaction

public

Registers a new click detector

public

Should return false if the game should be paused

public

Should return true if the widget has a modal dialog opened and thus the game does not need to update / redraw

public

trackClicks(element: Element, handler: function, args: import("../../core/click_detector").ClickDetectorConstructorArgs=)

Helper method to construct a new click detector

public

update()

Should update any required logic

Public Constructors

public constructor(root: GameRoot) source

Params:

NameTypeAttributeDescription
root GameRoot

Public Members

public clickDetectors: Array<ClickDetectorConstructorArgs> source

public root: * source

Public Methods

public cleanup() source

Cleans up the hud element, if overridden make sure to call super.cleanup

public cleanupClickDetectors() source

Cleans up all click detectors

public close() source

Should close the element, in case its supported

public closeOnBackgroundClick(element: HTMLElement, closeMethod: function) source

Closes this element when its background is clicked

Params:

NameTypeAttributeDescription
element HTMLElement
closeMethod function

public createElements(parent: HTMLElement) source

Should create all require elements

Params:

NameTypeAttributeDescription
parent HTMLElement

public draw(parameters: DrawParameters) source

Should draw the hud

Params:

NameTypeAttributeDescription
parameters DrawParameters

public drawOverlays(parameters: DrawParameters) source

Should draw any overlays (screen space)

Params:

NameTypeAttributeDescription
parameters DrawParameters

public forwardGameSpeedKeybindings(sourceMapper: KeyActionMapper) source

Forwards the game speed keybindings so you can toggle pause / Fastforward in the building tooltip and such

Params:

NameTypeAttributeDescription
sourceMapper KeyActionMapper

public forwardMapMovementKeybindings(sourceMapper: KeyActionMapper) source

Forwards the map movement keybindings so you can move the map with the arrow keys

Params:

NameTypeAttributeDescription
sourceMapper KeyActionMapper

public initialize() source

Should initialize the element, called after the elements have been created

public isBlockingOverlay(): boolean source

Should return true if this overlay is open and currently blocking any user interaction

Return:

boolean

public registerClickDetector(detector: ClickDetectorConstructorArgs) source

Registers a new click detector

Params:

NameTypeAttributeDescription
detector ClickDetectorConstructorArgs

public shouldPauseGame(): boolean source

Should return false if the game should be paused

Return:

boolean

public shouldPauseRendering(): boolean source

Should return true if the widget has a modal dialog opened and thus the game does not need to update / redraw

Return:

boolean

public trackClicks(element: Element, handler: function, args: import("../../core/click_detector").ClickDetectorConstructorArgs=) source

Helper method to construct a new click detector

Params:

NameTypeAttributeDescription
element Element

The element to listen on

handler function

The handler to call on this object

args import("../../core/click_detector").ClickDetectorConstructorArgs=

Click detector arguments

public update() source

Should update any required logic