Lua API for adding and displaying GUIs

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

Lua API for adding and displaying GUIs

by sfan5 » Sun Feb 05, 2012 19:04

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)
Last edited by sfan5 on Sun Feb 05, 2012 19:24, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Raiden
Member
 
Posts: 44
Joined: Fri Feb 03, 2012 11:14

by Raiden » Sun Feb 05, 2012 20:41

+42

Really need it!
Last edited by Raiden on Sun Feb 05, 2012 20:42, edited 1 time in total.
 

kahrl
Member
 
Posts: 236
Joined: Fri Sep 02, 2011 07:51

by kahrl » Sun Feb 05, 2012 21:22

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?
 

User avatar
Raiden
Member
 
Posts: 44
Joined: Fri Feb 03, 2012 11:14

by Raiden » Mon Feb 06, 2012 01:29

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. :)
Last edited by Raiden on Mon Feb 06, 2012 01:31, edited 1 time in total.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Mon Feb 06, 2012 06:17

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
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Raiden
Member
 
Posts: 44
Joined: Fri Feb 03, 2012 11:14

by Raiden » Mon Feb 06, 2012 06:50

 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Thu Mar 29, 2012 16:59

+2
 

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

by LorenzoVulcan » Thu Mar 29, 2012 17:00

+1
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 11 guests

cron