diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/menuhost.lua | 24 | ||||
-rw-r--r-- | config/menumain.lua | 2 | ||||
-rw-r--r-- | config/menuselect.lua | 36 |
3 files changed, 57 insertions, 5 deletions
diff --git a/config/menuhost.lua b/config/menuhost.lua new file mode 100644 index 0000000..3ad10db --- /dev/null +++ b/config/menuhost.lua @@ -0,0 +1,24 @@ +local menu = ... + +local button = require "button" +local selector = require "selector" + +local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() +local bx = width/2-29 + +return { + button:new(menu) + :setText("Select") + :setPosition(bx,101) + :set("active", function (self) + self.parent:load("menuselect") + end) + , + button:new(menu) + :setText("Go back") + :setPosition(bx,117) + :set("active", function (self) + self.parent:load("menumain") + end) + , +}
\ No newline at end of file diff --git a/config/menumain.lua b/config/menumain.lua index c0607d6..2ca2c59 100644 --- a/config/menumain.lua +++ b/config/menumain.lua @@ -12,7 +12,7 @@ return { :setText("Start") :setPosition(bx, 80) :set("active", function (self) - self.parent:load("menuselect") + self.parent:load("menuhost") end) , button:new(menu) 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 |