OpenMiner/docs/lua-api-gui-image.md

63 lines
793 B
Markdown
Raw Normal View History

2020-03-12 23:38:34 +01:00
# Lua API: Image
## Example
```lua
gui:image {
name = "img_background", -- mandatory
pos = {x = 0, y = 0}, -- mandatory
texture = mod:path() .. "/textures/gui/workbench.png",
2020-03-12 23:38:34 +01:00
clip = {x = 0, y = 0, width = 176, height = 166},
}
```
## Attributes
### `clip`
Clip rect of the texture.
Example:
```lua
clip = {
x = 0,
y = 0,
width = 176,
height = 166
}
```
### `name`
Name of the widget. **Mandatory field.**
Example:
```lua
name = "img_background"
```
### `pos`
Position of the widget. **Mandatory field.**
Example:
```lua
pos = {
x = 0,
y = 0
}
```
### `texture`
Full path of the texture. Relative to the repo root.
Example:
```lua
texture = mod:path() .. "/textures/gui/workbench.png"
2020-03-12 23:38:34 +01:00
```
2020-05-20 20:53:22 +02:00
See [this page](lua-api-mod.md#path) for more details about `mod:path()`.