summaryrefslogtreecommitdiffhomepage
path: root/config/menus
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-08-13 02:26:55 +0200
committerAki <nthirtyone@gmail.com>2017-08-13 02:26:55 +0200
commitb1cf14d64a2d3e28683db87190c4b2c7799c259d (patch)
treee45dac5cc6ce5265e3e3e2c914eb7cc92a820b8b /config/menus
parent0dd01913fe0eefc7ba4bc0797877f40fdedf9315 (diff)
parented62b573417bdc85bec616f6016846b02de4c906 (diff)
downloadroflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.zip
roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.gz
roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.bz2
Merge branch 'multi'maps
Diffstat (limited to 'config/menus')
-rw-r--r--config/menus/credits.lua17
-rw-r--r--config/menus/host.lua25
-rw-r--r--config/menus/main.lua35
-rw-r--r--config/menus/pause.lua35
-rw-r--r--config/menus/select.lua37
-rw-r--r--config/menus/settings.lua48
-rw-r--r--config/menus/win.lua22
7 files changed, 164 insertions, 55 deletions
diff --git a/config/menus/credits.lua b/config/menus/credits.lua
index 77cba62..d59b560 100644
--- a/config/menus/credits.lua
+++ b/config/menus/credits.lua
@@ -1,24 +1,29 @@
-local menu = ...
+local menu, background = ...
-local button = require "not.Button"
-local element = require "not.Element"
+local Button = require "not.Button"
+local Element = require "not.Element"
local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale()
local bx = width/2-29
+if background == nil or not background:is(require "not.MenuBackground") then
+ background = require "not.MenuBackground"(menu)
+end
+
return {
- button:new(menu)
+ background,
+ Button(menu)
:setText("Go back")
:setPosition(bx,144)
:set("active", function (self)
self.parent:open("main")
end)
,
- element:new(menu)
+ Element(menu)
:setPosition(width/2, 30)
:set("draw", function (self, scale)
local x,y = self:getPosition()
love.graphics.printf("A game by the Awesomenauts community including:\nSeltzy, PlasmaWisp, ParaDoX, MilkingChicken, Burningdillo, Bronkey and Aki.\n\n04font was used.\n\nBased on a game by Jan Willem Nijman, Paul Veer and Bits_Beats XOXO.\n\nAwesomenauts is property of Ronimo Games.", (x-110)*scale, (y+10)*scale, 220, "left", 0, scale, scale)
end)
,
-} \ No newline at end of file
+}
diff --git a/config/menus/host.lua b/config/menus/host.lua
index b318a5b..a180736 100644
--- a/config/menus/host.lua
+++ b/config/menus/host.lua
@@ -1,18 +1,23 @@
-local menu = ...
+local menu, background = ...
-local button = require "not.Button"
-local selector = require "not.Selector"
+local Button = require "not.Button"
+local Selector = require "not.Selector"
local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale()
local bx = width/2-29
-local map_selector = selector:new(menu)
+local map_Selector = Selector(menu)
require "iconsList"
local icons, maps = getMapsIconsList()
+if background == nil or not background:is(require "not.MenuBackground") then
+ background = require "not.MenuBackground"(menu)
+end
+
return {
- map_selector
+ background,
+ map_Selector
:setPosition(width/2, 40)
:setSize(80, 42)
:setMargin(0)
@@ -24,22 +29,22 @@ return {
:set("shape", "panorama")
:init()
,
- button:new(menu)
+ Button(menu)
:setText("Next")
:setPosition(bx,101)
:set("isEnabled", function ()
- return map_selector:isLocked()
+ return map_Selector:isLocked()
end)
:set("active", function (self)
- MAP = map_selector:getFullSelection(true)[1][1] -- please, don't kill me for this, kek
+ MAP = map_Selector:getFullSelection(true)[1][1] -- please, don't kill me for this, kek
self.parent:open("select")
end)
,
- button:new(menu)
+ Button(menu)
:setText("Go back")
:setPosition(bx,117)
:set("active", function (self)
self.parent:open("main")
end)
,
-} \ No newline at end of file
+}
diff --git a/config/menus/main.lua b/config/menus/main.lua
index 236c011..ae2cef2 100644
--- a/config/menus/main.lua
+++ b/config/menus/main.lua
@@ -1,49 +1,60 @@
-local menu = ...
+local menu, background = ...
-local button = require "not.Button"
-local header = require "not.Header"
-local element = require "not.Element"
+local Button = require "not.Button"
+local Header = require "not.Header"
+local Element = require "not.Element"
local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale()
local bx = width/2-29
local awesometwo = love.graphics.newImage("assets/two.png")
+if background == nil or not background:is(require "not.MenuBackground") then
+ background = require "not.MenuBackground"(menu)
+end
+
+-- Wait, only here?
+if musicPlayer:getCurrentTrack() ~= "menu.ogg" then
+ musicPlayer:setTrack("menu.ogg")
+ musicPlayer:play()
+end
+
return {
- button:new(menu)
+ background,
+ Button(menu)
:setText("Start")
:setPosition(bx, 80)
:set("active", function (self)
self.parent:open("host")
end)
,
- button:new(menu)
+ Button(menu)
:setText("Join")
:setPosition(bx, 96)
:set("isEnabled", function (self)
return false
end)
,
- button:new(menu)
+ Button(menu)
:setText("Settings")
:setPosition(bx, 112)
:set("active", function (self)
self.parent:open("settings")
end)
,
- button:new(menu)
+ Button(menu)
:setText("Credits")
:setPosition(bx, 128)
:set("active", function (self)
self.parent:open("credits")
end)
,
- button:new(menu)
+ Button(menu)
:setText("Exit")
:setPosition(bx, 144)
:set("active", love.event.quit)
,
- element:new(menu)
+ Element(menu)
:setPosition(width/2, 15)
:set("draw", function (self, scale)
local x,y = self:getPosition()
@@ -52,8 +63,8 @@ return {
love.graphics.draw(awesometwo, x*scale, y*scale, 0, scale, scale, 35)
end)
,
- header:new(menu)
+ Header(menu)
:setText("Roflnauts")
:setPosition(width/2,40)
,
-} \ No newline at end of file
+}
diff --git a/config/menus/pause.lua b/config/menus/pause.lua
new file mode 100644
index 0000000..60aa2fc
--- /dev/null
+++ b/config/menus/pause.lua
@@ -0,0 +1,35 @@
+local menu = ...
+
+local Button = require "not.Button"
+local Element = require "not.Element"
+
+local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale()
+local bx = width/2-29
+
+return {
+ Element(menu)
+ :set("draw", function (self, scale)
+ love.graphics.setColor(0, 0, 0, 110)
+ local width, height = love.graphics.getWidth(), love.graphics.getHeight()
+ love.graphics.rectangle("fill", 0, 0, width, height)
+ end)
+ ,
+ Button(menu)
+ :setText("Unpause")
+ :setPosition(bx, height - 38)
+ :set("active", function (self)
+ sceneManager:removeTopScene()
+ local scene = sceneManager:getAllScenes()[1]
+ scene:setSleeping(false)
+ scene:setInputDisabled(false)
+ end)
+ ,
+ Button(menu)
+ :setText("Exit")
+ :setPosition(bx, height - 22)
+ :set("active", function (self)
+ sceneManager:removeTopScene()
+ sceneManager:changeScene(Menu("main"))
+ end)
+ ,
+}
diff --git a/config/menus/select.lua b/config/menus/select.lua
index 804b4eb..23f9374 100644
--- a/config/menus/select.lua
+++ b/config/menus/select.lua
@@ -1,20 +1,25 @@
-local menu = ...
+local menu, background = ...
-local button = require "not.Button"
-local selector = require "not.Selector"
-local element = require "not.Element"
+local Button = require "not.Button"
+local Selector = require "not.Selector"
+local Element = require "not.Element"
local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale()
local bx = width/2-29
-local naut_selector = selector:new(menu)
-local start_button = button:new(menu)
+local naut_Selector = Selector(menu)
+local start_Button = Button(menu)
require "iconsList"
local nautsIcons, nautsList = getNautsIconsList()
+if background == nil or not background:is(require "not.MenuBackground") then
+ background = require "not.MenuBackground"(menu)
+end
+
return {
- naut_selector
+ background,
+ naut_Selector
:setPosition(width/2,60)
:setMargin(8)
:setSize(32, 32)
@@ -24,30 +29,30 @@ return {
:set("icons_q", nautsIcons)
:init()
,
- start_button
+ start_Button
:setText("Force start")
:setPosition(bx,134)
:set("isEnabled", function ()
- if #naut_selector:getFullSelection(false) > 1 then
+ if #naut_Selector:getFullSelection(false) > 1 then
return true
end
return false
end)
:set("active", function (self)
- local nauts = naut_selector:getFullSelection(false)
+ local nauts = naut_Selector:getFullSelection(false)
if #nauts > 1 then
- changeScene(World:new(MAP, nauts))
+ sceneManager:changeScene(World(MAP, nauts))
end
end)
,
- button:new(menu)
+ Button(menu)
:setText("Go back")
:setPosition(bx,150)
:set("active", function (self)
self.parent:open("host")
end)
,
- element:new(menu)
+ Element(menu)
:setPosition(bx, 101)
:set("the_final_countdown", 9)
:set("draw", function (self, scale)
@@ -62,15 +67,15 @@ return {
end
end)
:set("update", function (self, dt)
- local total = #naut_selector:getFullSelection(false)
+ 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()
+ start_Button:active()
end
end)
,
-} \ No newline at end of file
+}
diff --git a/config/menus/settings.lua b/config/menus/settings.lua
index ae0403d..7102bea 100644
--- a/config/menus/settings.lua
+++ b/config/menus/settings.lua
@@ -1,15 +1,15 @@
-local menu = ...
+local menu, background = ...
-local button = require "not.Button"
-local selector = require "not.Selector"
-local element = require "not.Element"
+local Button = require "not.Button"
+local Selector = require "not.Selector"
+local Element = require "not.Element"
local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale()
local bx = width/2-29
local keys = {"Left", "Right", "Up", "Down", "Attack", "Jump"}
-local dimmer = element:new(menu)
+local dimmer = Element(menu)
:setPosition(width/2, 15)
:set("visible", false)
:set("currentControl", "Left") -- it actually means control that is being set CURRENTLY
@@ -64,8 +64,34 @@ local controlreleased = function(self, set, action, key)
end
end
+if background == nil or not background:is(require "not.MenuBackground") then
+ background = require "not.MenuBackground"(menu)
+end
+
+local displayTypes = {["fullscreen"] = "fullscreen", ["1"] = "1x", ["2"] = "2x", ["3"] = "3x", ["4"] = "4x", ["5"] = "5x"}
+local displayButton = Button(menu)
+:set("types", displayTypes)
+:setText(displayTypes[Settings.current.display])
+:setPosition(bx,64)
+:set("enabled", true)
+:set("isEnabled", function (self) return self.enabled end)
+:set("active", function (self)
+ self.parent.inputBreakTimer = 0.2
+ if Settings.current.display == "fullscreen" then
+ Settings.current.display = "1"
+ elseif Settings.current.display == "5" then
+ Settings.current.display = "fullscreen"
+ else
+ Settings.current.display = tostring(tonumber(Settings.current.display) + 1)
+ end
+ self:setText(self.types[Settings.current.display])
+ Settings.reload()
+end)
+
local a = {
- button:new(menu)
+ background,
+ displayButton,
+ Button(menu)
:setText("Keyboard 1")
:setPosition(bx,80)
:set("setNumber", function () return 1 end)
@@ -74,7 +100,7 @@ local a = {
:set("stopChange", stopChange)
:set("active", startChange)
,
- button:new(menu)
+ Button(menu)
:setText("Keyboard 2")
:setPosition(bx,96)
:set("setNumber", function () return 2 end)
@@ -83,7 +109,7 @@ local a = {
:set("stopChange", stopChange)
:set("active", startChange)
,
- button:new(menu)
+ Button(menu)
:setText("Gamepad 1")
:setPosition(bx,112)
:set("setNumber", function () return 3 end)
@@ -92,7 +118,7 @@ local a = {
:set("stopChange", stopChange)
:set("active", startChange)
,
- button:new(menu)
+ Button(menu)
:setText("Gamepad 2")
:setPosition(bx,128)
:set("setNumber", function () return 4 end)
@@ -101,7 +127,7 @@ local a = {
:set("stopChange", stopChange)
:set("active", startChange)
,
- button:new(menu)
+ Button(menu)
:setText("Go back")
:setPosition(bx,144)
:set("active", function (self)
@@ -111,4 +137,4 @@ local a = {
dimmer
}
-return a \ No newline at end of file
+return a
diff --git a/config/menus/win.lua b/config/menus/win.lua
new file mode 100644
index 0000000..f7163dd
--- /dev/null
+++ b/config/menus/win.lua
@@ -0,0 +1,22 @@
+local menu = ...
+
+local Header = require "not.Header"
+local Element = require "not.Element"
+
+local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale()
+
+return {
+ Element(menu)
+ :setPosition(width/2, 18)
+ :set("draw", function (self, scale)
+ local x,y = self:getPosition()
+ love.graphics.setColor(255, 255, 255, 255)
+ love.graphics.printf("ROFL, NOW KILL YOURSELF", x*scale, y*scale, 160, "center", 0, scale, scale, 80, 3)
+ end)
+ :set("focus", function () return true end)
+ ,
+ Header(menu)
+ :setText("WINNER")
+ :setPosition(width/2,40)
+ ,
+}