remove configuration menu
This commit is contained in:
@@ -30,7 +30,6 @@ globals = {
|
||||
"MenuWindow",
|
||||
"GameWindow",
|
||||
"PopupWindow",
|
||||
"ConfigurationWindow",
|
||||
"AudioTestWindow",
|
||||
"MinigameButtonMashWindow",
|
||||
"MinigameRhythmWindow",
|
||||
|
||||
@@ -70,7 +70,6 @@ window/window.intro.title.lua
|
||||
window/window.intro.ttg.lua
|
||||
window/window.intro.brief.lua
|
||||
window/window.menu.lua
|
||||
window/window.configuration.lua
|
||||
window/window.audiotest.lua
|
||||
window/window.popup.lua
|
||||
window/window.minigame.mash.lua
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
--- @section ConfigurationWindow
|
||||
ConfigurationWindow.controls = {}
|
||||
ConfigurationWindow.selected_control = 1
|
||||
|
||||
--- Initializes configuration window.
|
||||
--- @within ConfigurationWindow
|
||||
function ConfigurationWindow.init()
|
||||
ConfigurationWindow.controls = {
|
||||
{
|
||||
label = "Save",
|
||||
action = function() Config.save() end,
|
||||
type = "action_item"
|
||||
},
|
||||
{
|
||||
label = "Restore Defaults",
|
||||
action = function() Config.reset() end,
|
||||
type = "action_item"
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
--- Draws configuration window.
|
||||
--- @within ConfigurationWindow
|
||||
function ConfigurationWindow.draw()
|
||||
UI.draw_top_bar("Configuration")
|
||||
|
||||
local x_start = 10
|
||||
local y_start = 40
|
||||
local x_value_right_align = Config.screen.width - 10
|
||||
local char_width = 4
|
||||
for i, control in ipairs(ConfigurationWindow.controls) do
|
||||
local current_y = y_start + (i - 1) * 12
|
||||
local color = Config.colors.light_blue
|
||||
if control.type == "numeric_stepper" then
|
||||
local value = control.get()
|
||||
local label_text = control.label
|
||||
local value_text = string.format(control.format, value)
|
||||
local value_x = x_value_right_align - (#value_text * char_width)
|
||||
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
Print.text("<", x_start - 8, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(value_text, value_x, current_y, color)
|
||||
Print.text(">", x_value_right_align + 4, current_y, color)
|
||||
else
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(value_text, value_x, current_y, color)
|
||||
end
|
||||
elseif control.type == "action_item" then
|
||||
local label_text = control.label
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
Print.text("<", x_start - 8, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(">", x_start + 8 + (#label_text * char_width) + 4, current_y, color)
|
||||
else
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
Print.text("Press B to go back", x_start, 120, Config.colors.light_grey)
|
||||
end
|
||||
|
||||
--- Updates configuration window logic.
|
||||
--- @within ConfigurationWindow
|
||||
function ConfigurationWindow.update()
|
||||
if Input.back() then
|
||||
GameWindow.set_state("menu")
|
||||
return
|
||||
end
|
||||
|
||||
if Input.up() then
|
||||
ConfigurationWindow.selected_control = ConfigurationWindow.selected_control - 1
|
||||
if ConfigurationWindow.selected_control < 1 then
|
||||
ConfigurationWindow.selected_control = #ConfigurationWindow.controls
|
||||
end
|
||||
elseif Input.down() then
|
||||
ConfigurationWindow.selected_control = ConfigurationWindow.selected_control + 1
|
||||
if ConfigurationWindow.selected_control > #ConfigurationWindow.controls then
|
||||
ConfigurationWindow.selected_control = 1
|
||||
end
|
||||
end
|
||||
|
||||
local control = ConfigurationWindow.controls[ConfigurationWindow.selected_control]
|
||||
if control then
|
||||
if control.type == "numeric_stepper" then
|
||||
local current_value = control.get()
|
||||
if Input.left() then
|
||||
local new_value = math.max(control.min, current_value - control.step)
|
||||
control.set(new_value)
|
||||
elseif Input.right() then
|
||||
local new_value = math.min(control.max, current_value + control.step)
|
||||
control.set(new_value)
|
||||
end
|
||||
elseif control.type == "action_item" then
|
||||
if Input.select() then
|
||||
control.action()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -84,13 +84,6 @@ function MenuWindow.exit()
|
||||
exit()
|
||||
end
|
||||
|
||||
--- Opens the configuration menu.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.configuration()
|
||||
ConfigurationWindow.init()
|
||||
GameWindow.set_state("configuration")
|
||||
end
|
||||
|
||||
--- Opens the audio test menu.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.audio_test()
|
||||
@@ -124,7 +117,6 @@ function MenuWindow.refresh_menu_items()
|
||||
|
||||
table.insert(_menu_items, {label = "New Game", decision = MenuWindow.new_game})
|
||||
table.insert(_menu_items, {label = "Load Game", decision = MenuWindow.load_game})
|
||||
table.insert(_menu_items, {label = "Configuration", decision = MenuWindow.configuration})
|
||||
|
||||
if Context.test_mode then
|
||||
table.insert(_menu_items, {label = "Audio Test", decision = MenuWindow.audio_test})
|
||||
|
||||
@@ -16,9 +16,6 @@ Window.register("game", GameWindow)
|
||||
PopupWindow = {}
|
||||
Window.register("popup", PopupWindow)
|
||||
|
||||
ConfigurationWindow = {}
|
||||
Window.register("configuration", ConfigurationWindow)
|
||||
|
||||
AudioTestWindow = {}
|
||||
Window.register("audiotest", AudioTestWindow)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user