fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
29daa42
GUI
1local SKIN ={} 2 3SKIN . Background =color ( 240 , 240 , 240 ) 4 5SKIN . PanelBorder =color ( 165 , 165 , 165 ) 6SKIN . PanelFocused =color ( 0 , 162 , 232 ) 7 8SKIN . FrameBorder =color ( 100 , 100 , 100 ) 9SKIN . FrameControlBar =color ( 225 , 225 , 225 ) 10SKIN . FrameFocusedControlBar =color ( 0 , 162 , 232 ) 11 12SKIN . ButtonBackground =color ( 215 , 215 , 215 ) 13SKIN . ButtonDisabled =color ( 100 , 100 , 100 , 100 ) 14SKIN . ButtonPressed =color ( 153 , 217 , 234 ) 15SKIN . ButtonHover =color ( 220 , 242 , 248 ) 16 17SKIN . ButtonClosePressed =color ( 243 , 105 , 113 ) 18SKIN . ButtonCloseHover =color ( 248 , 167 , 171 ) 19 20SKIN . TextEntryBackground =color ( 255 , 255 , 255 ) 21SKIN . TextEntryFocused =color ( 0 , 162 , 232 ) 22 23SKIN . ScrollBarGrip =color ( 205 , 205 , 205 , 255 ) 24SKIN . ScrollBarGripPressed =color ( 96 , 96 , 96 , 255 ) 25SKIN . ScrollBarGripHover =color ( 166 , 166 , 166 , 255 ) 26 27function SKIN : InitPanel ( panel ) 28panel : SetBGColor ( self . Background ) 29panel : SetBorderColor ( self . PanelBorder ) 30end 31 32function SKIN : PaintPanel ( panel , w , h ) 33graphics . setColor ( panel : GetBGColor ()) 34graphics . rectangle ( "fill" , 0 , 0 , w , h ) 35 36graphics . setLineStyle ( "rough" ) 37graphics . setLineWidth ( 1 ) 38 39graphics . setColor ( panel : GetBorderColor ()) 40graphics . innerRectangle ( 0 , 0 , w , h ) 41end 42 43function SKIN : PaintFocusPanel ( panel , w , h ) 44graphics . setColor ( panel : GetBGColor ()) 45graphics . rectangle ( "fill" , 0 , 0 , w , h ) 46 47graphics . setLineStyle ( "rough" ) 48graphics . setLineWidth ( 1 ) 49 50if panel : HasFocus () then 51graphics . setColor ( self . PanelFocused ) 52graphics . innerRectangle ( 0 , 0 , w , h ) 53else 54graphics . setColor ( panel : GetBorderColor ()) 55graphics . innerRectangle ( 0 , 0 , w , h ) 56end 57end 58 59function SKIN : PaintScrollBarButtonUp ( panel , w , h ) 60self : PaintButton ( panel , w , h ) 61graphics . setColor ( 150 , 150 , 150 , 255 ) 62graphics . polygon ( 'fill' , 4 , 12 , 8 , 4 , 12 , 12 ) 63end 64 65function SKIN : PaintScrollBarButtonDown ( panel , w , h ) 66self : PaintButton ( panel , w , h ) 67graphics . setColor ( 150 , 150 , 150 , 255 ) 68graphics . polygon ( 'fill' , 4 , 4 , 12 , 4 , 8 , 12 ) 69end 70 71function SKIN : PaintScrollBarGrip ( panel , w , h ) 72local color =self . ScrollBarGrip 73if panel : IsPressed () then 74color =self . ScrollBarGripPressed 75elseif panel : IsHovered () then 76color =self . ScrollBarGripHover 77end 78graphics . setColor ( color ) 79graphics . rectangle ( "fill" , 1 , 0 , w - 2 , h ) 80end 81 82function SKIN : InitButton ( panel ) 83panel : SetBorderColor ( self . PanelBorder ) 84panel : SetPressedColor ( self . ButtonPressed ) 85panel : SetHoveredColor ( self . ButtonHover ) 86end 87 88function SKIN : InitExitButton ( panel ) 89panel : SetPressedColor ( self . ButtonClosePressed ) 90panel : SetHoveredColor ( self . ButtonCloseHover ) 91end 92 93function SKIN : PaintButton ( panel , w , h ) 94local color =self . ButtonBackground 95 96if not panel : IsEnabled () then 97color =self . ButtonDisabled 98elseif panel : IsPressed () then 99color =panel : GetPressedColor () or self . ButtonPressed 100elseif panel : IsHovered () then 101color =panel : GetHoveredColor () or self . ButtonHover 102end 103 104graphics . setColor ( color ) 105graphics . rectangle ( "fill" , 0 , 0 , w , h ) 106 107graphics . setLineStyle ( "rough" ) 108graphics . setLineWidth ( 1 ) 109 110--[[graphics.setColor(255, 255, 255, 255) 111graphics.innerRectangle(0, 1, w, h - 2)]] 112 113graphics . setColor ( panel : GetBorderColor ()) 114graphics . innerRectangle ( 0 , 0 , w , h ) 115end 116 117function SKIN : PaintFrame ( panel , w , h ) 118graphics . setColor ( unpackcolor ( self . Background )) 119graphics . rectangle ( "fill" , 0 , 0 , w , h ) 120 121graphics . setColor ( unpackcolor ( panel : HasFocus ( true ) and self . FrameFocusedControlBar or self . FrameControlBar )) 122graphics . rectangle ( "fill" , 0 , 0 , w , 32 ) 123 124graphics . setLineStyle ( "rough" ) 125graphics . setLineWidth ( 1 ) 126 127--[[graphics.setColor(255, 255, 255, 255) 128graphics.innerRectangle(0, 1, w, h - 2)]] 129 130graphics . setColor ( panel . m_cBordercolor or self . FrameBorder ) 131graphics . innerRectangle ( 0 , 0 , w , h ) 132end 133 134function SKIN : PaintTextEntry ( panel , w , h ) 135graphics . setColor ( self . TextEntryBackground ) 136graphics . rectangle ( "fill" , 0 , 0 , w , h ) 137 138graphics . setLineStyle ( "rough" ) 139graphics . setLineWidth ( 1 ) 140 141if panel : HasFocus () then 142graphics . setColor ( self . TextEntryFocused ) 143graphics . innerRectangle ( 0 , 0 , w , h ) 144else 145graphics . setColor ( panel : GetBorderColor ()) 146graphics . innerRectangle ( 0 , 0 , w , h ) 147end 148end 149 150gui . registerSkin ( "default" , SKIN )