diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-02-27 08:38:48 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-02-27 08:41:30 -0800 |
commit | ae51b06dabbae991914aff281ff42addbcd21146 (patch) | |
tree | 7a24f1d7f22409dd1a0110cf82f1a930e64db061 /life.tlv | |
parent | 891bced5443cde47f51626d962e87df7d084a64c (diff) | |
download | teliva-ae51b06dabbae991914aff281ff42addbcd21146.tar.gz |
starting to make Teliva apps more testable
Tasteful apps should only perform side-effects through 'window' arguments rather than the 'curses' module directly. It's ok however to read constants like curses.A_NORMAL or curses.stdscr(). There are some limitations, unfortunately. Ncurses wasn't designed with testability in mind. For example, there's no way to curs_set or assume_default_colors without the 'curses' module. Oh well.
Diffstat (limited to 'life.tlv')
-rw-r--r-- | life.tlv | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/life.tlv b/life.tlv index 804ae49..e592669 100644 --- a/life.tlv +++ b/life.tlv @@ -110,14 +110,14 @@ render: >function render(window) > window:clear() - > curses.attron(curses.color_pair(1)) + > window:attron(curses.color_pair(1)) > for line=1,lines do > for col=1,cols do > window:addstr(utf8(glyph[grid_char_to_glyph_index(grid_char(line, col))])) > end > end - > curses.attroff(curses.color_pair(1)) - > curses.refresh() + > window:attroff(curses.color_pair(1)) + > window:refresh() >end - __teliva_timestamp: original state: @@ -291,7 +291,7 @@ > -- main loop > while true do > render(window) - > c = curses.getch() + > c = window:getch() > update(window, c) > step() > end |