diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-05 00:44:32 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-05 00:44:32 +0200 |
commit | 8e51db223ed1e8307d1009e48becc618a924749b (patch) | |
tree | a8719fecddb047779048d352d8cc722313108084 /not/Selector.lua | |
parent | 0f97a9712bbbb297c83758ecd48e5e51532a426f (diff) | |
download | roflnauts-8e51db223ed1e8307d1009e48becc618a924749b.zip roflnauts-8e51db223ed1e8307d1009e48becc618a924749b.tar.gz roflnauts-8e51db223ed1e8307d1009e48becc618a924749b.tar.bz2 |
Darken not unique selections
Diffstat (limited to 'not/Selector.lua')
-rw-r--r-- | not/Selector.lua | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/not/Selector.lua b/not/Selector.lua index d6910fe..ed1813f 100644 --- a/not/Selector.lua +++ b/not/Selector.lua @@ -67,9 +67,11 @@ end -- @return boolean answering question function Selector:isUnique () if self.group then - -- In this case next is used to determine if table returned by call is empty. - if next(group:callEachBut(self, "getLocked")) then - return false + local locked = self.group:callEachBut(self, "getLocked") + for _,value in pairs(locked) do + if value == self:getSelected() then + return false + end end end return true @@ -108,13 +110,17 @@ function Selector:draw (scale) end love.graphics.setColor(255, 255, 255, 255) + if not self:isUnique() then + love.graphics.setColor(120, 120, 120, 255) + 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) end + love.graphics.setColor(255, 255, 255, 255) + if self.focused then local dy = (h-6)/2 local al, ar = self.quads.arrow_r, self.quads.arrow_l |