diff --git a/NyoUI.md b/NyoUI.md index 095e72c..462d0d8 100644 --- a/NyoUI.md +++ b/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
+**returns:** frame object
+ +## NyoUI.removeFrame +removes the frame +````lua +local mainFrame = NyoUI.createFrame("myFirstFrame"):show() +NyoUI.removeFrame("myFirstFrame") +```` +**args:** the id as string
+**returns:**-
+ +## 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
+**returns:** frame object
+ +## NyoUI.getActiveFrame +returns the currently active (without a parent) frame +````lua +NyoUI.createFrame("myFirstFrame"):show() +NyoUI.debug(NyoUI.getActiveFrame():getName()) -- returns myFirstFrame +```` +**args:** -
+**returns:** frame object
+ +## NyoUI.startUpdate +starts the logic, draw and event handler +````lua +local mainFrame = NyoUI.createFrame("myFirstFrame"):show() +NyoUI.startUpdate() +```` +**args:** -
+**returns:**-
+ +## NyoUI.stopUpdate +stops the logic, draw and event handler +````lua +NyoUI.stopUpdate() +```` +**args:** -
+**returns:**-
+ +## 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
+**returns:**-
+ +# 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 +```` \ No newline at end of file