1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-27 05:10:26 +00:00

Document using ui.texture to create atlases

This commit is contained in:
uramer 2022-02-21 15:38:54 +01:00
parent 94cc090f73
commit e7474490a1

View file

@ -170,20 +170,33 @@
-- @field #number button Mouse button which triggered the event (could be nil) -- @field #number button Mouse button which triggered the event (could be nil)
--- ---
-- Register a new texture resource -- Register a new texture resource. Can be used to manually atlas UI textures.
-- @function [parent=#ui] texture #TextureResource -- @function [parent=#ui] texture #TextureResource
-- @param #TextureResourceOptions options -- @param #TextureResourceOptions options
-- @usage
-- local ui = require('openmw.ui')
-- local vector2 = require('openmw.util').vector2
-- local myAtlas = 'textures/my_atlas.dds' -- a 128x128 atlas
-- local texture1 = ui.texture { -- texture in the top left corner of the atlas
-- path = myAtlas,
-- offset = vector2(0, 0),
-- size = vector2(64, 64),
-- }
-- local texture2 = ui.texture { -- texture in the top right corner of the atlas
-- path = myAtlas,
-- offset = vector2(64, 0),
-- size = vector2(64, 64),
-- }
--- ---
-- A texture ready to be used by UI widgets -- A texture ready to be used by UI widgets
-- @type TextureResource -- @type TextureResource
--- ---
-- Table with argument passed to ui.texture -- Table with arguments passed to ui.texture.
-- @type TextureResourceOptions -- @type TextureResourceOptions
-- @field #string path Path to the texture file. Required -- @field #string path Path to the texture file. Required
-- @field openmw.util#Vector2 offset Offset of this resource in the texture. (0, 0) by default -- @field openmw.util#Vector2 offset Offset of this resource in the texture. (0, 0) by default
-- @field openmw.util#Vector2 size Size of the resource in the texture. (0, 0) by default. -- @field openmw.util#Vector2 size Size of the resource in the texture. (0, 0) by default. 0 means the whole texture size is used.
-- 0 means the whole texture size is used.
return nil return nil