From 9fcdea2e2eb36a2ee0a32cede760b8ec74b1feed Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 5 Sep 2017 00:59:50 +0200 Subject: Separated dev code part from rest --- config/menus/select.lua | 50 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'config') diff --git a/config/menus/select.lua b/config/menus/select.lua index 9ce7201..609c2f6 100644 --- a/config/menus/select.lua +++ b/config/menus/select.lua @@ -15,34 +15,36 @@ if background == nil or not background:is(require "not.MenuBackground") then end -- TODO: Temporary group for naut selectors. This isn't production code at any means! -local atlas = love.graphics.newImage("assets/portraits.png") -local nauts = require("config.nauts") -local icons = {} -for i=0,#nauts-1 do - table.insert(icons, love.graphics.newQuad(i*28, 0, 28, 27, 1008, 27)) -end +local group, get +do + local atlas = love.graphics.newImage("assets/portraits.png") + local nauts = require("config.nauts") + local icons = {} + for i=0,#nauts-1 do + table.insert(icons, love.graphics.newQuad(i*28, 0, 28, 27, 1008, 27)) + end -local group = Group(menu) -local -function add (element) - table.insert(group.children, element) - return element -end + group = Group(menu) + local + function add (element) + table.insert(group.children, element) + return element + end -for i,_ in pairs(Controller.getSets()) do - add(Selector(nauts, group, menu)) - :setPosition(10+48*(i-1), 10) - :set("icons_atlas", atlas) - :set("icons_quads", icons) -end + for i,_ in pairs(Controller.getSets()) do + add(Selector(nauts, group, menu)) + :setPosition(10+48*(i-1), 10) + :set("icons_atlas", atlas) + :set("icons_quads", icons) + end -local -function get () - local selection = group:callEach("getSelected") - for i,naut in ipairs(selection) do - selection[i] = {naut, Controller.getSets()[i]} + function get () + local selection = group:callEach("getSelected") + for i,naut in ipairs(selection) do + selection[i] = {naut, Controller.getSets()[i]} + end + return selection end - return selection end return { -- cgit v1.1