<< Previous | Next >>

Some hotel, finally

No I haven't been working on hotel much; seems like every weekend there is something to do. But something does keep moving every now and then.

Already two weeks ago, I added some expiremental extension support, and added an ncurses binding. The following works and moves an x around in the (terminal) screen:

initscr()

var x = 10
var y = 10
var ch = 1

while (true) {
    ch = getch()
    if (ch == 65) x = x - 1  # up
    if (ch == 66) x = x + 1  # down
    if (ch == 67) y = y + 1  # right
    if (ch == 68) y = y - 1  # left

    # only lower bound checking
    if (x < 0) x = 0
    if (y < 0) y = 0

    erase()
    move(x, y)
    printw("x")
    refresh()
}
endwin()

Last modified: 2007-11-19 20:18 GMT