Page 1 of 1

[Module] Custom GUI -Unofficial

Posted: 30 Jan 2021, 13:47
by ian`
This is an unofficial GUI functions that i made for other plugin creators.

How To Use
Place the module in the same folder with the main script. This module can be called by using require function like this:

Code: Select all    Reset

local funName = require('moduleName.plugin/module/moduleName.lua') -- funName can be replaced with another name you want to use. moduleName can be replaced only by the file name you download from this post.
Interactive Lua editor
Run
runText GUI
Show
This function can be used for a text that longer than the parent GUI.
running label.png
running label.png (18.99 KiB) Viewed 8392 times

Code: Select all    Reset

local runText = require('runText.plugin/module/runText.lua') -- runText(args) -- Parameters : -- args : (table) A table that contains the source, text, and optional values. -- Returns : -- (table) A table that contains the label. -- Usage : runText{ source = parent, -- Attaches the label to this object. The X, Y, Width, Height parameters will follow this object as parent. w = 128, -- Sets the width of the label. Default the width of the source. (optional) h = 26, -- Sets the height of the label. Default the height of the source. (optional) id = '$runningText', -- Id for the label. (optional) text = 'string' or function() return value end, -- A text to display. String is used for fixed values. Function is used for changeable values. color = {256,256,256}, -- (table) Sets the color of the text. Default {256,256,256} white. (optional) font = Font.DEFAULT, -- Sets the font of the text. Default Font.DEFAULT. (optional) speed = 0.5 -- Sets the speed of the text movements. Default 0.5. (optional) }
Interactive Lua editor
Run
Download :
runText.plugin
(993 Bytes) Downloaded 189 times
moveButton GUI
Show
This function can be used for create a movable button.
movable button.png
movable button.png (19.5 KiB) Viewed 8392 times

Code: Select all    Reset

local moveButton = require('moveButton.plugin/module/moveButton.lua') -- moveButton(args) -- Parameters : -- args : (table) A table that contains the button. -- Returns : -- (table) A table that represents the button. -- Usage : moveButton{ x = 30, -- Sets the x. Default 30. (optional) y = 30, -- Sets the y. Default 30. (optional) w = 0, -- Sets the width. Default 0 or same as the height. (optional) h = 26, -- Sets the height. Default 26. (optional) index = 10, -- Sets the child index of the button. Useful if a button should in the background or foreground of another GUI. Default 10. (optional) icon = Icon.OK, -- Sets the icon of the button. frameDefault = NinePatch.BUTTON, -- Sets the default frame of the button. Default NinePatch.BUTTON. (optional) frameDown = NinePatch.BUTTON, -- Sets the pressed frame of the button. Default NinePatch.BUTTON_DOWN. (optional) saveValue = function(x,y) -- A function to save the new position of x and y coordinates into storage. local storage -- the storage variable storage.x = x storage.y = y end, onClick = function() -- Will be called when the button gets clicked Debug.toast('Hello World') end }
Interactive Lua editor
Run
Download :
moveButton.plugin
(1.02 KiB) Downloaded 170 times
splitLabel GUI
Show
This function can be used for a long text that can be placed in listbox or anythings.
longtext.PNG
longtext.PNG (36.5 KiB) Viewed 8180 times

Code: Select all    Reset

local splitLabel = require('splitLabel.plugin/module/splitLabel.lua') -- splitLabel(args) -- Parameter : -- args : (table) a table that contains source, text, padding, color, and font. -- Returns : -- (table) A table that contains the long text. -- Usage : splitLabel{ source = parent, -- Attaches the label to this object. The X, Y, Width, Height parameters will follow this object as parent. text = 'string', -- A text to display. the long text will be automatically split and the total row will be calculated depends on the parent width. color = {0,0,0}, -- (table) Sets the color of the text. Default {0,0,0} black. (optional) font = Font.DEFAULT, -- Sets the font of the text. Default Font.DEFAULT. (optional) padding = {2,0,5,0} -- (table) Sets the padding (left,top,right,bottom) of the label. Default {2,0,5,0}. (optional) }
Interactive Lua editor
Run
Download :
splitLabel.plugin
(1019 Bytes) Downloaded 184 times
 ! Message from: ian`
Don't use Lua Wrapper when you using the require function, because it will occur an error. You can use this function when you are done with other stuff on your script. If you upload your plugin and it contains this module, please set the minimum version to at least 1949.
Off Topic
This module is free to use. Give me a credit in your plugins is optional, but you can benefit from doing so.

Re: Custom GUI -Unofficial

Posted: 30 Jan 2021, 13:52
by PixelDubs
Can you show me a picture before it starts using all my cache from lua?

Re: Custom GUI -Unofficial

Posted: 30 Jan 2021, 15:08
by ian`
LZS Gaming wrote:
30 Jan 2021, 13:52
Can you show me a picture before it starts using all my cache from lua?
sorry, what kind of picture? i don't understand. :bq

Re: Custom GUI -Unofficial

Posted: 30 Jan 2021, 15:32
by PixelDubs
ian` wrote:
30 Jan 2021, 15:08
LZS Gaming wrote:
30 Jan 2021, 13:52
Can you show me a picture before it starts using all my cache from lua?
sorry, what kind of picture? i don't understand. :bq
A screenshot of the plugin.

Re: Custom GUI -Unofficial

Posted: 30 Jan 2021, 17:04
by ian`
LZS Gaming wrote:
30 Jan 2021, 15:32
A screenshot of the plugin.
there is sample code in rar file. You can try it.

anyway, this is not a complete plugin. this is just a module for plugin creators who want to add features like my plugins. (e.g. shortcut box or part of the animation dev. tool). and also i post this in tutorial and documentation, not in plugin showcase. :teach :plugin

Re: Custom GUI -Unofficial

Posted: 30 Jan 2021, 20:25
by Hadestia
I'm waiting for these Awesome job ! One more thing is there any "text" Parameters for that movable button?

Re: Custom GUI -Unofficial

Posted: 31 Jan 2021, 14:00
by ian`
rjroldan1 wrote:
30 Jan 2021, 20:25
I'm waiting for these Awesome job ! One more thing is there any "text" Parameters for that movable button?
i'm not going to include any text for the movable button because i anticipate if it's too wide, it will block the screen. :calc

Re: [Module] Custom GUI -Unofficial

Posted: 28 Feb 2021, 16:33
by ian`
update : splitLabel. :bc:

Re: [Module] Custom GUI -Unofficial

Posted: 03 Mar 2021, 03:15
by Hadestia
Splitlabel require throws me an exceptions