function MenuDraw(menu) -- Set scale to 1 love.graphics.scale(0.5,0.5) if menu == "pauseMenu" then -- Parameters local pauseWidth = 640 local pauseHeight = 480 local pauseX = (game.width/2)-(pauseWidth/2) local pauseY = (game.height/2)-(pauseHeight/2) local mouse_x, mouse_y = love.mouse.getPosition() -- Base items love.graphics.setColor(0,0,0,0.3) love.graphics.rectangle("fill", 0, 0, game.width, game.height) love.graphics.setColor(1,1,1,1) love.graphics.rectangle("fill", pauseX, pauseY, pauseWidth, pauseHeight) -- Reset scale end for _, element in pairs(UIElement) do element:Draw() end love.graphics.scale(2,2) end function MenuStep(menu) -- first get mouse local mouse_x, mouse_y = love.mouse.getPosition() for _, element in pairs(UIElement) do if element.type == "Button" then element:checkMouse(mouse_x, mouse_y) end end if menu == "pauseMenu" then if PauseResume:getVariable() == true then MenuExit(menu,0) do_pause = false elseif PauseExit:getVariable() == true then love.event.quit() end else end end function MenuExit(from,to) for _, element in pairs(UIElement) do element = nil end UIElement = {} if from == "pauseMenu" then PauseResume = nil PauseOptions = nil PauseExit = nil end menuPage = to or nil end function MenuInit(menu) local buttonStandard = {width = 200, height = 30, separation = 10} -- main menu if menu == "pauseMenu" then -- elements PauseResume = interfaceButton:New( game.width/2, game.height/2-buttonStandard.height-buttonStandard.separation, buttonStandard.width, buttonStandard.height, {false,true}, 1, { text = "Resume", color = {0,0,0.5}, color2 = {1,1,1} } ) PauseOptions = interfaceButton:New( game.width/2, game.height/2, buttonStandard.width, buttonStandard.height, {false,true}, 1, { text = "Options", color = {0,0,0.5}, color2 = {1,1,1} } ) PauseExit = interfaceButton:New( game.width/2, game.height/2+buttonStandard.height+buttonStandard.separation, buttonStandard.width, buttonStandard.height, {false,true}, 1, { text = "Exit", color = {0,0,0.5}, color2 = {1,1,1} } ) end end require "data/scripts/ui/button"