9#ifndef ASW_MODULES_UI_CHOICE_H
10#define ASW_MODULES_UI_CHOICE_H
67 std::size_t
count()
const;
73 void select(std::size_t i);
A button that cycles through a list of options, e.g. difficulty or window mode.
std::size_t index
Index of the selected option.
void select(std::size_t i)
Select an option by index without calling on_change.
std::function< void(std::size_t)> on_change
Callback invoked with the new index when the user changes it.
bool on_event(Context &ctx, const UIEvent &e) override
Handle left and right while focused.
std::vector< asw::Texture > images
Option textures, one per option. Optional.
void prev()
Move to the previous option, calls on_change.
std::optional< bool > adjust_on_left_right
Whether left and right change the option. Empty to decide from the layout: off in a row with other fo...
void activate(Context &ctx) override
Move to the next option, then call on_click.
bool show_arrows
Show < and > at the sides while highlighted, when there is text and left and right change the option.
bool wrap
Wrap around at either end.
void draw(Context &ctx) override
Draw the selected option.
bool adjusts_left_right() const
Whether left and right change the option right now.
void next()
Move to the next option, calls on_change.
std::size_t count() const
Number of options, the larger of options and images.
std::vector< std::string > options
Option labels.
Shared state for the UI system.
Event structure for UI interactions.