From 1392fe0404f19decab197064c88ca4dc0ad9c12d Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 4 Sep 2017 22:58:37 +0200 Subject: Minor interaction changes; draw arrows --- not/Selector.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/not/Selector.lua b/not/Selector.lua index 00cf5a0..c6ab810 100644 --- a/not/Selector.lua +++ b/not/Selector.lua @@ -98,15 +98,30 @@ function Selector:getShapeString () end end +-- TODO: Selector draw is missing box content drawing. function Selector:draw (scale) local x, y = self:getPosition() local w, h = self:getSize() + local boxType = "normal" if self:getLocked() then boxType = "active" end + love.graphics.setColor(255, 255, 255, 255) love.graphics.draw(self.atlas, self.quads[self:getShapeString()][boxType], x*scale, y*scale, 0, scale, scale) + + if self.focused then + local dy = (h-6)/2 + local al, ar = self.quads.arrow_r, self.quads.arrow_l + if self.lock then + al, ar = ar, al + end + + love.graphics.draw(self.atlas, ar, (x+0-2-math.floor(self.delay))*scale, (y+dy)*scale, 0, scale, scale) + love.graphics.draw(self.atlas, al, (x+w-4+math.floor(self.delay))*scale, (y+dy)*scale, 0, scale, scale) + end + love.graphics.setFont(Font) love.graphics.printf(self:getText(), (x-w)*scale, (y+h+1)*scale, w*3, "center", 0, scale, scale) end @@ -127,6 +142,7 @@ function Selector:controlpressed (set, action, key) if action == "right" then self:setIndex(self.index + 1) end + -- TODO: Extend functionality on attack action in Selector. if action == "attack" then self.lock = true end -- cgit v1.1