//初始化
initscr()
//获得屏幕尺寸
getmaxyx(stdscr, h, w)
//画背景
for(i=0 i<h i++)
for(j=0 j<w j++){
mvaddch(i, j, ACS_CKBOARD)
}
refresh()
//建立窗口
pad = newpad(80, 128)
for(i=0 i<80 i++){
char line[128]
sprintf(line, "This line in pad is numbered d\n", i)
mvwprintw(pad, i, 0, line)
}
//刷新屏幕
refresh()
prefresh(pad, 0, 1, 5, 10, 20, 45)
for(i=0 i<50 i++){
prefresh(pad, i+1, 1, 5, 10, 20, 45)
usleep(30000)
}
//等待按键
getch()
标签:
getmaxyx
initscr
stdscr
for
上传时间:
2014-08-30
上传用户:龙飞艇
//初始化
if(initscr() == NULL) {
perror("initcurs")
exit(EXIT_FAILURE)
}
//设置模式
cbreak()
noecho()
keypad(stdscr, TRUE)
//建立窗口
win = newwin(h, w, 3, 20)
box(win, 0, 0)
keypad(win, TRUE)
wmove(win, cury, curx)
mvaddstr(16, 1, "Press arrow keys to move the cursor within the window.\n")
mvaddstr(17, 1, "Press q to quit.\n")
refresh()
wrefresh(win)
标签:
EXIT_FAILURE
initcurs
initscr
perror
上传时间:
2013-12-20
上传用户:FreeSky
//初始化
if(initscr() == NULL) {
perror("initcurs")
exit(EXIT_FAILURE)
}
cbreak()
noecho()
keypad(stdscr, TRUE)
//建立菜单项
for(i=0 i<N_ITEMS i++){
items[i] = new_item(months[i], "")
}
//建立菜单
mymenu = new_menu(items)
//设置为5行单列的菜单
set_menu_format(mymenu, 5, 1)
set_menu_mark(mymenu, "*")
//获得菜单的行数很列数
scale_menu(mymenu, &mrows, &mcols)
//建立窗口和子窗口
win = newwin(mrows + 2, mcols + 2, 3, 30)
keypad(win, TRUE)
box(win, 0, 0)
subwin = derwin(win, 0, 0, 1, 1)
//设置菜单的窗口
set_menu_sub(mymenu, subwin)
//在子窗口上放置菜单
post_menu(mymenu)
refresh()
wrefresh(win)
标签:
EXIT_FAILURE
initcurs
initscr
cbreak
上传时间:
2013-11-29
上传用户:小眼睛LSL