From beb4c28a70ddd282623fde612e5b0b676fe32a05 Mon Sep 17 00:00:00 2001 From: Simon Kellet Date: Wed, 31 Jul 2024 20:36:47 +0100 Subject: [PATCH] removed button func --- Pause/DrawPause.lua | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/Pause/DrawPause.lua b/Pause/DrawPause.lua index c1e6b6b..bd6c992 100644 --- a/Pause/DrawPause.lua +++ b/Pause/DrawPause.lua @@ -1,27 +1,3 @@ -local function button(x, y, w, h, text, selected) - --x,y is the top left corner of the button - local rounding = 30 -- used for rounding the buttons - - if not selected then - love.graphics.setColor(love.math.colorFromBytes(41, 134, 204)) - elseif selected then - love.graphics.setColor(love.math.colorFromBytes(244, 67, 54)) - end - -- Draw rectangle - love.graphics.rectangle("fill", x, y, w, h, rounding, rounding) - - -- Get width and height of text - local tw = MenuFont:getWidth(text) - local th = MenuFont:getHeight(text) - -- Calculate position to center the text - local textX = x + (w - tw) / 2 - local textY = y + (h - th) / 2 - -- Place text inside the rectangle - love.graphics.setFont(MenuFont) - love.graphics.setColor(1, 1, 1) -- reset colours - love.graphics.print(text, textX, textY) -end - function DrawPause() local opacity = 0.3 local height = love.graphics.getHeight() @@ -37,8 +13,9 @@ function DrawPause() love.graphics.print("PAUSED", 100, 100) --love.graphics.print("" .. PAUSE_POS, 200,200) - button(100, 200, bwidth, bheight, "Return", PAUSE_POS == 0 and true or false) - button(100, 350, bwidth, bheight, "Menu", PAUSE_POS == 1 and true or false) - button(100, 500, bwidth, bheight, "Quit", PAUSE_POS == 2 and true or false) + GUI:newButton(100, 200, bwidth, bheight, "Return", PAUSE_POS == 0 and true or false) + GUI:newButton(100, 350, bwidth, bheight, "Menu", PAUSE_POS == 1 and true or false) + GUI:newButton(100, 500, bwidth, bheight, "Quit", PAUSE_POS == 2 and true or false) + love.graphics.setColor(255, 255, 255) -- reset colours end