From 48f8e2e9b19a074306a9db896b84b27b21a2cc99 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 4 Sep 2017 22:23:32 +0200 Subject: Testing new Selector and added update, locked drawing --- config/menus/host.lua | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'config/menus') diff --git a/config/menus/host.lua b/config/menus/host.lua index 38cc463..e7b41c2 100644 --- a/config/menus/host.lua +++ b/config/menus/host.lua @@ -6,8 +6,6 @@ local Selector = require "not.Selector" local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale() local bx = width/2-29 -local map_Selector = Selector(menu) - if background == nil or not background:is(require "not.MenuBackground") then background = require "not.MenuBackground"(menu) end @@ -23,34 +21,28 @@ do local i, name = map.portrait, map.name if i then icons[name] = love.graphics.newQuad((i-1)*76, 0, 76, 37, 532, 37) - table.insert(maps, name) + table.insert(maps, map) end end end end +local mapSelector = Selector(maps, nil, menu) + return { background, - map_Selector + mapSelector :setPosition(width/2, 40) - :setSize(80, 42) - :setMargin(0) - :set("global", true) - :set("first", true) - :set("list", maps) - :set("icons_i", love.graphics.newImage("assets/maps.png")) - :set("icons_q", icons) - :set("shape", "panorama") - :init() + :set("shape", Selector.SHAPE_PANORAMA) , Button(menu) :setText("Next") :setPosition(bx,101) :set("isEnabled", function () - return map_Selector:isLocked() + return mapSelector:getLocked() end) :set("active", function (self) - MAP = map_Selector:getFullSelection(true)[1][1] -- please, don't kill me for this, kek + MAP = mapSelector:getSelected().name -- TODO: It uses map name for compatibility with old code. self.parent:open("select") end) , -- cgit v1.1