summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-08-24 12:23:01 +0200
committerAki <nthirtyone@gmail.com>2016-08-24 12:23:01 +0200
commit78cf905ac5fa190dbd8a84678330a0479747c0e7 (patch)
treeff547b7c1f6c07b98b62e815a0c526b7a6c49771
parent5c9146f74c1cd522c22a9affa403cf1f4b96921d (diff)
downloadroflnauts-78cf905ac5fa190dbd8a84678330a0479747c0e7.zip
roflnauts-78cf905ac5fa190dbd8a84678330a0479747c0e7.tar.gz
roflnauts-78cf905ac5fa190dbd8a84678330a0479747c0e7.tar.bz2
More universal drawing
-rw-r--r--selector.lua8
1 files 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