2020-10-10 18:42:56 -05:00
|
|
|
local ConfigScene = Scene:extend()
|
|
|
|
|
|
|
|
ConfigScene.title = "Game Settings"
|
|
|
|
|
|
|
|
require 'load.save'
|
|
|
|
|
|
|
|
ConfigScene.options = {
|
2020-11-08 15:19:01 -06:00
|
|
|
-- this serves as reference to what the options' values mean i guess?
|
|
|
|
{"manlock", "Manual locking",{"Per ruleset","Per gamemode","Harddrop", "Softdrop"}},
|
|
|
|
{"piece_colour", "Piece Colours", {"Per ruleset","Arika" ,"TTC"}},
|
2020-11-10 15:10:10 -06:00
|
|
|
{"world_reverse","A Button Rotation", {"Left" ,"Auto" ,"Right"}},
|
2020-10-10 18:42:56 -05:00
|
|
|
}
|
|
|
|
local optioncount = #ConfigScene.options
|
|
|
|
|
|
|
|
function ConfigScene:new()
|
|
|
|
-- load current config
|
|
|
|
self.config = config.input
|
|
|
|
self.highlight = 1
|
2020-11-06 19:49:44 -06:00
|
|
|
|
2020-10-10 20:17:48 -05:00
|
|
|
DiscordRPC:update({
|
2020-11-06 19:49:44 -06:00
|
|
|
details = "In menus",
|
|
|
|
state = "Changing game settings",
|
|
|
|
})
|
2020-10-10 18:42:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
function ConfigScene:update()
|
|
|
|
end
|
|
|
|
|
|
|
|
function ConfigScene:render()
|
|
|
|
love.graphics.setColor(1, 1, 1, 1)
|
|
|
|
love.graphics.draw(
|
|
|
|
backgrounds["game_config"],
|
|
|
|
0, 0, 0,
|
|
|
|
0.5, 0.5
|
|
|
|
)
|
2020-11-06 19:49:44 -06:00
|
|
|
|
2020-10-10 18:42:56 -05:00
|
|
|
love.graphics.setFont(font_3x5_4)
|
2020-11-06 19:49:44 -06:00
|
|
|
love.graphics.print("GAME SETTINGS", 80, 40)
|
|
|
|
|
2020-10-10 18:42:56 -05:00
|
|
|
love.graphics.setColor(1, 1, 1, 0.5)
|
2020-11-06 19:49:44 -06:00
|
|
|
love.graphics.rectangle("fill", 20, 98 + self.highlight * 20, 170, 22)
|
|
|
|
|
2020-10-10 18:42:56 -05:00
|
|
|
love.graphics.setFont(font_3x5_2)
|
|
|
|
for i, option in ipairs(ConfigScene.options) do
|
2020-11-06 19:49:44 -06:00
|
|
|
love.graphics.setColor(1, 1, 1, 1)
|
|
|
|
love.graphics.printf(option[2], 40, 100 + i * 20, 150, "left")
|
|
|
|
for j, setting in ipairs(option[3]) do
|
|
|
|
love.graphics.setColor(1, 1, 1, config.gamesettings[option[1]] == j and 1 or 0.5)
|
|
|
|
love.graphics.printf(setting, 100 + 110 * j, 100 + i * 20, 100, "center")
|
|
|
|
end
|
2020-10-10 18:42:56 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-11-08 14:55:06 -06:00
|
|
|
function ConfigScene:onInputPress(e)
|
2020-11-10 20:26:19 -06:00
|
|
|
if e.input == "menu_decide" or e.scancode == "return" then
|
2020-10-10 18:42:56 -05:00
|
|
|
playSE("mode_decide")
|
|
|
|
saveConfig()
|
|
|
|
scene = TitleScene()
|
2020-11-10 19:08:34 -06:00
|
|
|
elseif e.input == "up" or e.scancode == "up" then
|
2020-10-10 18:42:56 -05:00
|
|
|
playSE("cursor")
|
|
|
|
self.highlight = Mod1(self.highlight-1, optioncount)
|
2020-11-10 19:08:34 -06:00
|
|
|
elseif e.input == "down" or e.scancode == "down" then
|
2020-10-10 18:42:56 -05:00
|
|
|
playSE("cursor")
|
|
|
|
self.highlight = Mod1(self.highlight+1, optioncount)
|
2020-11-10 19:08:34 -06:00
|
|
|
elseif e.input == "left" or e.scancode == "left" then
|
2020-10-10 18:42:56 -05:00
|
|
|
playSE("cursor_lr")
|
2020-11-06 19:49:44 -06:00
|
|
|
local option = ConfigScene.options[self.highlight]
|
|
|
|
config.gamesettings[option[1]] = Mod1(config.gamesettings[option[1]]-1, #option[3])
|
2020-11-10 19:08:34 -06:00
|
|
|
elseif e.input == "right" or e.scancode == "right" then
|
2020-10-10 18:42:56 -05:00
|
|
|
playSE("cursor_lr")
|
2020-11-06 19:49:44 -06:00
|
|
|
local option = ConfigScene.options[self.highlight]
|
|
|
|
config.gamesettings[option[1]] = Mod1(config.gamesettings[option[1]]+1, #option[3])
|
2020-11-10 20:26:19 -06:00
|
|
|
elseif e.input == "menu_back" or e.scancode == "delete" or e.scancode == "backspace" then
|
2020-11-06 19:49:44 -06:00
|
|
|
loadSave()
|
|
|
|
scene = TitleScene()
|
2020-10-10 18:42:56 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return ConfigScene
|