feat!: timers, rework update / draw cycle #132
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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) todraw
callsseamstress.tui.renderCommit
to actually push the updated cells to the terminal.this commit adds
Timer
to the Lua layer, similar tometro
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, sopattern_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 actualtimer.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.