diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-22 19:38:39 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-22 19:38:39 +0200 |
commit | 6d530ace4d6a445d3136cca180f54f8add3d81fc (patch) | |
tree | 0dd6d7b0ffe24a8f9962d71ef6c3bfc572871ce1 /not/Selector.lua | |
parent | c4524ee39e0ff90bde0df0ce7a0c14f74eeb152f (diff) | |
parent | eabad160152f5bf6e7dd442de46b135a1a59f75e (diff) | |
download | roflnauts-6d530ace4d6a445d3136cca180f54f8add3d81fc.zip roflnauts-6d530ace4d6a445d3136cca180f54f8add3d81fc.tar.gz roflnauts-6d530ace4d6a445d3136cca180f54f8add3d81fc.tar.bz2 |
Merge branch 'icons'
Diffstat (limited to 'not/Selector.lua')
-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) |