diff --git a/sonic-radiance.love/game/modules/gui/init.lua b/sonic-radiance.love/game/modules/gui/init.lua index cbf6f69..41483ce 100644 --- a/sonic-radiance.love/game/modules/gui/init.lua +++ b/sonic-radiance.love/game/modules/gui/init.lua @@ -6,7 +6,7 @@ function gui.newBorder(width, height, middlePosition) local tileset = love.graphics.newImage("assets/gui/borders.png") local tilequad = {} local w, h = tileset:getDimensions() - tilequad[1] = love.graphics.newQuad(0, 0, 20, 20, w, h) + tilequad[1] = love.graphics.newQuad(0, 0, 20, 20, w, h) tilequad[2] = love.graphics.newQuad(20, 0, 20, 20, w, h) tilequad[3] = love.graphics.newQuad(40, 0, 20, 20, w, h) tilequad[4] = love.graphics.newQuad(60, 0, 20, 20, w, h) @@ -41,12 +41,15 @@ function gui.newBorder(width, height, middlePosition) end function gui.drawBar(x, y, width, height) - local height = height or 7 - love.graphics.setScissor(x, y, width, height) - love.graphics.draw(barborder, x, y) - love.graphics.rectangle("fill", x+7, y, width-14, height) - love.graphics.draw(barborder, x+width-7, y, 0, -1, -1, 7, 7) - love.graphics.setScissor( ) + if (width > 0) then + local height = height or 7 + love.graphics.setScissor(x, y, width, height) + love.graphics.draw(barborder, x, y) + local barwidth = math.max(width-14, 0) + love.graphics.rectangle("fill", x+7, y, barwidth, height) + love.graphics.draw(barborder, x+width-7, y, 0, -1, -1, 7, 7) + love.graphics.setScissor( ) + end end return gui