mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
update doc/*/scripting/builtins/libgui.md
This commit is contained in:
parent
965faebc7b
commit
135c938dd2
2 changed files with 63 additions and 1 deletions
|
|
@ -40,6 +40,37 @@ gui.get_locales_info() -> table of tables {
|
|||
|
||||
Returns information about all loaded locales (res/texts/\*).
|
||||
|
||||
## Frames
|
||||
|
||||
```lua
|
||||
-- A replacement for menu:reset() to close the pause menu, deactivating the main UI frame.
|
||||
gui.close_menu()
|
||||
|
||||
-- Creates a frame.
|
||||
gui.create_frame(
|
||||
-- Global frame id (not related to the UI 'id' property).
|
||||
id: str,
|
||||
-- The texture to render the frame to.
|
||||
-- If the string is empty, the frame is rendered to the screen.
|
||||
output_texture: str,
|
||||
-- Frame size. For example: {640, 480}
|
||||
size: vec2
|
||||
) -> Element, Document
|
||||
|
||||
-- Returns the id of the active frame (not the element id).
|
||||
gui.get_active_frame() -> str
|
||||
|
||||
-- Sets the active frame, receiving user input.
|
||||
-- An empty string specifies the null frame capturing the cursor.
|
||||
gui.set_active_frame(
|
||||
-- ID of the frame created via gui.create_frame
|
||||
id: str,
|
||||
-- Function providing the cursor position in the frame.
|
||||
-- Used for custom projection (e.g., in 3D)
|
||||
[optional] cursorLocator
|
||||
)
|
||||
```
|
||||
|
||||
```lua
|
||||
gui.clear_markup(
|
||||
-- markup language ("md" - Markdown)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,37 @@ gui.get_env(document: string) -> table
|
|||
gui.get_locales_info() -> table
|
||||
```
|
||||
|
||||
## Фреймы
|
||||
|
||||
```lua
|
||||
-- Замена для menu:reset() для закрытия меню паузы, деактивирующая основной фрейм UI.
|
||||
gui.close_menu()
|
||||
|
||||
-- Создаёт фрейм.
|
||||
gui.create_frame(
|
||||
-- Глобальный id фрейма (не связан с UI свойством 'id').
|
||||
id: str,
|
||||
-- Текстура, в которую будет производиться рендер фрейма.
|
||||
-- В случае пустой строки рендер производится на экран.
|
||||
output_texture: str,
|
||||
-- Размер фрейма. Например: {640, 480}
|
||||
size: vec2
|
||||
) -> Element, Document
|
||||
|
||||
-- Возвращает id активного фрейма (не id элемента).
|
||||
gui.get_active_frame() -> str
|
||||
|
||||
-- Устанавливает активный фрейм, получающий пользовательский ввод.
|
||||
-- Пустая строка указывает null-фрейм, при котором захватывается курсор.
|
||||
gui.set_active_frame(
|
||||
-- id фрейма, созданного через gui.create_frame
|
||||
id: str,
|
||||
-- Функция-поставщик позиции курсора во фрейме.
|
||||
-- Используется для пользовательской проекции (например в 3D)
|
||||
[опционально] cursorLocator
|
||||
)
|
||||
```
|
||||
|
||||
## Разметка
|
||||
|
||||
```lua
|
||||
|
|
@ -109,4 +140,4 @@ gui.template(
|
|||
```lua
|
||||
-- Корневой UI документ.
|
||||
gui.root: Document
|
||||
```
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue