• Menus with items
    9 replies, posted
How do I create menus with items like these images: [IMG]http://cloud-2.steampowered.com/ugc/794065437293123300/4CF058320586A524AF72503706CA6677FDB4E2C1/[/IMG] [IMG]http://cloud-4.steampowered.com/ugc/794065437293131247/0478F8714A15D0C136699B756F4E5E944FA683E6/[/IMG] [IMG]http://puu.sh/1AAxv[/IMG]
[url=http://wiki.garrysmod.com/page/VGUI/Elements/SpawnIcon]This wiki page[/url] is what you're looking for.
[QUOTE=KingofBeast;44433198][url=http://wiki.garrysmod.com/page/VGUI/Elements/SpawnIcon]This wiki page[/url] is what you're looking for.[/QUOTE] Thanks. I feel kind of stupid, but how do I create the items into the menu as organized way as the images? Sorry my bad English.
I think you're looking for : DPropertySheet You add sheets to it, ie tabs: Panel:AddSheet( "Title Of Tab", ReferenceToPanelContainedInThisTab, "gui/silkicons/add", false, false, "" );
[QUOTE=Acecool;44435953]I think you're looking for : DPropertySheet You add sheets to it, ie tabs: Panel:AddSheet( "Title Of Tab", ReferenceToPanelContainedInThisTab, "gui/silkicons/add", false, false, "" );[/QUOTE] Sorry if I expressed myself wrong, I'm talking of items from the store and not the tab s But thanks for your help and time.
Oh nice, the first two pictures are from my gamemode... Anyway, this icons are DModelPanels with some layers of text and color. I guess you want to see something like this: [CODE] local Icon = vgui.Create( "DModelPanel", Menu) Icon:SetModel(Model) Icon:SetPos( pos1, pos2 ) Icon:SetSize(size,size) Icon.PaintOver = function() //Name draw.RoundedBox(2, 2, size-17, size-4, 15,Color(0,0,0,150)) draw.DrawText(Name, "font_12", size/2, size-15, Color(0,0,0,255),TEXT_ALIGN_CENTER) end [/CODE] Sorry, but im too lazy now, to write more. lol.
[QUOTE=.delay;44443991]Oh nice, the first two pictures are from my gamemode... Anyway, this icons are DModelPanels with some layers of text and color. I guess you want to see something like this: [CODE] local Icon = vgui.Create( "DModelPanel", Menu) Icon:SetModel(Model) Icon:SetPos( pos1, pos2 ) Icon:SetSize(size,size) Icon.PaintOver = function() //Name draw.RoundedBox(2, 2, size-17, size-4, 15,Color(0,0,0,150)) draw.DrawText(Name, "font_12", size/2, size-15, Color(0,0,0,255),TEXT_ALIGN_CENTER) end [/CODE] Sorry, but im too lazy now, to write more. lol.[/QUOTE] Thank you, but I have some questions: How do you set the positions of each item (I think it was not manually '-')?
[QUOTE=HunterFP;44451241]Thank you, but I have some questions: How do you set the positions of each item (I think it was not manually '-')?[/QUOTE] Personally I would use a for loop and change the pos1/pos2 values accordingly. SO basically something like this near the bottom of the loop: [lua] pos1 = pos1 + 20 if pos1 >= 50 then pos1 = 0 pos2 = pos2 + 20 end [/lua] Those values are not right. You will need to experiment to make it fit the panel you are messing with.
I'm busy, my server needs help after the update, but i think this will help :P [CODE] local icon_size = 92 local iy = 0 local ix = 0 for k, ent in SortedPairsByMemberValue( items, "order" ) do AddShopIcon(ent args lol, icon_size*ix, icon_size*iy) ix = ix + 1 end [/CODE]
[QUOTE=bran92don;44451387]Personally I would use a for loop and change the pos1/pos2 values accordingly. SO basically something like this near the bottom of the loop: [lua] pos1 = pos1 + 20 if pos1 >= 50 then pos1 = 0 pos2 = pos2 + 20 end [/lua] Those values are not right. You will need to experiment to make it fit the panel you are messing with.[/QUOTE] [QUOTE=.delay;44451410]I'm busy, my server needs help after the update, but i think this will help :P [CODE] local icon_size = 92 local iy = 0 local ix = 0 for k, ent in SortedPairsByMemberValue( items, "order" ) do AddShopIcon(ent args lol, icon_size*ix, icon_size*iy) ix = ix + 1 end [/CODE][/QUOTE] Thanks, i will try C:
Sorry, you need to Log In to post a reply to this thread.