From 37767d6c54ea6af0b4631b5ce838ee584603895e Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 7 Apr 2017 02:53:36 +0200 Subject: Moved menu configs to subdirectory --- config/menucredits.lua | 24 ---------- config/menuhost.lua | 42 ----------------- config/menumain.lua | 59 ------------------------ config/menus/credits.lua | 24 ++++++++++ config/menus/host.lua | 42 +++++++++++++++++ config/menus/main.lua | 59 ++++++++++++++++++++++++ config/menus/select.lua | 73 +++++++++++++++++++++++++++++ config/menus/settings.lua | 114 ++++++++++++++++++++++++++++++++++++++++++++++ config/menuselect.lua | 73 ----------------------------- config/menusettings.lua | 114 ---------------------------------------------- 10 files changed, 312 insertions(+), 312 deletions(-) delete mode 100644 config/menucredits.lua delete mode 100644 config/menuhost.lua delete mode 100644 config/menumain.lua create mode 100644 config/menus/credits.lua create mode 100644 config/menus/host.lua create mode 100644 config/menus/main.lua create mode 100644 config/menus/select.lua create mode 100644 config/menus/settings.lua delete mode 100644 config/menuselect.lua delete mode 100644 config/menusettings.lua (limited to 'config') diff --git a/config/menucredits.lua b/config/menucredits.lua deleted file mode 100644 index 0510333..0000000 --- a/config/menucredits.lua +++ /dev/null @@ -1,24 +0,0 @@ -local menu = ... - -local button = require "button" -local element = require "element" - -local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() -local bx = width/2-29 - -return { - button:new(menu) - :setText("Go back") - :setPosition(bx,144) - :set("active", function (self) - self.parent:open("menumain") - end) - , - element:new(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/menuhost.lua b/config/menuhost.lua deleted file mode 100644 index ae5e3dd..0000000 --- a/config/menuhost.lua +++ /dev/null @@ -1,42 +0,0 @@ -local menu = ... - -local button = require "button" -local selector = require "selector" - -local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale() -local bx = width/2-29 - -local map_selector = selector:new(menu) - -return { - map_selector - :setPosition(width/2, 40) - :setSize(80, 42) - :setMargin(0) - :set("global", true) - :set("first", true) - :set("list", require "maplist") - :set("icons_i", love.graphics.newImage("assets/maps.png")) - :set("icons_q", require "mapicons") - :set("shape", "panorama") - :init() - , - button:new(menu) - :setText("Next") - :setPosition(bx,101) - :set("isEnabled", function () - return map_selector:isLocked() - end) - :set("active", function (self) - MAP = map_selector:getFullSelection(true)[1][1] -- please, don't kill me for this, kek - self.parent:open("menuselect") - end) - , - button:new(menu) - :setText("Go back") - :setPosition(bx,117) - :set("active", function (self) - self.parent:open("menumain") - end) - , -} \ No newline at end of file diff --git a/config/menumain.lua b/config/menumain.lua deleted file mode 100644 index 4e5ef1f..0000000 --- a/config/menumain.lua +++ /dev/null @@ -1,59 +0,0 @@ -local menu = ... - -local button = require "button" -local header = require "header" -local element = require "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") - -return { - button:new(menu) - :setText("Start") - :setPosition(bx, 80) - :set("active", function (self) - self.parent:open("menuhost") - end) - , - button:new(menu) - :setText("Join") - :setPosition(bx, 96) - :set("isEnabled", function (self) - return false - end) - , - button:new(menu) - :setText("Settings") - :setPosition(bx, 112) - :set("active", function (self) - self.parent:open("menusettings") - end) - , - button:new(menu) - :setText("Credits") - :setPosition(bx, 128) - :set("active", function (self) - self.parent:open("menucredits") - end) - , - button:new(menu) - :setText("Exit") - :setPosition(bx, 144) - :set("active", love.event.quit) - , - element:new(menu) - :setPosition(width/2, 15) - :set("draw", function (self, scale) - local x,y = self:getPosition() - love.graphics.setColor(255, 255, 255, 255) - love.graphics.setFont(Bold) - love.graphics.draw(awesometwo, x*scale, y*scale, 0, scale, scale, 35) - end) - , - header:new(menu) - :setText("Roflnauts") - :setPosition(width/2,40) - , -} \ No newline at end of file diff --git a/config/menus/credits.lua b/config/menus/credits.lua new file mode 100644 index 0000000..6ba04b3 --- /dev/null +++ b/config/menus/credits.lua @@ -0,0 +1,24 @@ +local menu = ... + +local button = require "button" +local element = require "element" + +local width, height = love.graphics.getWidth()/getRealScale(), love.graphics.getHeight()/getRealScale() +local bx = width/2-29 + +return { + button:new(menu) + :setText("Go back") + :setPosition(bx,144) + :set("active", function (self) + self.parent:open("main") + end) + , + element:new(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 new file mode 100644 index 0000000..47aaa5e --- /dev/null +++ b/config/menus/host.lua @@ -0,0 +1,42 @@ +local menu = ... + +local button = require "button" +local selector = require "selector" + +local width, height = love.graphics.getWidth()/getScale(), love.graphics.getHeight()/getScale() +local bx = width/2-29 + +local map_selector = selector:new(menu) + +return { + map_selector + :setPosition(width/2, 40) + :setSize(80, 42) + :setMargin(0) + :set("global", true) + :set("first", true) + :set("list", require "maplist") + :set("icons_i", love.graphics.newImage("assets/maps.png")) + :set("icons_q", require "mapicons") + :set("shape", "panorama") + :init() + , + button:new(menu) + :setText("Next") + :setPosition(bx,101) + :set("isEnabled", function () + return map_selector:isLocked() + end) + :set("active", function (self) + MAP = map_selector:getFullSelection(true)[1][1] -- please, don't kill me for this, kek + self.parent:open("select") + end) + , + button:new(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 new file mode 100644 index 0000000..661299c --- /dev/null +++ b/config/menus/main.lua @@ -0,0 +1,59 @@ +local menu = ... + +local button = require "button" +local header = require "header" +local element = require "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") + +return { + button:new(menu) + :setText("Start") + :setPosition(bx, 80) + :set("active", function (self) + self.parent:open("host") + end) + , + button:new(menu) + :setText("Join") + :setPosition(bx, 96) + :set("isEnabled", function (self) + return false + end) + , + button:new(menu) + :setText("Settings") + :setPosition(bx, 112) + :set("active", function (self) + self.parent:open("settings") + end) + , + button:new(menu) + :setText("Credits") + :setPosition(bx, 128) + :set("active", function (self) + self.parent:open("credits") + end) + , + button:new(menu) + :setText("Exit") + :setPosition(bx, 144) + :set("active", love.event.quit) + , + element:new(menu) + :setPosition(width/2, 15) + :set("draw", function (self, scale) + local x,y = self:getPosition() + love.graphics.setColor(255, 255, 255, 255) + love.graphics.setFont(Bold) + love.graphics.draw(awesometwo, x*scale, y*scale, 0, scale, scale, 35) + end) + , + header:new(menu) + :setText("Roflnauts") + :setPosition(width/2,40) + , +} \ No newline at end of file diff --git a/config/menus/select.lua b/config/menus/select.lua new file mode 100644 index 0000000..452a3bf --- /dev/null +++ b/config/menus/select.lua @@ -0,0 +1,73 @@ +local menu = ... + +local button = require "button" +local selector = require "selector" +local element = require "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) + +return { + naut_selector + :setPosition(width/2,60) + :setMargin(8) + :setSize(32, 32) + :set("list", require "nautslist") + :set("global", false) + :set("icons_i", love.graphics.newImage("assets/portraits.png")) + :set("icons_q", require "nautsicons") + :init() + , + 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)) + end + end) + , + button:new(menu) + :setText("Go back") + :setPosition(bx,150) + :set("active", function (self) + self.parent:open("host") + 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 diff --git a/config/menus/settings.lua b/config/menus/settings.lua new file mode 100644 index 0000000..bfdfc6e --- /dev/null +++ b/config/menus/settings.lua @@ -0,0 +1,114 @@ +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 keys = {"Left", "Right", "Up", "Down", "Attack", "Jump"} + +local dimmer = element:new(menu) + :setPosition(width/2, 15) + :set("visible", false) + :set("currentControl", "Left") -- it actually means control that is being set CURRENTLY + :set("previousControl", "") -- it actually means key that was set as this control PREVIOUSLY + :set("draw", function (self, scale) + if self.visible then + love.graphics.setColor(0, 0, 0, 210) + love.graphics.rectangle("fill",0,0,width*getRealScale(),height*getRealScale()) + love.graphics.setColor(120, 255, 120, 255) + love.graphics.printf("Press new key for: \n> " .. self.currentControl .. " <", (width/2-110)*scale, (height/2-4)*scale, 220, "center", 0, scale, scale) + love.graphics.setColor(120, 120, 120, 255) + love.graphics.printf("Old: " .. self.previousControl .. "", (width/2-110)*scale, (height/2+16)*scale, 220, "center", 0, scale, scale) + love.graphics.setColor(255, 255, 255, 255) + end + end) + +-- CHANGER functions +local isEnabled = function (self) + if Controller.getSets()[self.setNumber()] and not self.inProgress then + return true + else + return false + end +end +local startChange = function (self) + dimmer:set("visible", true):set("currentControl", "Left") + self.parent.allowMove = false + self.inProgress = true + self.currentKey = 0 + -- Displaying old key should be done less tricky; REWORK NEEDED + dimmer:set("previousControl", Controller.sets[self.setNumber()][string.lower(keys[self.currentKey+1])]) + self.newSet = {} +end +local controlreleased = function(self, set, action, key) + if self.inProgress then + if self.currentKey > 0 and self.currentKey < 7 then + table.insert(self.newSet, key) + dimmer:set("currentControl", keys[self.currentKey+1]) + end + -- There is something wrong with this `if` statements... I mean, look at these numbers. + if self.currentKey > 5 then + dimmer:set("visible", false) + self.parent.allowMove = true + self.inProgress = false + table.insert(self.newSet, Controller.getSets()[self.setNumber()].joystick) + print(self.newSet[7]) + Settings.change(self.setNumber(), self.newSet[1], self.newSet[2], self.newSet[3], self.newSet[4], self.newSet[5], self.newSet[6], self.newSet[7]) + else + dimmer:set("previousControl", Controller.sets[self.setNumber()][string.lower(keys[self.currentKey+1])]) + self.currentKey = self.currentKey + 1 + end + end +end + +local a = { + button:new(menu) + :setText("Keyboard 1") + :setPosition(bx,80) + :set("setNumber", function () return 1 end) + :set("isEnabled", isEnabled) + :set("controlreleased", controlreleased) + :set("stopChange", stopChange) + :set("active", startChange) + , + button:new(menu) + :setText("Keyboard 2") + :setPosition(bx,96) + :set("setNumber", function () return 2 end) + :set("isEnabled", isEnabled) + :set("controlreleased", controlreleased) + :set("stopChange", stopChange) + :set("active", startChange) + , + button:new(menu) + :setText("Gamepad 1") + :setPosition(bx,112) + :set("setNumber", function () return 3 end) + :set("isEnabled", isEnabled) + :set("controlreleased", controlreleased) + :set("stopChange", stopChange) + :set("active", startChange) + , + button:new(menu) + :setText("Gamepad 2") + :setPosition(bx,128) + :set("setNumber", function () return 4 end) + :set("isEnabled", isEnabled) + :set("controlreleased", controlreleased) + :set("stopChange", stopChange) + :set("active", startChange) + , + button:new(menu) + :setText("Go back") + :setPosition(bx,144) + :set("active", function (self) + self.parent:open("main") + end) + , + dimmer +} + +return a \ No newline at end of file diff --git a/config/menuselect.lua b/config/menuselect.lua deleted file mode 100644 index 7b9f073..0000000 --- a/config/menuselect.lua +++ /dev/null @@ -1,73 +0,0 @@ -local menu = ... - -local button = require "button" -local selector = require "selector" -local element = require "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) - -return { - naut_selector - :setPosition(width/2,60) - :setMargin(8) - :setSize(32, 32) - :set("list", require "nautslist") - :set("global", false) - :set("icons_i", love.graphics.newImage("assets/portraits.png")) - :set("icons_q", require "nautsicons") - :init() - , - 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)) - end - end) - , - button:new(menu) - :setText("Go back") - :setPosition(bx,150) - :set("active", function (self) - self.parent:open("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 diff --git a/config/menusettings.lua b/config/menusettings.lua deleted file mode 100644 index 19f952e..0000000 --- a/config/menusettings.lua +++ /dev/null @@ -1,114 +0,0 @@ -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 keys = {"Left", "Right", "Up", "Down", "Attack", "Jump"} - -local dimmer = element:new(menu) - :setPosition(width/2, 15) - :set("visible", false) - :set("currentControl", "Left") -- it actually means control that is being set CURRENTLY - :set("previousControl", "") -- it actually means key that was set as this control PREVIOUSLY - :set("draw", function (self, scale) - if self.visible then - love.graphics.setColor(0, 0, 0, 210) - love.graphics.rectangle("fill",0,0,width*getRealScale(),height*getRealScale()) - love.graphics.setColor(120, 255, 120, 255) - love.graphics.printf("Press new key for: \n> " .. self.currentControl .. " <", (width/2-110)*scale, (height/2-4)*scale, 220, "center", 0, scale, scale) - love.graphics.setColor(120, 120, 120, 255) - love.graphics.printf("Old: " .. self.previousControl .. "", (width/2-110)*scale, (height/2+16)*scale, 220, "center", 0, scale, scale) - love.graphics.setColor(255, 255, 255, 255) - end - end) - --- CHANGER functions -local isEnabled = function (self) - if Controller.getSets()[self.setNumber()] and not self.inProgress then - return true - else - return false - end -end -local startChange = function (self) - dimmer:set("visible", true):set("currentControl", "Left") - self.parent.allowMove = false - self.inProgress = true - self.currentKey = 0 - -- Displaying old key should be done less tricky; REWORK NEEDED - dimmer:set("previousControl", Controller.sets[self.setNumber()][string.lower(keys[self.currentKey+1])]) - self.newSet = {} -end -local controlreleased = function(self, set, action, key) - if self.inProgress then - if self.currentKey > 0 and self.currentKey < 7 then - table.insert(self.newSet, key) - dimmer:set("currentControl", keys[self.currentKey+1]) - end - -- There is something wrong with this `if` statements... I mean, look at these numbers. - if self.currentKey > 5 then - dimmer:set("visible", false) - self.parent.allowMove = true - self.inProgress = false - table.insert(self.newSet, Controller.getSets()[self.setNumber()].joystick) - print(self.newSet[7]) - Settings.change(self.setNumber(), self.newSet[1], self.newSet[2], self.newSet[3], self.newSet[4], self.newSet[5], self.newSet[6], self.newSet[7]) - else - dimmer:set("previousControl", Controller.sets[self.setNumber()][string.lower(keys[self.currentKey+1])]) - self.currentKey = self.currentKey + 1 - end - end -end - -local a = { - button:new(menu) - :setText("Keyboard 1") - :setPosition(bx,80) - :set("setNumber", function () return 1 end) - :set("isEnabled", isEnabled) - :set("controlreleased", controlreleased) - :set("stopChange", stopChange) - :set("active", startChange) - , - button:new(menu) - :setText("Keyboard 2") - :setPosition(bx,96) - :set("setNumber", function () return 2 end) - :set("isEnabled", isEnabled) - :set("controlreleased", controlreleased) - :set("stopChange", stopChange) - :set("active", startChange) - , - button:new(menu) - :setText("Gamepad 1") - :setPosition(bx,112) - :set("setNumber", function () return 3 end) - :set("isEnabled", isEnabled) - :set("controlreleased", controlreleased) - :set("stopChange", stopChange) - :set("active", startChange) - , - button:new(menu) - :setText("Gamepad 2") - :setPosition(bx,128) - :set("setNumber", function () return 4 end) - :set("isEnabled", isEnabled) - :set("controlreleased", controlreleased) - :set("stopChange", stopChange) - :set("active", startChange) - , - button:new(menu) - :setText("Go back") - :setPosition(bx,144) - :set("active", function (self) - self.parent:open("menumain") - end) - , - dimmer -} - -return a \ No newline at end of file -- cgit v1.1