diff --git a/doc/en/scripting/builtins/libgui.md b/doc/en/scripting/builtins/libgui.md index cbcca4ce7..df3615539 100644 --- a/doc/en/scripting/builtins/libgui.md +++ b/doc/en/scripting/builtins/libgui.md @@ -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) diff --git a/doc/ru/scripting/builtins/libgui.md b/doc/ru/scripting/builtins/libgui.md index 50203bb46..5c564a0ad 100644 --- a/doc/ru/scripting/builtins/libgui.md +++ b/doc/ru/scripting/builtins/libgui.md @@ -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 -``` \ No newline at end of file +```