diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-22 18:02:23 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-22 18:02:23 +0200 |
commit | 2235ec2648258bdf51c75280b2289cea0c970d0f (patch) | |
tree | a156ffb1719e461ca32254dab052ece165f2cfe4 | |
parent | e5ad6ac474423176f13a70ae30904aaa48365eda (diff) | |
download | roflnauts-2235ec2648258bdf51c75280b2289cea0c970d0f.zip roflnauts-2235ec2648258bdf51c75280b2289cea0c970d0f.tar.gz roflnauts-2235ec2648258bdf51c75280b2289cea0c970d0f.tar.bz2 |
Added getIcon for Selector
-rw-r--r-- | not/Selector.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/not/Selector.lua b/not/Selector.lua index ee6f0e3..5536b44 100644 --- a/not/Selector.lua +++ b/not/Selector.lua @@ -100,6 +100,12 @@ function Selector:getText () return tostring(self:getSelected()) end +function Selector:getIcon () + if self.icons then + return self.icons[self.index] + end +end + function Selector:focus () self.focused = true return true @@ -134,8 +140,9 @@ function Selector:draw (scale) end love.graphics.draw(self.atlas, self.quads[self:getShapeString()][boxType], x*scale, y*scale, 0, scale, scale) -- TODO: That is one way to draw icon for selected value. Find better one. See: `config/menus/host`. - if self.icons_atlas and self.icons_quads then - love.graphics.draw(self.icons_atlas, self.icons_quads[self.index], (x+2)*scale, (y+3)*scale, 0, scale, scale) + local icon = self:getIcon() + if icon then + love.graphics.draw(icon, (x+2)*scale, (y+3)*scale, 0, scale, scale) end love.graphics.setColor(255, 255, 255, 255) |