From 9b8f5e3d356be281d8ef25227b087bb99b07b58d Mon Sep 17 00:00:00 2001 From: Aki Date: Tue, 23 Aug 2016 19:24:06 +0200 Subject: start > select --- config/menuselect.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 config/menuselect.lua (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua new file mode 100644 index 0000000..1830f0d --- /dev/null +++ b/config/menuselect.lua @@ -0,0 +1,16 @@ +local menu = ... + +local button = require "button" +local selector = require "selector" + +local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() + +return { + button:new(menu) + :setText("Go back") + :setPosition(10,height-25) + :set("active", function (self) + self.parent:load("menumain") + end) + , +} \ No newline at end of file -- cgit v1.1 From 3ab0342ad678ceec3b708ac56e2b7e5bd70185ac Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 04:57:56 +0200 Subject: Add selector to select menu cfg --- config/menuselect.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index 1830f0d..fcfcc16 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -13,4 +13,10 @@ return { self.parent:load("menumain") end) , + selector:new(menu) + :setPosition(10,10) + :set("list", require "nautslist") + :set("global", false) + :init() + , } \ No newline at end of file -- cgit v1.1 From 3139857cee53affa1c642f92da8d6a595a18c52e Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 04:59:23 +0200 Subject: And moved it to top --- config/menuselect.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index fcfcc16..b1ce2cd 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -6,6 +6,12 @@ local selector = require "selector" local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() return { + selector:new(menu) + :setPosition(10,10) + :set("list", require "nautslist") + :set("global", false) + :init() + , button:new(menu) :setText("Go back") :setPosition(10,height-25) @@ -13,10 +19,4 @@ return { self.parent:load("menumain") end) , - selector:new(menu) - :setPosition(10,10) - :set("list", require "nautslist") - :set("global", false) - :init() - , } \ No newline at end of file -- cgit v1.1 From 2aef35b0bbb72595977cddc2c2bbb3f65beb6bc6 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 05:30:57 +0200 Subject: Draw me like one of your french girls --- config/menuselect.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index b1ce2cd..c070f4c 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -8,8 +8,11 @@ local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.get return { selector:new(menu) :setPosition(10,10) + :setSpacing(42, 0) :set("list", require "nautslist") :set("global", false) + :set("sprite", love.graphics.newImage("assets/portraits.png")) + :set("quads", require "portraits") :init() , button:new(menu) -- cgit v1.1 From 5c9146f74c1cd522c22a9affa403cf1f4b96921d Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 07:10:02 +0200 Subject: Now it's fine --- config/menuselect.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index c070f4c..ffdda7f 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -7,8 +7,9 @@ local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.get return { selector:new(menu) - :setPosition(10,10) - :setSpacing(42, 0) + :setPosition(width/2,10) + :setMargin(8) + :setSize(32, 32) :set("list", require "nautslist") :set("global", false) :set("sprite", love.graphics.newImage("assets/portraits.png")) -- cgit v1.1 From 1213e1e2831805ebb5d193702e02c59c2927e54a Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 13:29:13 +0200 Subject: Almost the same functionality --- config/menuselect.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index ffdda7f..8d646ba 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -4,10 +4,13 @@ local button = require "button" local selector = require "selector" local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() +local bx = width/2-29 + +local naut_selector = selector:new(menu) return { - selector:new(menu) - :setPosition(width/2,10) + naut_selector + :setPosition(width/2,60) :setMargin(8) :setSize(32, 32) :set("list", require "nautslist") @@ -17,8 +20,15 @@ return { :init() , button:new(menu) + :setText("Force start") + :setPosition(bx,101) + :set("active", function (self) + changeScene(World:new(nil,naut_selector:getFullSelection(false))) + end) + , + button:new(menu) :setText("Go back") - :setPosition(10,height-25) + :setPosition(bx,117) :set("active", function (self) self.parent:load("menumain") end) -- cgit v1.1 From 8b0698abc1290cbdbfef3c8b48a2dc7a0388c9d1 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 14:19:18 +0200 Subject: Blink button, fix empty error --- config/menuselect.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index 8d646ba..c3a05c1 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -23,7 +23,12 @@ return { :setText("Force start") :setPosition(bx,101) :set("active", function (self) - changeScene(World:new(nil,naut_selector:getFullSelection(false))) + local nauts = naut_selector:getFullSelection(false) + if #nauts > 1 then + changeScene(World:new(nil, nauts)) + else + self:blink() + end end) , button:new(menu) -- cgit v1.1 From b19ec990880a3f2529ac8a7833337a0984094a23 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 19:03:40 +0200 Subject: Autostart+new menu --- config/menuselect.lua | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index c3a05c1..af71b5f 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -2,11 +2,13 @@ local menu = ... local button = require "button" local selector = require "selector" +local element = require "element" local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() local bx = width/2-29 local naut_selector = selector:new(menu) +local start_button = button:new(menu) return { naut_selector @@ -19,9 +21,9 @@ return { :set("quads", require "portraits") :init() , - button:new(menu) + start_button :setText("Force start") - :setPosition(bx,101) + :setPosition(bx,134) :set("active", function (self) local nauts = naut_selector:getFullSelection(false) if #nauts > 1 then @@ -33,9 +35,35 @@ return { , button:new(menu) :setText("Go back") - :setPosition(bx,117) + :setPosition(bx,150) :set("active", function (self) - self.parent:load("menumain") + self.parent:load("menuhost") + end) + , + element:new(menu) + :setPosition(bx, 101) + :set("the_final_countdown", 9) + :set("draw", function (self, scale) + if self.the_final_countdown ~= 9 then + local x,y = self:getPosition() + local countdown = math.max(1, math.ceil(self.the_final_countdown)) + love.graphics.setColor(255, 255, 255, 255) + love.graphics.setFont(Font) + love.graphics.print("Autostart in:", (x-16)*scale, (y+10)*scale, 0, scale, scale) + love.graphics.setFont(Bold) + love.graphics.printf(countdown, (x+40)*scale, (y)*scale, 36, "center", 0, scale, scale) + end + end) + :set("update", function (self, dt) + local total = #naut_selector:getFullSelection(false) + if total > 1 then + self.the_final_countdown = self.the_final_countdown - dt + else + self.the_final_countdown = 9 + end + if self.the_final_countdown < 0 then + start_button:active() + end end) , } \ No newline at end of file -- cgit v1.1 From 65e2f701a6c0cfbf53506678771839f7f6d12cbf Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 24 Aug 2016 22:14:10 +0200 Subject: map selection --- config/menuselect.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/menuselect.lua') 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 -- cgit v1.1 From ac6d4307fc9f7713b996eb8d36a8d0d3756efc00 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 25 Aug 2016 16:44:13 +0200 Subject: THIS NEED REAL CLEANUP --- config/menuselect.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index 20ea607..31cf02e 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -17,8 +17,8 @@ return { :setSize(32, 32) :set("list", require "nautslist") :set("global", false) - :set("sprite", love.graphics.newImage("assets/portraits.png")) - :set("quads", require "portraits") + :set("icons_i", love.graphics.newImage("assets/portraits.png")) + :set("icons_q", require "nautsicons") :init() , start_button -- cgit v1.1 From 96b4407ae6410affd0db1e6d6d657d4f65d32235 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 28 Aug 2016 20:41:48 +0200 Subject: No blinking; buttons enabled/disabled --- config/menuselect.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index 31cf02e..c79396c 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -24,12 +24,16 @@ return { start_button :setText("Force start") :setPosition(bx,134) + :set("isEnabled", function () + if #naut_selector:getFullSelection(false) > 1 then + return true + end + return false + end) :set("active", function (self) local nauts = naut_selector:getFullSelection(false) if #nauts > 1 then changeScene(World:new(MAP, nauts)) - else - self:blink() end end) , -- cgit v1.1 From 35262a7245bcd9ebf937d07ab3326655d96e5d2e Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 6 Oct 2016 14:43:11 +0200 Subject: Fixed scaling of fullscreen menu in different ratios --- config/menuselect.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/menuselect.lua') diff --git a/config/menuselect.lua b/config/menuselect.lua index c79396c..19f46ab 100644 --- a/config/menuselect.lua +++ b/config/menuselect.lua @@ -4,7 +4,7 @@ local button = require "button" local selector = require "selector" local element = require "element" -local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() +local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale() local bx = width/2-29 local naut_selector = selector:new(menu) -- cgit v1.1