Page 1 of 1

Lua API for adding and displaying GUIs

PostPosted: Sun Feb 05, 2012 19:04
by sfan5
There should be an API for adding,displaying and modifying GUIs
Something like:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_gui({
    objects: {
        {GUI_LABEL,name="label1",x=5,y=23,width=5,height=10,text="Label"}
        {GUI_BUTTON,name="button1",x=15,y=23,width=5,height=4,text="Button",action_click = (function(gui)
            minetest.gui:get_gui("gui1").label1.text = "Hello World!"
        end)
        {GUI_BUTTON,name="button2",x=25,y=23,width=5,height=4,text="Exit",action_click = (function(gui)
            minetest.gui:hide("gui1")
        end)
        {GUI_SPRITE,name="bg",x=0,y=0,image="background.png"}
    }
    name: "gui1"
})

minetest.register_on_punchnode(function(node, puncher)
    if node.name == "hw:hello_world" then
        minetest.gui:show("gui1")
    end
end)

PostPosted: Sun Feb 05, 2012 20:41
by Raiden
+42

Really need it!

PostPosted: Sun Feb 05, 2012 21:22
by kahrl
Making this is not easy. Could you (and other modders) make a list of widgets / features you really need, and perhaps additional features that would be useful?

PostPosted: Mon Feb 06, 2012 01:29
by Raiden
For now just basic things:

  • tab (focus/unfocused)
  • button (active/passive)
  • text field
  • checkbox (on/off)
  • dialog

I'm not sure if we need gauge for sound level because i think we can make it with button (active/passive).


In the future:
  • color picker (to modify text colors in chat)
  • a real gauge (to modify opacity of the HUD)
  • a table list with clickable elements to list mods already installed. (with delete/update button)
  • tooltips

I haven't any other idea now. :)

PostPosted: Mon Feb 06, 2012 06:17
by sfan5
Needed:
  • Button
  • Label
  • Sprite (for Background Images)
  • Text Box
  • Checkbox
  • Inventory Field
  • action_open (for loading Metadata)
  • action_close (for saving Metadata)
Maybe:
  • A function which adds the default Inventory Slots to the GUI

PostPosted: Mon Feb 06, 2012 06:50
by Raiden

PostPosted: Thu Mar 29, 2012 16:59
by bgsmithjr
+2

PostPosted: Thu Mar 29, 2012 17:00
by LorenzoVulcan
+1