Red Dot Rising
README.md
Focus
Menu focus navigation for a controller: an ordered ring of focusable ids with exactly one lit, walked by a stick or d-pad with held-repeat, re-pointed by a pointer crossing a row or a finger tapping it. Installed from ZeroMind for the cards of RED DOT RISING; the ui slice owns it.
local Focus = require("game.vendor.Focus")
Focus.open({ "start", "howto" }, "start") -- the ring, and which id starts lit
Focus.axis({ x = 0, y = -1 }, dt) -- feed the navigate axis each frame
Focus.id() -- the lit id
Focus.point("howto") -- a hover or a tap moves the light
Focus.close()
Exports: open, close, id, isFocused, generation, step, axis,
point, items, release. generation changes every time a menu opens, so
a screen that animates its entrance keys off it; release lets go of a held
direction when a menu closes.