diff options
author | jluehrs2 <jluehrs2@uiuc.edu> | 2007-09-07 17:53:20 -0500 |
---|---|---|
committer | jluehrs2 <jluehrs2@uiuc.edu> | 2007-09-07 17:53:20 -0500 |
commit | 0257d46539fe3118098672917909f2971fe0c8d5 (patch) | |
tree | f49cc5f625fd2dc9e7fe1b4fcf05a2c942403978 /test | |
parent | 52ce195dd00030b84cdc2e2d872438d5d8159102 (diff) | |
download | luancurses-0257d46539fe3118098672917909f2971fe0c8d5.tar.gz luancurses-0257d46539fe3118098672917909f2971fe0c8d5.zip |
basic test program
Diffstat (limited to 'test')
-rw-r--r-- | test/test.lua | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua new file mode 100644 index 0000000..0976b88 --- /dev/null +++ b/test/test.lua @@ -0,0 +1,31 @@ +require "curses" + +curses.initscr(); +curses.start_color(); +curses.setup_term{nl = false, cbreak = true, echo = false, keypad = true} +curses.init_pair("black", "black") +curses.init_pair("green", "green") +curses.init_pair("red", "red") +curses.init_pair("cyan", "cyan") +curses.init_pair("white", "white") +curses.init_pair("magenta", "magenta") +curses.init_pair("blue", "blue") +curses.init_pair("yellow", "yellow") + +local x, y = 0, 0 +local maxy, maxx = curses.getmaxyx() +while true do + local c = curses.getch() + if c == "left" and x > 0 then + x = x - 1 + elseif c == "right" and x < maxx then + x = x + 1 + elseif c == "up" and y > 0 then + y = y - 1 + elseif c == "down" and y < maxy then + y = y + 1 + elseif #c == 1 then + curses.addstr(c) + end + curses.move(y, x) +end |