Comparing version 0.0.2 to 0.0.3
{ | ||
"name" : "curses", | ||
"version" : "0.0.2", | ||
"version" : "0.0.3", | ||
"description" : "Bindings for the native curses library, a full featured console IO library.", | ||
@@ -5,0 +5,0 @@ "main" : "./curses", |
@@ -43,12 +43,51 @@ | ||
/* load curses */ | ||
var curses = require('./curses') | ||
/* load curses */ | ||
var curses = require('curses') | ||
/* initialize top level window */ | ||
, stdwin = curses.initscr() | ||
/* initialize top level window */ | ||
, stdwin = curses.initscr() | ||
/* color pair definitions */ | ||
, GLYPH_COLOR = 1 | ||
, BORDER_COLOR = 2 | ||
; | ||
// ... | ||
/* initialize color pairs (id, FG, BG) */ | ||
if (curses.has_colors()) { | ||
curses.start_color(); | ||
/* glyph color */ | ||
curses.init_pair(GLYPH_COLOR, curses.COLOR_GREEN, curses.COLOR_BLACK); | ||
/* border color */ | ||
curses.init_pair(BORDER_COLOR, curses.COLOR_WHITE, curses.COLOR_BLACK); | ||
} | ||
// reset terminal | ||
/* clear toplevel window and draw border */ | ||
curses.wattrset(stdwin, curses.color_pair(BORDER_COLOR)); | ||
curses.wclear(stdwin); | ||
curses.box(stdwin, 0, 0); | ||
curses.wrefresh(stdwin); | ||
/* create a subwindow */ | ||
var sub_height = 20 | ||
, sub_width = 30 | ||
, sub_top = 1 | ||
, sub_left = 1 | ||
, subwin = curses.subwin(stdwin, sub_height, sub_width, sub_top, sub_left) | ||
; | ||
/* setup the subwindow's background and echo Hello world! into it */ | ||
curses.wattrset(subwin, curses.color_pair(GLYPH_COLOR)); | ||
curses.wbkgd(subwin, '_'.charCodeAt(0)); | ||
curses.wclear(subwin); | ||
curses.waddstr(subwin, "Hello world!"); | ||
curses.wrefresh(subwin); | ||
/* wait for a keystroke */ | ||
curses.wgetch(subwin); | ||
/* reset terminal (never forget this) */ | ||
curses.endwin(); | ||
@@ -55,0 +94,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43438
18
295
102