fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
7d480fc
v2.1.6
1local PANEL =class . create ( "PortSelect" , "Panel" ) 2 3PANEL : ACCESSOR ( "Port" , "m_iPort" , 1 ) 4 5local overlay =require ( "overlay" ) 6 7function PANEL : PortSelect () 8self : super () -- Initialize our baseclass 9 10self : DockPadding ( 1 , 1 , 1 , 1 ) 11self : SetBorderColor ( color_clear ) 12self : SetBackgroundColor ( color ( 0 , 0 , 0 , 200 )) 13 14local LABEL =self : Add ( "Label" ) 15LABEL : SetText ( "Ports" ) 16LABEL : SetTextAlignmentX ( "center" ) 17LABEL : SizeToText () 18LABEL : Dock ( DOCK_TOP ) 19LABEL : SetTextColor ( color_white ) 20LABEL : SetShadowDistance ( 1 ) 21LABEL : SetShadowColor ( color_black ) 22LABEL : SetFont ( "fonts/melee-bold.otf" , 12 ) 23self . LABEL =LABEL 24 25self : SetSize ( 80 , 106 + LABEL : GetHeight () + 4 ) 26self : CenterVertical () 27 28self . PORT_BUTTONS ={} 29 30for i =1 , 4 do 31local but =self : Add ( "RadioBox" ) 32but : SetText ( "Port " .. i ) 33but : DockMargin ( 1 , 1 , 1 , 1 ) 34but : Dock ( DOCK_TOP ) 35but : SetToggled ( false ) 36 37but . OnClick =function () 38overlay . showPort ( 1 ) 39self : ChangePort ( i ) 40end 41 42self . PORT_BUTTONS [ i ] =but 43end 44end 45 46function PANEL : ChangePort ( port ) 47for i =1 , 4 do 48self . PORT_BUTTONS [ i ]: SetToggled ( false ) 49end 50 51self . PORT_BUTTONS [ port ]: SetToggled ( true ) 52self : SetPort ( port ) 53love . updateTitle ( love . getTitleNoPort ()) 54end