From 78cf905ac5fa190dbd8a84678330a0479747c0e7 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 12:23:01 +0200 Subject: More universal drawing --- selector.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/selector.lua b/selector.lua index 240716e..043a08b 100644 --- a/selector.lua +++ b/selector.lua @@ -154,17 +154,19 @@ function Selector:drawBlock(n, x, y, scale) local quad = self.quads[name] local arrowl = self.quads.arrow_left local arrowr = self.quads.arrow_right + local w,h = self:getSize() if not locked then love.graphics.draw(sprite, quad.normal, x*scale, y*scale, 0, scale, scale) if self.focused then - love.graphics.draw(sprite, arrowl, (x-2)* scale, (y+13)*scale, 0, scale, scale) - love.graphics.draw(sprite, arrowr, (x+30)*scale, (y+13)*scale, 0, scale, scale) + local dy = (h-6)/2 + love.graphics.draw(sprite, arrowl, (x+0-2)* scale, (y+dy)*scale, 0, scale, scale) + love.graphics.draw(sprite, arrowr, (x+w-2)*scale, (y+dy)*scale, 0, scale, scale) end else love.graphics.draw(sprite, quad.active, x*scale, y*scale, 0, scale, scale) end if self:getSelection(n) ~= 1 then - love.graphics.printf(string.upper(name), (x-8)*scale, (y+33)*scale, 48, "center", 0, scale, scale) + love.graphics.printf(string.upper(name), (x-w)*scale, (y+h+1)*scale, w*3, "center", 0, scale, scale) end end -- cgit v1.1