From 45b247939e70b35b2855cd09a683ddea14a79873 Mon Sep 17 00:00:00 2001 From: Rin Date: Sat, 21 Aug 2021 17:24:52 +0100 Subject: [PATCH] Add support for many options --- scene/gamemode_config.lua | 18 ++++++++++++++++-- tetris/modes/marathon_a1.lua | 9 +++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scene/gamemode_config.lua b/scene/gamemode_config.lua index 7df6de8..3a297e5 100644 --- a/scene/gamemode_config.lua +++ b/scene/gamemode_config.lua @@ -59,9 +59,23 @@ function GamemodeConfigScene:render() love.graphics.printf(setting, 100 + 110 * j, 100 + i * 20, 100, "center") end else + local curr_index = new_config[option[1]] + local prev_index = Mod1(curr_index-1, #option[3]) + local next_index = Mod1(curr_index+1, #option[3]) + + love.graphics.setColor(1, 1, 1, 0.5) + love.graphics.printf(option[3][prev_index], + 100 + 110 * 1, 100 + i * 20, 100, 'center') + + love.graphics.setColor(1, 1, 1, 1) + love.graphics.printf("< " .. option[3][curr_index] .. " >", + 100 + 110 * 2.5, 100 + i * 20, 100, 'center') + + love.graphics.setColor(1, 1, 1, 0.5) + love.graphics.printf(option[3][next_index], + 100 + 110 * 4, 100 + i * 20, 100, 'center') + love.graphics.setColor(1, 1, 1, 1) - love.graphics.printf(option[3][new_config[option[1]]], -- what an indexer - 100 + 110 * 1, 100 + i * 20, 100, 'center') end end end diff --git a/tetris/modes/marathon_a1.lua b/tetris/modes/marathon_a1.lua index ccec500..f7b4504 100644 --- a/tetris/modes/marathon_a1.lua +++ b/tetris/modes/marathon_a1.lua @@ -254,6 +254,15 @@ function MarathonA1Game:provideSettings() {"allowHardDrop", "Allow hard drop", {"No", "Yes"}} } +--[[ + local opts = {} + for i=1, 10 do + opts[i] = i + end + + table.insert(t, {"manyOptions", "Many options", opts}) +]] + return t end