fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
29daa42
GUI
1love . filesystem . setRequirePath ( "?.lua;?/init.lua;modules/?.lua;modules/?/init.lua" ) 2 3require ( "errorhandler" ) 4 5require ( "extensions.love" ) 6require ( "util.color" ) 7 8local watcher =require ( "memory.watcher" ) 9local gui =require ( "gui" ) 10local icons =require ( "smash.icons" ) 11 12local graphics =love . graphics 13 14function love . load () 15graphics . setBackgroundColor ( 0 , 0 , 0 , 0 ) -- Transparent background for OBS 16love . window . setTitle ( "M'Overlay - Waiting for Dolphin.exe" ) 17 18gui . init () 19watcher . init () 20icons . init () 21 22local display =gui . createScenePanel ( "ControllerDisplay" ) 23display : SetPort ( 1 ) 24 25--[[local test = gui.createScenePanel("Label") 26test:SetFont("fonts/A-OTF-FolkPro-Heavy.otf") 27test:SetBGColor(color_white) 28test:SetText("THIS IS A TEST OVERLAY ELEMENT") 29test:SizeToText()]] 30 31local test =gui . createScenePanel ( "PlayerPercent" ) 32test : SetPort ( 1 ) 33 34local test =gui . createScenePanel ( "MiniMap" ) 35 36--[[local test = gui.createScenePanel("PlayerPercent") 37test:SetPort(2) 38test:SetSize(200, 128)]] 39 40--gui.saveSceneLayout() 41 42gui . loadConfig ( gui . getDefaultConfig ()) 43end 44 45function love . update ( dt ) 46gui . tick ( dt ) 47watcher . update ( "Dolphin.exe" ) -- Look for Dolphin.exe 48end 49 50function love . resize ( w , h ) 51gui . resize ( w , h ) 52end 53 54function love . joystickpressed ( joy , but ) 55gui . joyPressed ( joy , but ) 56end 57 58function love . joystickreleased ( joy , but ) 59gui . joyReleased ( joy , but ) 60end 61 62function love . keypressed ( key , scancode , isrepeat ) 63gui . keyPressed ( key , scancode , isrepeat ) 64end 65 66function love . keyreleased ( key ) 67gui . keyReleased ( key ) 68end 69 70function love . textinput ( text ) 71gui . textInput ( text ) 72end 73 74function love . mousemoved ( x , y , dx , dy , istouch ) 75gui . mouseMoved ( x , y , dx , dy , istouch ) 76end 77 78function love . mousepressed ( x , y , button , istouch , presses ) 79gui . mousePressed ( x , y , button , istouch , presses ) 80end 81 82function love . mousereleased ( x , y , button , istouch , presses ) 83gui . mouseReleased ( x , y , button , istouch , presses ) 84end 85 86function love . wheelmoved ( x , y ) 87gui . mouseWheeled ( x , y ) 88end 89 90function love . draw () 91gui . render () 92end 93 94function love . quit () 95gui . shutdown () 96end 97 98local FPS_LIMIT =60 99 100function love . run () 101if love . load then love . load ( love . arg . parseGameArguments ( arg ), arg ) end 102 103-- We don't want the first frame's dt to include time taken by love.load. 104if love . timer then love . timer . step () end 105 106local dt =0 107 108-- Main loop time. 109return function () 110local frame_start =love . timer . getTime () 111 112-- Process events. 113if love . event then 114love . event . pump () 115for name , a , b , c , d , e , f in love . event . poll () do 116if name == "quit" then 117if not love . quit or not love . quit () then 118return a or 0 119end 120end 121love . handlers [ name ]( a , b , c , d , e , f ) 122end 123end 124 125-- Update dt, as we'll be passing it to update 126if love . timer then dt =love . timer . step () end 127 128-- Call update and draw 129if love . update then love . update ( dt ) end -- will pass 0 if love.timer is disabled 130 131if love . graphics and love . graphics . isActive () then 132love . graphics . origin () 133love . graphics . clear ( love . graphics . getBackgroundColor ()) 134 135if love . draw then love . draw () end 136 137love . graphics . present () 138end 139 140if love . timer then 141local frame_time =love . timer . getTime () - frame_start 142love . timer . sleep ( 1 / FPS_LIMIT - frame_time ) 143end 144end 145end