• How do I set a derma skin?
    3 replies, posted
(NOTE: I'm new to VGUI creation) So, how would I set a derma menu's skin to a black colour, instead of the default grey? I've tried to look up tutorials but I've found nothing. Also, how would I make a button that uses a .jpg file instead of a simple light grey button skin? I'm probably going to get boxes for asking this stuff, but I want to make a presentable, good-looking derma menu for a gamemode I'm making.
[lua]function MyDermaPanel:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 255)); end[/lua]
What would I replace "MyDermaPanel" with? Well, for my code, I'm using [lua]local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( 50,50 ) DermaPanel:SetSize( 200, 400 ) DermaPanel:SetTitle( "Class Selection" ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( true ) DermaPanel:SetDeleteOnClose( false ) DermaPanel:Hide() local DermaButton = vgui.Create( "DButton", DermaPanel ) DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel" DermaButton:SetText( "Change to the Rifleman" ) DermaButton:SetPos( 25, 50 ) DermaButton:SetSize( 150, 50 ) DermaButton.DoClick = function() RunConsoleCommand( "player_riflemanchange" ) end DermaPanel.OnClose = function() gui.EnableScreenClicker(false) end function GM:PlayerBindPress( ply, bind, pressed ) MsgN(bind) if LocalPlayer() then if ( string.find( bind, "menu_context" ) ) then print(pressed) if pressed then DermaPanel:Show() gui.EnableScreenClicker(true) else DermaPanel:Hide() gui.EnableScreenClicker(false) end end end end [/lua]
[lua]function DermaPanel:Paint(w, h) // just replace DermaPanel with whatever vgui you wanna paint draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 255)); end[/lua] You can also paint your buttons this way, and use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/TexturedQuad]draw.TexturedQuad[/url] to draw an image instead of a RoundedBox.
Sorry, you need to Log In to post a reply to this thread.