Updated NyoUI (markdown)
82
NyoUI.md
82
NyoUI.md
@@ -6,3 +6,85 @@ To start using NyoUI you have to do the following line of code:
|
||||
|
||||
remember you need the NyoUI.lua file on your computer!
|
||||
|
||||
Now you are able to call all these functions:
|
||||
|
||||
## NyoUI.createFrame
|
||||
create a frame without a parent
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
````
|
||||
**args:** the id as string<br>
|
||||
**returns:** frame object<br>
|
||||
|
||||
## NyoUI.removeFrame
|
||||
removes the frame
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
NyoUI.removeFrame("myFirstFrame")
|
||||
````
|
||||
**args:** the id as string<br>
|
||||
**returns:**-<br>
|
||||
|
||||
## NyoUI.getFrame
|
||||
With that function you can get frames, but only frames without a parent!
|
||||
````lua
|
||||
NyoUI.createFrame("myFirstFrame")
|
||||
NyoUI.getFrame("myFirstFrame"):show()
|
||||
````
|
||||
**args:** id of the frame<br>
|
||||
**returns:** frame object<br>
|
||||
|
||||
## NyoUI.getActiveFrame
|
||||
returns the currently active (without a parent) frame
|
||||
````lua
|
||||
NyoUI.createFrame("myFirstFrame"):show()
|
||||
NyoUI.debug(NyoUI.getActiveFrame():getName()) -- returns myFirstFrame
|
||||
````
|
||||
**args:** -<br>
|
||||
**returns:** frame object<br>
|
||||
|
||||
## NyoUI.startUpdate
|
||||
starts the logic, draw and event handler
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
NyoUI.startUpdate()
|
||||
````
|
||||
**args:** -<br>
|
||||
**returns:**-<br>
|
||||
|
||||
## NyoUI.stopUpdate
|
||||
stops the logic, draw and event handler
|
||||
````lua
|
||||
NyoUI.stopUpdate()
|
||||
````
|
||||
**args:** -<br>
|
||||
**returns:**-<br>
|
||||
|
||||
## NyoUI.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")
|
||||
````
|
||||
**args:** ... (multiple args are possible, like print does<br>
|
||||
**returns:**-<br>
|
||||
|
||||
# Additional informations
|
||||
## For beginners:
|
||||
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 my UI Framework, you just have to create something like this:
|
||||
|
||||
````lua
|
||||
local NyoUI = dofile("NyoUI.lua")
|
||||
|
||||
local mainFrame = NyoUI.createFrame("mainFrame"):show()-- lets create a frame and a button without functionality
|
||||
mainFrame:addButton("aButton"):onClick(function() end):show()
|
||||
|
||||
local function yourCustomHandler()
|
||||
while true do
|
||||
-- add your logic here
|
||||
os.sleep(1) -- you need something which calls coroutine.yield(), yes os.sleep does that os.pullEvent() aswell
|
||||
end
|
||||
end
|
||||
|
||||
parallel.waitForAll(NyoUI.startUpdate, yourCustomHandler) -- here it will handle your function (yourCustomHandler) and NyoUIs handlers at the "almost same" time
|
||||
````
|
||||
Reference in New Issue
Block a user