Kerby64
    Preparing search index...

    Class Menu

    Generic menu class for creating UI menus in Babylon.js.
    It provides methods to add background images, text blocks, and buttons with various configurations.

    Index

    Constructors

    • Parameters

      • name: string
      • idealWidth: number

      Returns Menu

    Properties

    ui: AdvancedDynamicTexture

    Methods

    • Add a background image to the menu. The image will stretch to fill the entire UI.

      Parameters

      • name: string

        image's control name

      • url: string

      Returns void

    • Create and then add a button to the menu. The button is made of an image and a text label, and can be styled with various properties.

      Parameters

      • name: string
      • text: string
      • imageUrl: string
      • imageWidth: string
      • imageHeight: string
      • width: string | number
      • height: string | number
      • background: string = "black"
      • color: string = "white"
      • top: string | number = 0
      • left: string | number = 0
      • cornerRadius: number = 0
      • thickness: number = 0
      • verticalAlignment: number = Control.VERTICAL_ALIGNMENT_BOTTOM
      • horizontalAlignment: number = Control.HORIZONTAL_ALIGNMENT_CENTER
      • OptionalclickCallback: () => void

      Returns void

    • Create and then add a simple button to the menu. The button will have a text label and can be styled with various properties.

      Parameters

      • name: string
      • text: string
      • width: string | number
      • height: string | number
      • background: string = "black"
      • color: string = "white"
      • top: string | number = 0
      • left: string | number = 0
      • cornerRadius: number = 0
      • thickness: number = 0
      • verticalAlignment: number = Control.VERTICAL_ALIGNMENT_BOTTOM
      • horizontalAlignment: number = Control.HORIZONTAL_ALIGNMENT_CENTER
      • OptionalclickCallback: () => void

      Returns void

    • Add a text block to the menu. The text block can be positioned and styled with various properties.

      Parameters

      • name: string
      • text: string
      • fontSize: number
      • color: string = "white"
      • top: string | number = 0
      • left: string | number = 0
      • verticalAlignment: number = Control.VERTICAL_ALIGNMENT_TOP
      • horizontalAlignment: number = Control.HORIZONTAL_ALIGNMENT_LEFT
      • OptionalfontFamily: string

      Returns void