fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
be5d99b
settings-overhaul
1local SKIN =gui . newSkin ( "default" ) 2 3SKIN . Background =color ( 255 , 255 , 255 ) 4 5SKIN . PanelBackground =color ( 240 , 240 , 240 ) 6SKIN . PanelBorder =color ( 165 , 165 , 165 ) 7SKIN . PanelFocused =color ( 0 , 162 , 232 ) 8 9SKIN . FrameBorder =color ( 100 , 100 , 100 ) 10SKIN . FrameControlBar =color ( 225 , 225 , 225 ) 11SKIN . FrameFocusedControlBar =color ( 0 , 162 , 232 ) 12 13SKIN . ButtonBackground =color ( 215 , 215 , 215 ) 14SKIN . ButtonDisabled =color ( 100 , 100 , 100 , 100 ) 15SKIN . ButtonPressed =color ( 153 , 217 , 234 ) 16SKIN . ButtonHover =color ( 220 , 242 , 248 ) 17 18SKIN . ButtonClosePressed =color ( 243 , 105 , 113 ) 19SKIN . ButtonCloseHover =color ( 248 , 167 , 171 ) 20 21SKIN . TextEntryBackground =color ( 255 , 255 , 255 ) 22SKIN . TextEntryFocused =color ( 0 , 162 , 232 ) 23 24SKIN . ScrollBarGrip =color ( 205 , 205 , 205 , 255 ) 25SKIN . ScrollBarGripPressed =color ( 96 , 96 , 96 , 255 ) 26SKIN . ScrollBarGripHover =color ( 166 , 166 , 166 , 255 ) 27 28SKIN . CheckboxBorder =color ( 100 , 100 , 100 ) 29SKIN . CheckboxOff =color ( 200 , 200 , 200 ) 30SKIN . CheckboxOn =color ( 0 , 162 , 232 ) 31 32SKIN . TabActiveColor =color ( 0 , 0 , 0 , 75 ) 33 34SKIN . CheckImage =graphics . newImage ( "textures/gui/checkmark.png" ) 35 36function SKIN : InitPanel ( panel ) 37panel : SetBGColor ( self . PanelBackground ) 38panel : SetBorderColor ( self . PanelBorder ) 39end 40 41function SKIN : PaintPanel ( panel , w , h ) 42graphics . setColor ( panel : GetBGColor ()) 43graphics . rectangle ( "fill" , 0 , 0 , w , h ) 44end 45 46function SKIN : PaintOverlayPanel ( panel , w , h ) 47graphics . setLineStyle ( "rough" ) 48graphics . setLineWidth ( 1 ) 49 50graphics . setColor ( panel : GetBorderColor ()) 51graphics . innerRectangle ( 0 , 0 , w , h ) 52end 53 54function SKIN : PaintSlider ( panel , w , h ) 55graphics . setColor ( self . Background ) 56graphics . rectangle ( "fill" , 0 , 0 , w , h ) 57 58graphics . setLineStyle ( "rough" ) 59graphics . setLineWidth ( 1 ) 60 61graphics . setColor ( panel : GetBorderColor ()) 62graphics . innerRectangle ( 0 , 0 , w , h ) 63end 64 65function SKIN : PaintOverlayFocusPanel ( panel , w , h ) 66graphics . setLineStyle ( "rough" ) 67graphics . setLineWidth ( 1 ) 68 69if panel : IsEnabled () and panel : HasFocus () then 70graphics . setColor ( self . PanelFocused ) 71graphics . innerRectangle ( 0 , 0 , w , h ) 72else 73graphics . setColor ( panel : GetBorderColor ()) 74graphics . innerRectangle ( 0 , 0 , w , h ) 75end 76end 77 78function SKIN : PaintScrollBarButtonUp ( panel , w , h ) 79self : PaintButton ( panel , w , h ) 80graphics . setColor ( 150 , 150 , 150 , 255 ) 81graphics . polygon ( 'fill' , 4 , 12 , 8 , 4 , 12 , 12 ) 82end 83 84function SKIN : PaintScrollBarButtonDown ( panel , w , h ) 85self : PaintButton ( panel , w , h ) 86graphics . setColor ( 150 , 150 , 150 , 255 ) 87graphics . polygon ( 'fill' , 4 , 4 , 12 , 4 , 8 , 12 ) 88end 89 90function SKIN : PaintScrollBarGrip ( panel , w , h ) 91local color =self . ScrollBarGrip 92if panel : IsPressed () then 93color =self . ScrollBarGripPressed 94elseif panel : IsHovered () then 95color =self . ScrollBarGripHover 96end 97graphics . setColor ( color ) 98graphics . rectangle ( "fill" , 1 , 0 , w - 2 , h ) 99end 100 101function SKIN : InitButton ( panel ) 102panel : SetBGColor ( self . ButtonBackground ) 103panel : SetBorderColor ( self . PanelBorder ) 104panel : SetPressedColor ( self . ButtonPressed ) 105panel : SetHoveredColor ( self . ButtonHover ) 106end 107 108function SKIN : InitExitButton ( panel ) 109panel : SetPressedColor ( self . ButtonClosePressed ) 110panel : SetHoveredColor ( self . ButtonCloseHover ) 111end 112 113function SKIN : PaintButton ( panel , w , h ) 114local color =self . ButtonBackground 115 116if panel : IsPressed () then 117color =panel : GetPressedColor () or self . ButtonPressed 118elseif panel : IsHovered () then 119color =panel : GetHoveredColor () or self . ButtonHover 120end 121 122graphics . setColor ( color ) 123graphics . rectangle ( "fill" , 0 , 0 , w , h ) 124 125graphics . setLineStyle ( "rough" ) 126graphics . setLineWidth ( 1 ) 127 128graphics . setColor ( panel : GetBorderColor () or self . PanelBorder ) 129graphics . innerRectangle ( 0 , 0 , w , h ) 130end 131 132function SKIN : PaintTab ( panel , w , h ) 133local color =self . ButtonBackground 134 135if panel : IsPressed () then 136color =panel : GetPressedColor () or self . ButtonPressed 137elseif panel : IsHovered () then 138color =panel : GetHoveredColor () or self . ButtonHover 139end 140 141graphics . setColor ( color ) 142graphics . roundRect ( 0 , 0 , w , h + 8 , 8 ) 143 144if panel : IsActive () then 145graphics . setColor ( panel : GetActiveColor () or self . TabActiveColor ) 146graphics . roundRect ( 0 , 0 , w , h + 8 , 8 ) 147end 148end 149 150function SKIN : PaintOverlayButton ( panel , w , h ) 151if not panel : IsEnabled () then 152graphics . setColor ( self . ButtonDisabled ) 153graphics . rectangle ( "fill" , 0 , 0 , w , h ) 154end 155end 156 157function SKIN : PaintFrame ( panel , w , h ) 158graphics . setColor ( self . Background ) 159graphics . rectangle ( "fill" , 0 , 0 , w , h ) 160 161graphics . setColor ( panel : HasFocus ( true ) and self . FrameFocusedControlBar or self . FrameControlBar ) 162graphics . rectangle ( "fill" , 0 , 0 , w , 32 ) 163 164graphics . setLineStyle ( "rough" ) 165graphics . setLineWidth ( 1 ) 166 167--[[graphics.setColor(255, 255, 255, 255) 168graphics.innerRectangle(0, 1, w, h - 2)]] 169 170graphics . setColor ( panel . m_cBordercolor or self . FrameBorder ) 171graphics . innerRectangle ( 0 , 0 , w , h ) 172end 173 174function SKIN : PaintTextEntry ( panel , w , h ) 175graphics . setColor ( self . TextEntryBackground ) 176graphics . rectangle ( "fill" , 0 , 0 , w , h ) 177 178graphics . setLineStyle ( "rough" ) 179graphics . setLineWidth ( 1 ) 180 181if panel : HasFocus () then 182graphics . setColor ( self . TextEntryFocused ) 183graphics . innerRectangle ( 0 , 0 , w , h ) 184else 185graphics . setColor ( panel : GetBorderColor ()) 186graphics . innerRectangle ( 0 , 0 , w , h ) 187end 188end 189 190function SKIN : PaintCheckbox ( panel , w , h ) 191graphics . setColor ( panel : IsToggled () and self . CheckboxOn or self . CheckboxOff ) 192graphics . rectangle ( "fill" , 4 , 4 , h - 8 , h - 8 ) 193 194if panel : IsToggled () then 195graphics . setColor ( 255 , 255 , 255 , 255 ) 196graphics . easyDraw ( self . CheckImage , 4 , 4 , 0 , h - 8 , h - 8 ) 197end 198 199graphics . setLineStyle ( "rough" ) 200graphics . setLineWidth ( 1 ) 201 202graphics . setColor ( self . CheckboxBorder ) 203graphics . rectangle ( "line" , 4 , 4 , h - 8 , h - 8 ) 204end 205 206function SKIN : PaintRadio ( panel , w , h ) 207graphics . setColor ( panel : IsToggled () and self . CheckboxOn or self . CheckboxOff ) 208graphics . circle ( "fill" , 12 , 12 , h / 2 - 8 , 32 ) 209 210graphics . setLineStyle ( "smooth" ) 211graphics . setLineWidth ( 1 ) 212 213graphics . setColor ( self . CheckboxBorder ) 214graphics . circle ( "line" , 12 , 12 , h / 2 - 8 , 32 ) 215end 216 217function SKIN : InitHorizontalSelect ( panel ) 218panel : SetBGColor ( self . PanelBackground ) 219panel : SetBorderColor ( self . PanelBorder ) 220end