diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-21 23:46:08 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-21 23:50:10 -0800 |
commit | 86dfa10e05d835abaf12c6a8735fbbd77da8d2ae (patch) | |
tree | 798e378434981f13febbc591e6ed7d5ff98ca330 | |
parent | f9cd9f75c532f869009775084806b3671b29fc2c (diff) | |
download | teliva-86dfa10e05d835abaf12c6a8735fbbd77da8d2ae.tar.gz |
chesstv.tlv: render clocks
-rw-r--r-- | chesstv.tlv | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chesstv.tlv b/chesstv.tlv index e570ddb..d9dea99 100644 --- a/chesstv.tlv +++ b/chesstv.tlv @@ -96,11 +96,18 @@ function render_fen_rank(rank, fen_rank, highlighted_squares) end end end]==], + render_time = [==[ +function render_time(y, x, seconds) + if seconds == nil then return end + curses.mvaddstr(y, x, tostring(math.floor(seconds/60))) + curses.addstr(string.format(":%02d", seconds%60)) +end]==], render_board = [==[ function render_board(current_game) --? curses.mvaddstr(1, 50, dump(current_game.fen)) --? curses.mvaddstr(6, 50, dump(current_game.previously_moved_squares)) render_player(2, 5, top_player(current_game)) + render_time(2, 35, current_game.bc) for rank=8,1,-1 do for file=1,8 do render_square(current_game, rank, file, current_game.previously_moved_squares) @@ -108,6 +115,7 @@ function render_board(current_game) render_fen_rank(rank, current_game.fen_rank[8-rank+1], current_game.previously_moved_squares) end render_player(27, 5, bottom_player(current_game)) + render_time(27, 35, current_game.wc) end]==], parse_lm = [==[ function parse_lm(move) |