diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-10 14:25:45 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-10 14:26:38 -0800 |
commit | dc05a10e23cc341fe76e6021f06f08cbc1e6a339 (patch) | |
tree | 044a37cdac2b1e73c84c9c56d5fd23aa033f8111 /life.teliva | |
parent | 38f46a4e9201e1a66b3c5ca0a8784a5c77dbed80 (diff) | |
download | teliva-dc05a10e23cc341fe76e6021f06f08cbc1e6a339.tar.gz |
life: move starting pattern around on the screen
This assumes we're doing it early soon after opening a new pattern, when it hasn't yet reached the margins. Quick and dirty, but seems good enough.
Diffstat (limited to 'life.teliva')
-rw-r--r-- | life.teliva | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/life.teliva b/life.teliva index b18298f..cd84777 100644 --- a/life.teliva +++ b/life.teliva @@ -219,8 +219,42 @@ function load_file(window, filename) end +menu = {arrow="pan"} function update(window) - curses.getch() -- just check for menu keys + c = curses.getch() + if c == curses.KEY_LEFT then + for i=1,lines*4 do + for j=2,cols*2 do + grid[i][j-1] = grid[i][j] + end + grid[i][cols*2] = 0 + end + elseif c == curses.KEY_DOWN then + for i=lines*4-1,1,-1 do + for j=1,cols*2 do + grid[i+1][j] = grid[i][j] + end + end + for j=1,cols*2 do + grid[1][j] = 0 + end + elseif c == curses.KEY_UP then + for i=2,lines*4 do + for j=1,cols*2 do + grid[i][j-1] = grid[i][j+1] + end + end + for j=1,cols*2 do + grid[lines*4][j] = 0 + end + elseif c == curses.KEY_RIGHT then + for i=1,lines*4 do + for j=cols*2-1,1,-1 do + grid[i][j+1] = grid[i][j] + end + grid[i][1] = 0 + end + end end |