JSM Developer API Documentation
    Preparing search index...

    Interface HUDContext

    The drawing context that is provided when ModDefinition.hud is called

    interface HUDContext {
        drawRect: (
            x: number,
            y: number,
            width: number,
            height: number,
            color: number,
        ) => void;
        drawTexture: (x: number, y: number, texture: PixelArray) => void;
        getHeight: () => number;
        getWidth: () => number;
    }
    Index

    Properties

    drawRect: (
        x: number,
        y: number,
        width: number,
        height: number,
        color: number,
    ) => void

    This function will draw a rectangle at a location on the screen.

    Type Declaration

      • (x: number, y: number, width: number, height: number, color: number): void
      • Parameters

        • x: number

          The X offset from the left side of the screen

        • y: number

          The Y offset from the top of the screen

        • width: number

          The width of the rectangle

        • height: number

          The height of the rectangle

        • color: number

          The color of the rectangle as an RGB hexadecimal number (0xRRGGBB)

        Returns void

    drawTexture: (x: number, y: number, texture: PixelArray) => void

    This function will draw a PixelArray at a location on the screen.

    Type Declaration

      • (x: number, y: number, texture: PixelArray): void
      • Parameters

        • x: number

          The X offset from the left side of the screen.

        • y: number

          The Y offset from the top of the screen.

        • texture: PixelArray

          The pixel array that contains a texture. The dimensions are not limited, however, higher image dimensions will take longer to draw and potentially lose frames.

        Returns void

    Textures do not support transparency.

    getHeight: () => number

    This function gets the height of the window's renderable area

    Type Declaration

      • (): number
      • Returns number

        The height of the renderable area

    getWidth: () => number

    This function gets the width of the window's renderable area

    Type Declaration

      • (): number
      • Returns number

        The width of the renderable area