Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2: TUI UI – "higher level" abstractions #131

Open
4 of 8 tasks
robbielyman opened this issue Jun 19, 2024 · 0 comments
Open
4 of 8 tasks

v2: TUI UI – "higher level" abstractions #131

robbielyman opened this issue Jun 19, 2024 · 0 comments
Milestone

Comments

@robbielyman
Copy link
Owner

robbielyman commented Jun 19, 2024

  • currently seamstress emits render events periodically. render events should instead be requested by Lua.
    • something like seamstress.update.time = 1/60 should request that seamstress emit an update event at 60Hz
      • 60Hz meaning rain or shine, as in attempting to stay on beat even if in actuality the event fires a little late
      • making the value 0 or negative cancels the timer
      • if any callback returns _, true from update, a { 'tui', 'draw' } event is emitted
      • eventually the same should be true for GUI window draw events
  • tui event responders should trigger { 'tui', 'draw' } if any of them return _, true
    • i think this has to be hardcoded (i.e. in Zig?) because that is who is calling publish?
  • there should be a higher-level set of UI primitives built in to seamstress.tui
    • Panes contain other primitives and provide relative coordinates
    • Buttons respond to click events by calling a function
    • Tabs stack Panes
    • scrollable text boxes? how custom should the REPL be?
robbielyman added a commit that referenced this issue Jun 20, 2024
event listeners may now optionally return a second value;
all non-nil values will be presented to the caller of
`seamstress.event.publish` as an array. (this is cribbed very heavily
from mediator_lua.) in the case of `{ 'tui', ... }` events raised by
seamstress itself, if any of the returned values are truthy, a draw
event is triggered. by default, the last responder (priority 0) to
`draw` calls `seamstress.tui.renderCommit` to actually push the
updated cells to the terminal.

this commit adds `Timer` to the Lua layer, similar to `metro` from
norns / seamstress 1. some differences: no new threads are spawned, so
there is no limit on the number of timers. the timer has not gone back
to sleep during the callback, so `pattern_time`-style dynamic timers
should be much simpler to program. the type is entirely implemented in
Zig, (yet memory is fully Lua-owned) so there is no actual `timer.lua`
file. `seamstress.update` is available as a timer which will spawn an
update-into-possible-draw event when enabled.

this represents partial progress towards #131.
robbielyman added a commit that referenced this issue Jun 20, 2024
event listeners may now optionally return a second value;
all non-nil values will be presented to the caller of
`seamstress.event.publish` as an array. (this is cribbed very heavily
from mediator_lua.) in the case of `{ 'tui', ... }` events raised by
seamstress itself, if any of the returned values are truthy, a draw
event is triggered. by default, the last responder (priority 0) to
`draw` calls `seamstress.tui.renderCommit` to actually push the
updated cells to the terminal.

this commit adds `Timer` to the Lua layer, similar to `metro` from
norns / seamstress 1. some differences: no new threads are spawned, so
there is no limit on the number of timers. the timer has not gone back
to sleep during the callback, so `pattern_time`-style dynamic timers
should be much simpler to program. the type is entirely implemented in
Zig, (yet memory is fully Lua-owned) so there is no actual `timer.lua`
file. `seamstress.update` is available as a timer which will spawn an
update-into-possible-draw event when enabled.

this represents partial progress towards #131.
@robbielyman robbielyman added this to the v2.0.0 milestone Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant