@goldenratio/karlib
    Preparing search index...

    Class Karlib

    Implements

    • Disposable
    Index

    Constructors

    Methods

    • Sets background color

      Parameters

      • color: string = "#000"

      Returns void

    • Dispose the karlib instance. Once dispose is called, the karlib instance should not be re-used

      Returns void

    • Begin 2D mode with custom camera

      Parameters

      Returns void

    • Allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically A B +---+----------------------+---+ C | 1 | 2 | 3 | +---+----------------------+---+ | | | | | 4 | 5 | 6 | | | | | +---+----------------------+---+ D | 7 | 8 | 9 | +---+----------------------+---+ When changing this objects width and/or height: areas 1 3 7 and 9 will remain unscaled. areas 2 and 8 will be stretched horizontally areas 4 and 6 will be stretched vertically area 5 will be stretched both horizontally and vertically

      Parameters

      Returns void

    • Executes a drawing function with an clipping mask.

      Parameters

      • draw_fn: () => void

        mask is applied for any drawing done inside this function

      • Optionalmask_source: MaskSource

        when not defined mask is not applied. By setting it to undefined, you can use it to disable/enable mask

      Returns void

    • Returns number

    • Returns CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D

    • Parameters

      • source: Texture
      • tint_color: string
      • tint_alpha: number

      Returns Texture

    • Loads image and converts it to texture. If the image path contains token "{dpr}", then when loading the image,"{dpr}" value is replaced with device-pixel-ratio.

      Parameters

      Returns Promise<Texture | undefined>