summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-08-24 22:14:10 +0200
committerAki <nthirtyone@gmail.com>2016-08-24 22:14:10 +0200
commit65e2f701a6c0cfbf53506678771839f7f6d12cbf (patch)
tree8f25a5ea731ef69c316b9eac89c609ac4a868690
parentb19ec990880a3f2529ac8a7833337a0984094a23 (diff)
downloadroflnauts-65e2f701a6c0cfbf53506678771839f7f6d12cbf.zip
roflnauts-65e2f701a6c0cfbf53506678771839f7f6d12cbf.tar.gz
roflnauts-65e2f701a6c0cfbf53506678771839f7f6d12cbf.tar.bz2
map selection
-rw-r--r--assets/placeholder-map-icon.pngbin0 -> 1220 bytes
-rw-r--r--config/menuhost.lua13
-rw-r--r--config/menuselect.lua2
-rw-r--r--selector.lua5
4 files changed, 18 insertions, 2 deletions
diff --git a/assets/placeholder-map-icon.png b/assets/placeholder-map-icon.png
new file mode 100644
index 0000000..cab79f1
--- /dev/null
+++ b/assets/placeholder-map-icon.png
Binary files differ
diff --git a/config/menuhost.lua b/config/menuhost.lua
index 3ad10db..53972b3 100644
--- a/config/menuhost.lua
+++ b/config/menuhost.lua
@@ -6,11 +6,24 @@ local selector = require "selector"
local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale()
local bx = width/2-29
+local map_selector = selector:new(menu)
+
return {
+ map_selector
+ :setPosition(width/2, 10)
+ :setSize(80, 42)
+ :setMargin(0)
+ :set("global", true)
+ :set("list", require "maplist")
+ :set("sprite", love.graphics.newImage("assets/placeholder-map-icon.png"))
+ :set("quads", require "mapicons")
+ :init()
+ ,
button:new(menu)
:setText("Select")
:setPosition(bx,101)
:set("active", function (self)
+ MAP = map_selector:getFullSelection(true)[1][1]
self.parent:load("menuselect")
end)
,
diff --git a/config/menuselect.lua b/config/menuselect.lua
index af71b5f..20ea607 100644
--- a/config/menuselect.lua
+++ b/config/menuselect.lua
@@ -27,7 +27,7 @@ return {
:set("active", function (self)
local nauts = naut_selector:getFullSelection(false)
if #nauts > 1 then
- changeScene(World:new(nil, nauts))
+ changeScene(World:new(MAP, nauts))
else
self:blink()
end
diff --git a/selector.lua b/selector.lua
index a0e19f8..f2d7b16 100644
--- a/selector.lua
+++ b/selector.lua
@@ -82,6 +82,7 @@ function Selector:init()
end
-- Initialize global Selector
if self.global then
+ self.sets = {}
self.locks = {false}
self.selections = {1}
-- Initialize Selector for Controllers
@@ -162,7 +163,9 @@ function Selector:getFullSelection(allowed)
local name = self:getListValue(self:getSelection(n))
local locked = self:isLocked(n)
if locked or allowed then
- table.insert(t, {name, self.sets[n]})
+ local a = {name}
+ if self.sets[n] then table.insert(a, self.sets[n]) end
+ table.insert(t, a)
end
end
return t