-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
Note
The library itself if installed has full domcumentation with the Lua Language Server by Sumneko and Grandpa Scout's Figura Rewrite Docs
Assuming you already know how to use the GNUI library, you can get started with the following.
local GNUI = require"GNUI.main"
-- Elements
local Button = require"GNUI.element.button"
local Slider = require"GNUI.element.slider"
local TextField = require"GNUI.element.textField"
local screen = GNUI.getScreenCanvas()Here is a preview of GNUI in action
local GNUI = require"GNUI.main"
local Theme = require"GNUI.theme"
-- Elements
local Button = require"GNUI.element.button"
local Slider = require"GNUI.element.slider"
local TextField = require"GNUI.element.textField"
local screen = GNUI.getScreenCanvas()
local cntr = GNUI.newBox(screen)
:setAnchor(0,0,0.5,1):setDimensions(40,40,-40,-40)
Theme.style(cntr,"Background")
local btn = Button.new(cntr)
:setPos(10,10)
:setSize(100,20)
:setText("Example Button")
btn.PRESSED:register(function ()
print("ive been pressed!")
end)
Slider.new(false,0,20,1,2,cntr)
:setAnchor(
0,0.5,
1,0.5
)
:setSize(0,20)
:setPos(0,-20)
TextField.new(cntr)
:setAnchor(
0,1,
1,1
):setPos(0,-20)
:setSize(0,20)
.FIELD_CONFIRMED:register(function (text)
print("You typed "..text)
end)Important
the properties of any GNUI elements are exposed to serve as a getter, do NOT set them. use their setters instead. box.Dimensions -> box:setDimensions(x,y,z,w)
- Download the repository or just click here to download
- download the zip file
- extract it in your avatar's root folder.
in the avatar's folder, run
git submodule add https://github.com/lua-gods/GNUI.that should create a new folder called GNUI in the avatar's folder.
Important
Sumneko lua by default ignores git submodules. Make sure to enable submodules in your repository by setting "Lua.workspace.ignoreSubmodules":false your settings.json file
and if using GSRewriteDocs in the .luarc.json file, make sure to set "ignoreSubmodules": false