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: Now you are able to call all these functions:
## NyoUI.createFrame ## basalt.createFrame
create a frame without a parent create a frame without a parent
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
```` ````
**args:** the id as string<br> **args:** the id as string<br>
**returns:** frame object<br> **returns:** frame object<br>
## NyoUI.removeFrame ## basalt.removeFrame
removes the frame removes the frame
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
NyoUI.removeFrame("myFirstFrame") NyoUI.removeFrame("myFirstFrame")
```` ````
**args:** the id as string<br> **args:** the id as string<br>
**returns:**-<br> **returns:**-<br>
## NyoUI.getFrame ## basalt.getFrame
With that function you can get frames, but only frames without a parent! With that function you can get frames, but only frames without a parent!
````lua ````lua
NyoUI.createFrame("myFirstFrame") basalt.createFrame("myFirstFrame")
NyoUI.getFrame("myFirstFrame"):show() basalt.getFrame("myFirstFrame"):show()
```` ````
**args:** id of the frame<br> **args:** id of the frame<br>
**returns:** frame object<br> **returns:** frame object<br>
## NyoUI.getActiveFrame ## basalt.getActiveFrame
returns the currently active (without a parent) frame returns the currently active (without a parent) frame
````lua ````lua
NyoUI.createFrame("myFirstFrame"):show() basalt.createFrame("myFirstFrame"):show()
NyoUI.debug(NyoUI.getActiveFrame():getName()) -- returns myFirstFrame basalt.debug(basalt.getActiveFrame():getName()) -- returns myFirstFrame
```` ````
**args:** -<br> **args:** -<br>
**returns:** frame object<br> **returns:** frame object<br>
## NyoUI.startUpdate ## basalt.startUpdate
starts the logic, draw and event handler starts the logic, draw and event handler
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
NyoUI.startUpdate() basalt.startUpdate()
```` ````
**args:** -<br> **args:** -<br>
**returns:**-<br> **returns:**-<br>
## NyoUI.stopUpdate ## basalt.stopUpdate
stops the logic, draw and event handler stops the logic, draw and event handler
````lua ````lua
NyoUI.stopUpdate() basalt.stopUpdate()
```` ````
**args:** -<br> **args:** -<br>
**returns:**-<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 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 create a fully sized frame with a list, where it logs all your debug messages
````lua ````lua
NyoUI.debug("Hi i am cute") basalt.debug("Hi i am cute")
```` ````
**args:** ... (multiple args are possible, like print does)<br> **args:** ... (multiple args are possible, like print does)<br>
**returns:**-<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: 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 ````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() mainFrame:addButton("aButton"):onClick(function() end):show()
local function yourCustomHandler() local function yourCustomHandler()
@@ -85,7 +85,7 @@ local function yourCustomHandler()
end end
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 You can read [here](http://www.computercraft.info/wiki/Parallel_(API)) what exactly parallel.waitForAll() does