From ab82b9f8ee76ef8327765ed59639c3f3c65fce8f Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 26 Aug 2016 15:52:25 +0200 Subject: allow first --- assets/placeholder-map-icon.png | Bin 5322 -> 6850 bytes config/menuhost.lua | 3 ++- selector.lua | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/placeholder-map-icon.png b/assets/placeholder-map-icon.png index eccb551..3d54e18 100644 Binary files a/assets/placeholder-map-icon.png and b/assets/placeholder-map-icon.png differ diff --git a/config/menuhost.lua b/config/menuhost.lua index 878ec71..6e52482 100644 --- a/config/menuhost.lua +++ b/config/menuhost.lua @@ -10,10 +10,11 @@ local map_selector = selector:new(menu) return { map_selector - :setPosition(width/2, 10) + :setPosition(width/2, 40) :setSize(80, 42) :setMargin(0) :set("global", true) + :set("first", true) :set("list", require "maplist") :set("icons_i", love.graphics.newImage("assets/placeholder-map-icon.png")) :set("icons_q", require "mapicons") diff --git a/selector.lua b/selector.lua index a4f9c03..f382bbb 100644 --- a/selector.lua +++ b/selector.lua @@ -23,6 +23,7 @@ Selector = { focused = false, global = false, delay = 2, + first = false, list, sets, locks, @@ -204,7 +205,7 @@ function Selector:drawBlock(n, x, y, scale) love.graphics.draw(sprite, quad.arrow_l, (x+0-2-math.floor(self.delay))* scale, (y+dy)*scale, 0, scale, scale) love.graphics.draw(sprite, quad.arrow_r, (x+w-4+math.floor(self.delay))*scale, (y+dy)*scale, 0, scale, scale) end - if self:getSelection(n) ~= 1 then + if (self:getSelection(n) ~= 1 or self.first) then love.graphics.setFont(Font) love.graphics.setColor(255, 255, 255, 255) love.graphics.printf(string.upper(name), (x-w)*scale, (y+h+1)*scale, w*3, "center", 0, scale, scale) @@ -245,7 +246,7 @@ function Selector:controlpressed(set, action, key) if action == "left" and not locked then self:previous(n) end if action == "right" and not locked then self:next(n) end if action == "attack" then - if self:getSelection(n) ~= 1 and self:isUnique(n) then + if (self:getSelection(n) ~= 1 or self.first) and self:isUnique(n) then self.locks[n] = true end end -- cgit v1.1