fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
be5d99b
settings-overhaul
1local PANEL =class . create ( "Button" , "Label" ) 2 3PANEL : ACCESSOR ( "DrawLabel" , "m_bDrawLabel" , true ) 4PANEL : ACCESSOR ( "PressedColor" , "m_cPressedColor" ) 5PANEL : ACCESSOR ( "HoveredColor" , "m_cHoveredColor" ) 6PANEL : ACCESSOR ( "DrawButton" , "m_bDrawButton" , true ) 7 8function PANEL : Button () 9-- Initialize our baseclass 10self : super () 11 12self : SetFocusable ( true ) 13 14self : SetTextAlignment ( "center" ) 15self : SetText ( "Button" ) 16 17gui . skinHook ( "Init" , "Button" , self ) 18end 19 20function PANEL : Paint ( w , h ) 21if self . m_bDrawButton then 22gui . skinHook ( "Paint" , "Button" , self , w , h ) 23end 24if self . m_bDrawLabel then 25self : super ( "Paint" , w , h ) 26end 27end 28 29function PANEL : PaintOverlay ( w , h ) 30gui . skinHook ( "PaintOverlay" , "Button" , self , w , h ) 31end 32 33function PANEL : IsPressed () 34return self . m_bPressed and self : IsHovered () 35end 36 37function PANEL : OnMousePressed ( x , y , but ) 38if not self . m_bEnabled or but ~= 1 then return end 39self . m_bPressed =true 40return true 41end 42 43function PANEL : OnMouseReleased ( x , y , but ) 44if not self . m_bEnabled or but ~= 1 then return end 45self . m_bPressed =false 46if self : IsHovered () then 47self : OnClick () 48end 49end 50 51function PANEL : OnClick () 52-- Override 53end