Page 1 of 1

GUI example in Plugin Creator Tools

Posted: 28 Aug 2020, 21:34
by Lobby
image.png
The Plugin Creator Tool contains an example to present the GUI creation possibilities of using Lua in plugins.


image.png
Actually useful is this window that shows the Icon, Font and NinePatch resources that are available within the game. A tap on the "copy" button copies the code used to access something into the clipboard, e.g. "Icon.OK" for the ok icon.



Here you can see how various aspects of this tool were implemented :lua: :

Code: Select all    Reset

-- Show the menu with the close action closing the provided dialog
local function showMenu(dialog)
local parent = GUI.get'$menuparent'
GUI.createMenu{
source = parent,
actions = {
{icon = Icon.OK, text = 'A', onClick = function() Debug.toast('yo') end},
{icon = Icon.CANCEL, text = 'B', enabled = false},
{},
{icon = Icon.CLOSE, text = 'Close', onClick = dialog.close}
}
}
end
-- Show the dialog window that contains various GUI object usage examples
local function showObjectsDialog()
local dialog = GUI.createDialog{
icon = Icon.REGION_SPLIT,
title = 'Objects',
height = 240
}
local layout = dialog.content:addLayout{
vertical = true
}
local function addLine(label, height)
local line = layout:addLayout{height = height}
line:addLabel{text = label, w = 60}
return line:addLayout{ x = 62 }
end
local sliderValue = 0.5
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Lua editor

Output: Select all

...


Here the plugin is of type tool and uses real-time scripting for testing purposes :json :

Code: Select all    Reset

[{
"once":true,
"id":"$devtool_showguiexample00",
"type":"tool",
"category":"$devtool_category00",
"preview frames":[{"bmp":"guiicon.png"}],
"title":"GUI preview",
"text":"This tool provides an example for what can be done in regard to UI using Lua.",
"script":"#LuaWrapper",
"meta":{
"luawrapper":{
"script":"GUIExample.lua",
"dev":true
}
}
}]
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
JSON checker

Output: Select all

...

Re: GUI example in Plugin Creator Tools

Posted: 29 Aug 2020, 02:14
by MarioBitMap
AMAZING!! I'd love trying to do a plug-in with some menus when I learn a little bit of complex Lua. :teach

Re: GUI example in Plugin Creator Tools

Posted: 17 Oct 2020, 20:48
by Hadestia
Can we use gui on building taps? As substitute to the onClick notif or its info itself