scenes/boost: improve HUD

This commit is contained in:
Kazhnuz 2019-02-04 09:17:47 +01:00
parent 091210df41
commit b163cca8ae

View file

@ -17,8 +17,8 @@ function BattleHUD:loadAssets()
self.progressbarImage = love.graphics.newImage("assets/gui/hud/progressbar.png") self.progressbarImage = love.graphics.newImage("assets/gui/hud/progressbar.png")
self.barBack = love.graphics.newQuad(0, 0, 211, 12, 211, 24) self.barBack = love.graphics.newQuad(0, 0, 211, 12, 211, 24)
self.barFore = love.graphics.newQuad(0, 12, 211, 12, 211, 24) self.barFore = love.graphics.newQuad(0, 12, 211, 12, 211, 24)
self.hud1 = gui.newBorder(424, 20, 8) self.hud1 = gui.newBorder(424, 20, 14)
self.hud2 = gui.newBorder(424, 40, 8) self.hud2 = gui.newBorder(424, 40, 12)
self.ring = love.graphics.newImage("assets/gui/hud/ring.png") self.ring = love.graphics.newImage("assets/gui/hud/ring.png")
@ -59,8 +59,12 @@ function BattleHUD:draw()
end end
function BattleHUD:drawFrame() function BattleHUD:drawFrame()
love.graphics.draw(self.hud1, 0, 0) love.graphics.setColor(0.256, 0.632, 0.852, 1)
love.graphics.draw(self.hud2, 0, 200) love.graphics.rectangle("fill", 0, 0, 424, 20)
love.graphics.rectangle("fill", 0, 200, 424, 20)
utils.graphics.resetColor()
love.graphics.draw(self.hud1, 0, 0, 0, 1, -1, 0, 20)
love.graphics.draw(self.hud2, 0, 200, 0, -1, 1, 424, 0)
end end
function BattleHUD:drawTop(x, y) function BattleHUD:drawTop(x, y)
@ -92,7 +96,7 @@ function BattleHUD:drawTop(x, y)
end end
function BattleHUD:drawBottom(x, y) function BattleHUD:drawBottom(x, y)
local progressx, progressy = x + 5, y + 4 local progressx, progressy = x + 204, y + 4
love.graphics.draw(self.progressbarImage, self.barBack, progressx, progressy) love.graphics.draw(self.progressbarImage, self.barBack, progressx, progressy)
local width = math.floor((self.target.x / self.controller.world.width) * (211 - 16)) local width = math.floor((self.target.x / self.controller.world.width) * (211 - 16))
width = math.max(0, width) width = math.max(0, width)
@ -107,7 +111,7 @@ function BattleHUD:drawBottom(x, y)
love.graphics.printf(turn1 .. "/" .. turn2, progressx, progressy + 12 + 2, 210, "right") love.graphics.printf(turn1 .. "/" .. turn2, progressx, progressy + 12 + 2, 210, "right")
end end
local timex, timey = x + 228, y + 1 local timex, timey = x + 5, y + 2
love.graphics.draw(self.time, timex, timey) love.graphics.draw(self.time, timex, timey)
local timestring = self:getTimeString(self.controller.mission.timer) local timestring = self:getTimeString(self.controller.mission.timer)