diff --git a/inc/decision/decision.manager.lua b/inc/decision/decision.manager.lua
index 396529c..1aeaf1c 100644
--- a/inc/decision/decision.manager.lua
+++ b/inc/decision/decision.manager.lua
@@ -98,3 +98,39 @@ function Decision.filter_available(decisions_list)
end
return available
end
+
+--- Draws decision selector.
+--- @within Decision
+--- @param decisions table A table of decision items.
+--- @param selected_decision_index number The index of the selected decision.
+function Decision.draw(decisions, selected_decision_index)
+ local bar_height = 16
+ local bar_y = Config.screen.height - bar_height
+ rect(0, bar_y, Config.screen.width, bar_height, Config.colors.dark_grey)
+ if #decisions > 0 then
+ local selected_decision = decisions[selected_decision_index]
+ local decision_label = selected_decision.label
+ local text_width = #decision_label * 4
+ local text_y = bar_y + 4
+ local text_x = (Config.screen.width - text_width) / 2
+ Print.text("<", 2, text_y, Config.colors.light_blue)
+ Print.text(decision_label, text_x, text_y, Config.colors.item)
+ Print.text(">", Config.screen.width - 6, text_y, Config.colors.light_blue)
+ end
+end
+
+--- Updates decision selector.
+--- @within Decision
+--- @param decisions table A table of decision items.
+--- @param selected_decision_index number The current index of the selected decision.
+--- @return number selected_decision_index The updated index of the selected decision.
+function Decision.update(decisions, selected_decision_index)
+ if Input.left() then
+ Audio.sfx_beep()
+ selected_decision_index = Util.safeindex(decisions, selected_decision_index - 1)
+ elseif Input.right() then
+ Audio.sfx_beep()
+ selected_decision_index = Util.safeindex(decisions, selected_decision_index + 1)
+ end
+ return selected_decision_index
+end
diff --git a/inc/system/system.ui.lua b/inc/system/system.ui.lua
index b101a60..fc34e86 100644
--- a/inc/system/system.ui.lua
+++ b/inc/system/system.ui.lua
@@ -80,26 +80,6 @@ function UI.word_wrap(text, max_chars_per_line)
return lines
end
---- Draws decision selector.
---- @within UI
---- @param decisions table A table of decision items.
---- @param selected_decision_index number The index of the selected decision.
-function UI.draw_decision_selector(decisions, selected_decision_index)
- local bar_height = 16
- local bar_y = Config.screen.height - bar_height
- rect(0, bar_y, Config.screen.width, bar_height, Config.colors.dark_grey)
- if #decisions > 0 then
- local selected_decision = decisions[selected_decision_index]
- local decision_label = selected_decision.label
- local text_width = #decision_label * 4
- local text_y = bar_y + 4
- local text_x = (Config.screen.width - text_width) / 2
- Print.text("<", 2, text_y, Config.colors.light_blue)
- Print.text(decision_label, text_x, text_y, Config.colors.item)
- Print.text(">", Config.screen.width - 6, text_y, Config.colors.light_blue)
- end
-end
-
--- Draws meters.
--- @within UI
function UI.draw_meters()
@@ -132,20 +112,4 @@ function UI.draw_meters()
end
print(meter.label, label_x, label_y, meter.color, false, 1, true)
end
-end
-
---- Updates decision selector.
---- @within UI
---- @param decisions table A table of decision items.
---- @param selected_decision_index number The current index of the selected decision.
---- @return number selected_decision_index The updated index of the selected decision.
-function UI.update_decision_selector(decisions, selected_decision_index)
- if Input.left() then
- Audio.sfx_beep()
- selected_decision_index = Util.safeindex(decisions, selected_decision_index - 1)
- elseif Input.right() then
- Audio.sfx_beep()
- selected_decision_index = Util.safeindex(decisions, selected_decision_index + 1)
- end
- return selected_decision_index
end
\ No newline at end of file
diff --git a/inc/window/window.game.lua b/inc/window/window.game.lua
index f5286cb..d6241ed 100644
--- a/inc/window/window.game.lua
+++ b/inc/window/window.game.lua
@@ -13,7 +13,7 @@ function GameWindow.draw()
end
UI.draw_top_bar(screen.name)
if not Context.stat_screen_active and #_available_decisions > 0 then
- UI.draw_decision_selector(_available_decisions, _selected_decision_index)
+ Decision.draw(_available_decisions, _selected_decision_index)
end
Sprite.draw()
Focus.draw()
@@ -53,7 +53,7 @@ function GameWindow.update()
_selected_decision_index = 1
end
- local new_selected_decision_index = UI.update_decision_selector(
+ local new_selected_decision_index = Decision.update(
_available_decisions,
_selected_decision_index
)