OSRS Plugin API
    Preparing search index...

    Interface Rect

    A UI element with a rectangular shape: one that has both an auto-adjustable position (from the top-left corner) and size.

    interface Rect {
        height: number;
        heightRatio: number;
        positionMode: LayoutMode;
        sameLine: boolean;
        sizeMode: LayoutMode;
        width: number;
        widthRatio: number;
        x: number;
        xRatio: number;
        y: number;
        yRatio: number;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    height: number

    The height of this element, in UI coordinate space.

    -- Create a window that has a set height
    local window = osrs.Ui.window({title = "Example Window", sizeMode = 1, height = 200})

    -- Add window to the canvas
    osrs.Ui.canvas:addChild(window)
    heightRatio: number

    The percentage height of the screen this element should take up when sizeMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.

    -- Create new container with a set widthRatio and heightRatio
    local newWindow = osrs.Ui.window({title = "Example Window", sizeMode = 2, widthRatio = 0.7, heightRatio = .2})

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    positionMode: LayoutMode

    How this element should position itself.

    LayoutMode.AUTOMATIC
    
    -- Create a window that has automatic position mode, this is default
    local window1 = osrs.Ui.window({title = "Automatic Position Mode"})

    -- Create a window that has manual position mode
    local window2 = osrs.Ui.window(
    {
    title = "Manual Position Mode",
    positionMode = osrs.Ui.LayoutMode.MANUAL
    }
    )

    -- Add the windows to the canvas
    osrs.Ui.canvas:addChild(window1)
    osrs.Ui.canvas:addChild(window2)
    sameLine: boolean

    Flag to control whether this element should be placed on the same line as the previous element.

    false
    
    -- Create a container
    local window = osrs.Ui.window({title = "Example Window"})

    -- Create three buttons, with two of them on the same line
    local button1 = osrs.Ui.textButton({text = "Button 1"})
    local button2 = osrs.Ui.textButton({text = "Button 2"})
    local button3 = osrs.Ui.textButton({text = "Button 3", sameLine = true})

    -- Add buttons to the container
    window:addChild(button1)
    window:addChild(button2)
    window:addChild(button3)

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(window)
    sizeMode: LayoutMode

    How this element should size itself.

    LayoutMode::AUTOMATIC
    
    -- Create a window that has automatic size mode, this is default
    local window1 = osrs.Ui.window({title = "Automatic Size Mode"})

    -- Create a window that has manual size mode
    local window2 = osrs.Ui.window(
    {
    title = "Manual Size Mode",
    sizeMode = osrs.Ui.LayoutMode.MANUAL,
    height = 200,
    width = 200
    }
    )

    -- Add the windows to the canvas
    osrs.Ui.canvas:addChild(window1)
    osrs.Ui.canvas:addChild(window2)
    width: number

    The width of this element, in UI coordinate space.

    -- Create a window that has a set width
    local window = osrs.Ui.window({title = "Example Window", sizeMode = 1, width = 200})

    -- Add window to the canvas
    osrs.Ui.canvas:addChild(window)
    widthRatio: number

    The percentage width of the screen this element should take up when sizeMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.

    -- Create new container with a set widthRatio and heightRatio
    local newWindow = osrs.Ui.window({title = "Example Window", sizeMode = 2, widthRatio = 0.7, heightRatio = .2})

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    x: number

    The horizontal component of this element's position, in UI coordinate space.

    -- Create a window with a set x position
    local window = osrs.Ui.window({title = "Example Window", positionMode = 1, x = 100})

    -- Add window to the canvas
    osrs.Ui.canvas:addChild(window)
    xRatio: number

    The percentage distance from the left side of the screen that this element's top-left corner should be placed at when positionMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.

    -- Create new container with a set xRatio and yRatio
    local newWindow = osrs.Ui.window({title = "Example Window", positionMode = 2, xRatio = 0.7, yRatio = .2})

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)
    y: number

    The vertical component of this element's position, in UI coordinate space.

    -- Create a window with a set y position
    local window = osrs.Ui.window({title = "Example Window", positionMode = 1, y = 100})

    -- Add window to the canvas
    osrs.Ui.canvas:addChild(window)
    yRatio: number

    The percentage distance from the top side of the screen that this element's top-left corner should be placed at when positionMode is set to LayoutMode.PROPORTIONAL. The number needs to be a decimal.

    -- Create new container with a set xRatio and yRatio
    local newWindow = osrs.Ui.window({title = "Example Window", positionMode = 2, xRatio = 0.7, yRatio = .2})

    -- Add container to the canvas
    osrs.Ui.canvas:addChild(newWindow)