OpenMiner/docs/lua-api-gui-scroll-bar.md

1.1 KiB

Lua API: Scroll bar

Example

gui:scroll_bar {
	name = "scroll_bar",
	pos = {x = 175, y = 18},

	texture = mod:path() .. "/textures/gui/tabs.png",
	clip = {x = 232, y = 0, width = 12, height = 15},

	widget = "inv_creative_items",

	min_y = 0,
	max_y = 110 - 15,
}

Attributes

clip

Clip rect of the texture.

Example:

clip = {
	x = 0,
	y = 0,
	width = 176,
	height = 166
}

max_y

Maximum Y position for the bar.

Example:

max_y = 95

min_y

Minimum Y position for the bar.

Example:

min_y = 0

name

Name of the widget. Mandatory field.

Example:

name = "scroll_bar"

pos

Position of the widget. Mandatory field.

Example:

pos = {
	x = 0,
	y = 0
}

texture

Full path of the texture. Relative to the repo root.

Example:

texture = mod:path() .. "/textures/gui/tabs.png"

See this page for more details about mod:path().

widget

Name of the inventory widget which will be affected by the scroll bar.

Example:

widget = "inv_items"