Updated NyoUI (markdown)

Robert Jelic
2022-04-03 21:12:17 +02:00
parent e77b68e9c6
commit 521a9cc1ec

@@ -1,70 +1,70 @@
NyoUI is managing all the things.
Basalt is managing all the things.
To start using NyoUI you have to do the following line of code:
To start using Basalt you have to do the following line of code:
`local NyoUI = dofile("NyoUI.lua")`
`local basalt = dofile("basalt.lua")`
remember you need the NyoUI.lua file on your computer!
remember you need the basalt.lua file on your computer!
Now you are able to call all these functions:
## NyoUI.createFrame
## basalt.createFrame
create a frame without a parent
````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local mainFrame = basalt.createFrame("myFirstFrame"):show()
````
**args:** the id as string<br>
**returns:** frame object<br>
## NyoUI.removeFrame
## basalt.removeFrame
removes the frame
````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local mainFrame = basalt.createFrame("myFirstFrame"):show()
NyoUI.removeFrame("myFirstFrame")
````
**args:** the id as string<br>
**returns:**-<br>
## NyoUI.getFrame
## basalt.getFrame
With that function you can get frames, but only frames without a parent!
````lua
NyoUI.createFrame("myFirstFrame")
NyoUI.getFrame("myFirstFrame"):show()
basalt.createFrame("myFirstFrame")
basalt.getFrame("myFirstFrame"):show()
````
**args:** id of the frame<br>
**returns:** frame object<br>
## NyoUI.getActiveFrame
## basalt.getActiveFrame
returns the currently active (without a parent) frame
````lua
NyoUI.createFrame("myFirstFrame"):show()
NyoUI.debug(NyoUI.getActiveFrame():getName()) -- returns myFirstFrame
basalt.createFrame("myFirstFrame"):show()
basalt.debug(basalt.getActiveFrame():getName()) -- returns myFirstFrame
````
**args:** -<br>
**returns:** frame object<br>
## NyoUI.startUpdate
## basalt.startUpdate
starts the logic, draw and event handler
````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
NyoUI.startUpdate()
local mainFrame = basalt.createFrame("myFirstFrame"):show()
basalt.startUpdate()
````
**args:** -<br>
**returns:**-<br>
## NyoUI.stopUpdate
## basalt.stopUpdate
stops the logic, draw and event handler
````lua
NyoUI.stopUpdate()
basalt.stopUpdate()
````
**args:** -<br>
**returns:**-<br>
## NyoUI.debug
## basalt.debug
Something you just need as a developer, why shouldn't i publish it? This creates a label on the bottom left of your active frame, if you click on that label it will
create a fully sized frame with a list, where it logs all your debug messages
````lua
NyoUI.debug("Hi i am cute")
basalt.debug("Hi i am cute")
````
**args:** ... (multiple args are possible, like print does)<br>
**returns:**-<br>
@@ -73,9 +73,9 @@ NyoUI.debug("Hi i am cute")
If you are new to such things, you want to create your own logic (lets say for example a redstone or rednet handler) while using the NyoUI Framework, you just have to create something like this:
````lua
local NyoUI = dofile("NyoUI.lua")
local basalt = dofile("basalt.lua")
local mainFrame = NyoUI.createFrame("mainFrame"):show()-- lets create a frame and a button without functionality
local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame and a button without functionality
mainFrame:addButton("aButton"):onClick(function() end):show()
local function yourCustomHandler()
@@ -85,7 +85,7 @@ local function yourCustomHandler()
end
end
parallel.waitForAll(NyoUI.startUpdate, yourCustomHandler) -- here it will handle your function (yourCustomHandler) and NyoUIs handlers at the time
parallel.waitForAll(basalt.startUpdate, yourCustomHandler) -- here it will handle your function (yourCustomHandler) and NyoUIs handlers at the time
````
You can read [here](http://www.computercraft.info/wiki/Parallel_(API)) what exactly parallel.waitForAll() does