HEy guys.
I saw a few people customising the scrool bar that u guy with the vgui menu.
this one:
[url]http://puu.sh/bqwKa/95f87709ef.jpg[/url]
How would i be able to do that?
Take a look at the default skin:
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/vgui/default_skin.lua.html[/url]
You can take little pieces here and there and turn it into your own skin. Look at these portions:
[code]SKIN.tex.Scroller = {}
SKIN.tex.Scroller.TrackV = GWEN.CreateTextureBorder( 384, 208, 15, 127, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonV_Normal = GWEN.CreateTextureBorder( 384 + 16, 208, 15, 127, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonV_Hover = GWEN.CreateTextureBorder( 384 + 32, 208, 15, 127, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonV_Down = GWEN.CreateTextureBorder( 384 + 48, 208, 15, 127, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonV_Disabled = GWEN.CreateTextureBorder( 384 + 64, 208, 15, 127, 4, 4, 4, 4 );
SKIN.tex.Scroller.TrackH = GWEN.CreateTextureBorder( 384, 128, 127, 15, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonH_Normal = GWEN.CreateTextureBorder( 384, 128 + 16, 127, 15, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonH_Hover = GWEN.CreateTextureBorder( 384, 128 + 32, 127, 15, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonH_Down = GWEN.CreateTextureBorder( 384, 128 + 48, 127, 15, 4, 4, 4, 4 );
SKIN.tex.Scroller.ButtonH_Disabled = GWEN.CreateTextureBorder( 384, 128 + 64, 127, 15, 4, 4, 4, 4 );
SKIN.tex.Scroller.LeftButton_Normal = GWEN.CreateTextureBorder( 464, 208, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.LeftButton_Hover = GWEN.CreateTextureBorder( 480, 208, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.LeftButton_Down = GWEN.CreateTextureBorder( 464, 272, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.LeftButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.UpButton_Normal = GWEN.CreateTextureBorder( 464, 208 + 16, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.UpButton_Hover = GWEN.CreateTextureBorder( 480, 208 + 16, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.UpButton_Down = GWEN.CreateTextureBorder( 464, 272 + 16, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.UpButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272 + 16, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.RightButton_Normal = GWEN.CreateTextureBorder( 464, 208 + 32, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.RightButton_Hover = GWEN.CreateTextureBorder( 480, 208 + 32, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.RightButton_Down = GWEN.CreateTextureBorder( 464, 272 + 32, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.RightButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272 + 32, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.DownButton_Normal = GWEN.CreateTextureBorder( 464, 208 + 48, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.DownButton_Hover = GWEN.CreateTextureBorder( 480, 208 + 48, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.DownButton_Down = GWEN.CreateTextureBorder( 464, 272 + 48, 15, 15, 2, 2, 2, 2 );
SKIN.tex.Scroller.DownButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272 + 48, 15, 15, 2, 2, 2, 2 );
--[[---------------------------------------------------------
VScrollBar
-----------------------------------------------------------]]
function SKIN:PaintVScrollBar( panel, w, h )
self.tex.Scroller.TrackV( 0, 0, w, h );
end
--[[---------------------------------------------------------
ScrollBarGrip
-----------------------------------------------------------]]
function SKIN:PaintScrollBarGrip( panel, w, h )
if ( panel:GetDisabled() ) then
return self.tex.Scroller.ButtonV_Disabled( 0, 0, w, h );
end
if ( panel.Depressed ) then
return self.tex.Scroller.ButtonV_Down( 0, 0, w, h );
end
if ( panel.Hovered ) then
return self.tex.Scroller.ButtonV_Hover( 0, 0, w, h );
end
return self.tex.Scroller.ButtonV_Normal( 0, 0, w, h );
end
--[[---------------------------------------------------------
ButtonDown
-----------------------------------------------------------]]
function SKIN:PaintButtonDown( panel, w, h )
if ( !panel.m_bBackground ) then return end
if ( panel.Depressed || panel:IsSelected() ) then
return self.tex.Scroller.DownButton_Down( 0, 0, w, h );
end
if ( panel:GetDisabled() ) then
return self.tex.Scroller.DownButton_Dead( 0, 0, w, h );
end
if ( panel.Hovered ) then
return self.tex.Scroller.DownButton_Hover( 0, 0, w, h );
end
self.tex.Scroller.DownButton_Normal( 0, 0, w, h );
end
--[[---------------------------------------------------------
ButtonUp
-----------------------------------------------------------]]
function SKIN:PaintButtonUp( panel, w, h )
if ( !panel.m_bBackground ) then return end
if ( panel.Depressed || panel:IsSelected() ) then
return self.tex.Scroller.UpButton_Down( 0, 0, w, h );
end
if ( panel:GetDisabled() ) then
return self.tex.Scroller.UpButton_Dead( 0, 0, w, h );
end
if ( panel.Hovered ) then
return self.tex.Scroller.UpButton_Hover( 0, 0, w, h );
end
self.tex.Scroller.UpButton_Normal( 0, 0, w, h );
end
--[[---------------------------------------------------------
ButtonLeft
-----------------------------------------------------------]]
function SKIN:PaintButtonLeft( panel, w, h )
if ( !panel.m_bBackground ) then return end
if ( panel.Depressed || panel:IsSelected() ) then
return self.tex.Scroller.LeftButton_Down( 0, 0, w, h );
end
if ( panel:GetDisabled() ) then
return self.tex.Scroller.LeftButton_Dead( 0, 0, w, h );
end
if ( panel.Hovered ) then
return self.tex.Scroller.LeftButton_Hover( 0, 0, w, h );
end
self.tex.Scroller.LeftButton_Normal( 0, 0, w, h );
end
--[[---------------------------------------------------------
ButtonRight
-----------------------------------------------------------]]
function SKIN:PaintButtonRight( panel, w, h )
if ( !panel.m_bBackground ) then return end
if ( panel.Depressed || panel:IsSelected() ) then
return self.tex.Scroller.RightButton_Down( 0, 0, w, h );
end
if ( panel:GetDisabled() ) then
return self.tex.Scroller.RightButton_Dead( 0, 0, w, h );
end
if ( panel.Hovered ) then
return self.tex.Scroller.RightButton_Hover( 0, 0, w, h );
end
self.tex.Scroller.RightButton_Normal( 0, 0, w, h );
end[/code]
And to define your skin, change the name and use the table; default should be implied so you can take just the above portion and make a skin out of that:
[code]derma.DefineSkin( "Default", "Made to look like regular VGUI", SKIN )[/code]
Use Panel:SetSkin( "YourSkinName" ); to apply it.
Unfortunately I don't think there's any documentation on any function shown there.
I don't even know what they do or how to use them.
There is one on GWEN; I believe it is many images in one.. Notice how some arguments keeps adding 16? Seems to be how it is grabbing the textures from the image.
[url]http://wiki.garrysmod.com/page/Category:GWEN[/url]
[url]http://wiki.garrysmod.com/page/GWEN/CreateTextureBorder[/url] -- Used in derma skins to create a bordered rectangle drawing function from an image. The texture is taken from SKIN.GwenTexture -- Confirmed.
So, all of the GWEN functions essentially tell the skinning system how to pull a particular texture out of a bitmap. The other methods below; the GWEN system must have __call set to a draw function... So the functions are then using the return value from the GWEN functions to paint that texture somewhere on the element in question. The __call must be startX, startY, endX || width, endY || height which is why all of them use 0, 0, w, h.
Hopefully that helps clarify some of that; Since there are no associated colors, they must all be in the texture/bitmap.
Here's more information: [url]http://garry.tv/2011/08/28/gwen-skins-pixel-reading/[/url]
[url]http://code.google.com/p/gwen/source/browse/trunk/trunk/gwen/skins/DefaultSkin.psd[/url]
[url]http://dl.dropbox.com/u/3590255/Bits/GwenTest.zip[/url]
Sorry, you need to Log In to post a reply to this thread.