summaryrefslogtreecommitdiffhomepage
path: root/config/menus/settings.lua
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/settings.lua
parent0dd01913fe0eefc7ba4bc0797877f40fdedf9315 (diff)
parented62b573417bdc85bec616f6016846b02de4c906 (diff)
downloadroflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.zip
roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.gz
roflnauts-b1cf14d64a2d3e28683db87190c4b2c7799c259d.tar.bz2
Merge branch 'multi'maps
Diffstat (limited to 'config/menus/settings.lua')
-rw-r--r--config/menus/settings.lua48
1 files changed, 37 insertions, 11 deletions
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