diff options
author | Aki <nthirtyone@gmail.com> | 2017-09-05 00:59:50 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-09-05 00:59:50 +0200 |
commit | 9fcdea2e2eb36a2ee0a32cede760b8ec74b1feed (patch) | |
tree | 3fd322f06d6caf67a3d818b14c31b4f85a1bcbd5 | |
parent | dacc12eb824264e4f71e21ebecac4c76c9ad6382 (diff) | |
download | roflnauts-9fcdea2e2eb36a2ee0a32cede760b8ec74b1feed.zip roflnauts-9fcdea2e2eb36a2ee0a32cede760b8ec74b1feed.tar.gz roflnauts-9fcdea2e2eb36a2ee0a32cede760b8ec74b1feed.tar.bz2 |
Separated dev code part from rest
-rw-r--r-- | config/menus/select.lua | 50 |
1 files changed, 26 insertions, 24 deletions
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 { |