summaryrefslogtreecommitdiffhomepage
path: root/not/Selector.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-05 00:44:32 +0200
committerAki <nthirtyone@gmail.com>2017-09-05 00:44:32 +0200
commit8e51db223ed1e8307d1009e48becc618a924749b (patch)
treea8719fecddb047779048d352d8cc722313108084 /not/Selector.lua
parent0f97a9712bbbb297c83758ecd48e5e51532a426f (diff)
downloadroflnauts-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.lua14
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