fix: remove an use of scissor for hp bars
This commit is contained in:
parent
784059f8f4
commit
e35d89f21e
3 changed files with 19 additions and 7 deletions
6
sonic-radiance.love/assets/gui/bar_small.lua
Normal file
6
sonic-radiance.love/assets/gui/bar_small.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
metadata = {
|
||||||
|
height = 7,
|
||||||
|
width = 14,
|
||||||
|
}
|
||||||
|
}
|
BIN
sonic-radiance.love/assets/gui/bar_small.png
Normal file
BIN
sonic-radiance.love/assets/gui/bar_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 719 B |
|
@ -1,6 +1,8 @@
|
||||||
local gui = {}
|
local gui = {}
|
||||||
|
local TileSet = require "birb.modules.assets.types.tileset"
|
||||||
|
|
||||||
local barborder = love.graphics.newImage("assets/gui/barborder.png")
|
local barborder = love.graphics.newImage("assets/gui/barborder.png")
|
||||||
|
local barSmall = TileSet("assets/gui/bar_small")
|
||||||
|
|
||||||
function gui.newBorder(width, height, middlePosition)
|
function gui.newBorder(width, height, middlePosition)
|
||||||
local tileset = love.graphics.newImage("assets/gui/borders.png")
|
local tileset = love.graphics.newImage("assets/gui/borders.png")
|
||||||
|
@ -79,14 +81,18 @@ function gui.newChoiceBack(approximateWidth)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gui.drawBar(x, y, width, height)
|
function gui.drawBar(x, y, width, height)
|
||||||
|
width = math.floor(width)
|
||||||
|
|
||||||
if (width > 0) then
|
if (width > 0) then
|
||||||
local height = height or 7
|
height = 7
|
||||||
core.screen:setScissor(x, y, width, height)
|
if (width <= 8) then
|
||||||
love.graphics.draw(barborder, x, y)
|
barSmall:drawTile(9 - width, 0, 0)
|
||||||
local barwidth = math.max(width-14, 0)
|
else
|
||||||
love.graphics.rectangle("fill", x+7, y, barwidth, height)
|
love.graphics.draw(barborder, x, y)
|
||||||
love.graphics.draw(barborder, x+barwidth+7, y, 0, -1, -1, 7, 7)
|
local barwidth = math.max(width-14, 0)
|
||||||
core.screen:resetScissor( )
|
love.graphics.rectangle("fill", x+7, y, barwidth, height)
|
||||||
|
love.graphics.draw(barborder, x+barwidth+7, y, 0, -1, -1, 7, 7)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue