这篇教程C++ wprintw函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wprintw函数的典型用法代码示例。如果您正苦于以下问题:C++ wprintw函数的具体用法?C++ wprintw怎么用?C++ wprintw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wprintw函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: help_draw_menustatic void help_draw_menu(ToxWindow *self){ WINDOW *win = self->help->win; wmove(win, 1, 1); wattron(win, A_BOLD | COLOR_PAIR(RED)); wprintw(win, " Help Menu/n"); wattroff(win, A_BOLD | COLOR_PAIR(RED)); wattron(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, " g"); wattroff(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "lobal commands/n"); wattron(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, " c"); wattroff(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "hat commands/n"); wprintw(win, " g"); wattron(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "r"); wattroff(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "oup commands/n");#ifdef PYTHON wattron(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, " p"); wattroff(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "lugin commands/n");#endif /* PYTHON */ wattron(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, " f"); wattroff(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "riendlist controls/n"); wattron(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, " k"); wattroff(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "ey bindings/n"); wprintw(win, " e"); wattron(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "x"); wattroff(win, A_BOLD | COLOR_PAIR(BLUE)); wprintw(win, "it menu/n"); box(win, ACS_VLINE, ACS_HLINE); wnoutrefresh(win);}
开发者ID:JFreegman,项目名称:toxic,代码行数:52,
示例2: outputTest//.........这里部分代码省略......... wclear(win); wrefresh(win); MvWAddStr(win, 6, 2, "This line shouldn't appear"); MvWAddStr(win, 4, 2, "Only half of the next line is visible"); MvWAddStr(win, 5, 2, "Only half of the next line is visible"); wmove(win, 6, 1); wclrtobot(win); wmove(win, 5, 20); wclrtoeol(win); MvWAddStr(win, 8, 2, "This line also shouldn't appear"); wmove(win, 8, 1); wdeleteln(win); Continue(win); wmove(win, 5, 9); ch = winch(win); wclear(win); wmove(win, 6, 2); waddstr(win, "The next char should be l: "); winsch(win, ch); Continue(win);#if HAVE_WINSSTR (void) mvwinsstr(win, 6, 2, "A1B2C3D4E5"); Continue(win);#endif wmove(win, 5, 1); winsertln(win); MvWAddStr(win, 5, 2, "The lines below should have moved down"); Continue(win); wclear(win); wmove(win, 2, 2); wprintw(win, "This is a formatted string in a window: %d %s/n", 42, "is it"); MvWAddStr(win, 10, 1, "Enter a string: "); wrefresh(win); noraw(); echo(); *Buffer = 0; wscanw(win, "%s", Buffer); printw("This is a formatted string in stdscr: %d %s/n", 42, "is it"); MvAddStr(10, 1, "Enter a string: "); *Buffer = 0; scanw("%s", Buffer); if (TIGETSTR("cvvis", "vs") != 0) { wclear(win); curs_set(2); MvWAddStr(win, 1, 1, "The cursor should appear as a block (visible)"); Continue(win); } if (TIGETSTR("civis", "vi") != 0) { wclear(win); curs_set(0); MvWAddStr(win, 1, 1, "The cursor should have disappeared (invisible)"); Continue(win); } if (TIGETSTR("cnorm", "ve") != 0) { wclear(win); curs_set(1); MvWAddStr(win, 1, 1, "The cursor should be an underline (normal)"); Continue(win); }#ifdef A_COLOR if (has_colors()) { wclear(win); MvWAddStr(win, 1, 1, "Colors should change after you press a key"); Continue(win); init_pair(1, COLOR_RED, COLOR_WHITE); wrefresh(win); }#endif werase(win);#if HAVE_TERMNAME MvWAddStr(win, 1, 1, "Information About Your Terminal"); MvWAddStr(win, 3, 1, termname()); MvWAddStr(win, 4, 1, longname()); if (termattrs() & A_BLINK) MvWAddStr(win, 5, 1, "This terminal supports blinking."); else MvWAddStr(win, 5, 1, "This terminal does NOT support blinking.");#endif (void) mvwaddnstr(win, 7, 5, "Have a nice day!ok", 16); wrefresh(win); (void) mvwinnstr(win, 7, 5, Buffer, 18); MvAddStr(LINES - 2, 10, Buffer); refresh(); Continue(win);}
开发者ID:ThomasDickey,项目名称:ncurses-snapshots,代码行数:101,
示例3: _show_roster_contactsvoid_show_roster_contacts(GSList *list, gboolean show_groups){ GSList *curr = list; while(curr) { PContact contact = curr->data; GString *title = g_string_new(" "); title = g_string_append(title, p_contact_barejid(contact)); if (p_contact_name(contact) != NULL) { title = g_string_append(title, " ("); title = g_string_append(title, p_contact_name(contact)); title = g_string_append(title, ")"); } const char *presence = p_contact_presence(contact); win_print_time(console, '-'); if (p_contact_subscribed(contact)) { win_presence_colour_on(console, presence); wprintw(console->win, "%s/n", title->str); win_presence_colour_off(console, presence); } else { win_presence_colour_on(console, "offline"); wprintw(console->win, "%s/n", title->str); win_presence_colour_off(console, "offline"); } g_string_free(title, TRUE); win_print_time(console, '-'); wprintw(console->win, " Subscription : "); GString *sub = g_string_new(""); sub = g_string_append(sub, p_contact_subscription(contact)); if (p_contact_pending_out(contact)) { sub = g_string_append(sub, ", request sent"); } if (presence_sub_request_exists(p_contact_barejid(contact))) { sub = g_string_append(sub, ", request received"); } if (p_contact_subscribed(contact)) { wattron(console->win, COLOUR_SUBSCRIBED); } else { wattron(console->win, COLOUR_UNSUBSCRIBED); } wprintw(console->win, "%s/n", sub->str); if (p_contact_subscribed(contact)) { wattroff(console->win, COLOUR_SUBSCRIBED); } else { wattroff(console->win, COLOUR_UNSUBSCRIBED); } g_string_free(sub, TRUE); if (show_groups) { GSList *groups = p_contact_groups(contact); if (groups != NULL) { GString *groups_str = g_string_new(" Groups : "); while (groups != NULL) { g_string_append(groups_str, groups->data); if (g_slist_next(groups) != NULL) { g_string_append(groups_str, ", "); } groups = g_slist_next(groups); } cons_show(groups_str->str); g_string_free(groups_str, TRUE); } } curr = g_slist_next(curr); }}
开发者ID:cjopcjop,项目名称:profanity,代码行数:74,
示例4: RenderTreeIntoWindowvoid RenderTreeIntoWindow(comment_item_tree* tree){ zlog_info(c, "Rendering window %dX%d", win->_maxy, win->_maxx); wbkgd(win, COLOR_PAIR(1)); refresh(); wmove(win, 2, 1); //wattron(win, A_BOLD | A_BLINK); wattron(win, A_BOLD); wattron(win, COLOR_PAIR(2)); zlog_info(c, "Starting to parse the tree"); if(mode == MODE_LOADING){ wprintw(win, "Loading in articles...one moment please "); }else{ wprintw(win, "News Comments for article ( %d in total) ", TotalSize(tree) ); } wattroff(win, COLOR_PAIR(2)); wattroff(win, A_BOLD); int row = 4; while (row < 30) { wmove(win, row, 1); wprintw(win, "%*s", 120, ""); row++; } if(msg1 != NULL && mode == MODE_LOADING){ wmove(win, LINES - 4, 1); wprintw(win, "%s", msg1); } row = 4; int txcol = 7; if(_flat != NULL){ free(_flat); } ResetFlatTree(tree); _flat = ToFlatTree(tree, &_total_tree_size); zlog_info(c, "Rendering total of %d rows", _total_tree_size); while (true) { if ( (row - 4) == _total_tree_size || (row - 4) >= WINDOW_SIZE) { break; } int chosen_element = MAX(row + start_row - 4, 0); if(chosen_element >= _total_tree_size){ zlog_info(c, "Hit Max, stopping iteration.."); break; } zlog_info(c, ">>Rendering row %d, ray elem %d - real elem/index %d ", row, row + start_row - 4, chosen_element); RenderRow(win, _flat[chosen_element], &row, txcol, row - 4, 0, -1); } mvwhline(win, 4 + WINDOW_SIZE + 1, 1, ACS_HLINE, COLS ); int _text_start = (int)(LINES/2); if(_selected > -1){ row = _text_start; while (row < LINES - 2) { wmove(win, row, 2); wprintw(win, "%*s", 120, ""); row++; } wmove(win, _text_start, 1); s_segments* segs = splitIntoSegments(_flat[_selected]->text, 90); int _p = 0; for (_p = 0; _p < segs->count; _p++) { wmove(win, _text_start + _p, 4); wprintw(win, "%s", segs->segments[_p]->string); } freeSegs(segs); if(msg1 != NULL){ free(msg1); } msg1 = malloc(50); memset(msg1, 0, 50); sprintf(msg1, "ID: %d", _flat[_selected]->id); wmove(win, LINES - 4, 1); wprintw(win, "%120s", ""); wmove(win, LINES - 4, 1); wprintw(win, "%s", msg1); } /* int BOX_W = 11; int BOX_H = 3; int _stx = 1; int _sty = 21; while (_sty < 35) { while (_stx < 120) { //wattron(win, A_BOLD | A_BLINK); DrawBox(win, BOX_H, BOX_W, _sty, _stx, _stx == 1, _stx > 68); //wattroff(win, A_BOLD | A_BLINK); _stx += BOX_W; }//.........这里部分代码省略.........
开发者ID:phatmanace,项目名称:kingsbridge,代码行数:101,
示例5: sepbar_redrawstatic void sepbar_redraw(owl_window *w, WINDOW *sepwin, void *user_data){ const owl_messagelist *ml; const owl_view *v; int x, y, i; const char *foo, *appendtosepbar; ml=owl_global_get_msglist(&g); v=owl_global_get_current_view(&g); werase(sepwin); wattron(sepwin, A_REVERSE); if (owl_global_is_fancylines(&g)) { whline(sepwin, ACS_HLINE, owl_global_get_cols(&g)); } else { whline(sepwin, '-', owl_global_get_cols(&g)); } if (owl_global_is_sepbar_disable(&g)) { getyx(sepwin, y, x); wmove(sepwin, y, owl_global_get_cols(&g)-1); return; } wmove(sepwin, 0, 2); if (owl_messagelist_get_size(ml) == 0) waddstr(sepwin, " (-/-) "); else wprintw(sepwin, " (%i/%i/%i) ", owl_global_get_curmsg(&g) + 1, owl_view_get_size(v), owl_messagelist_get_size(ml)); foo=owl_view_get_filtname(v); if (strcmp(foo, owl_global_get_view_home(&g))) wattroff(sepwin, A_REVERSE); wprintw(sepwin, " %s ", owl_view_get_filtname(v)); if (strcmp(foo, owl_global_get_view_home(&g))) wattron(sepwin, A_REVERSE); if (owl_mainwin_is_curmsg_truncated(owl_global_get_mainwin(&g))) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); waddstr(sepwin, " <truncated> "); wattroff(sepwin, A_BOLD); } i=owl_mainwin_get_last_msg(owl_global_get_mainwin(&g)); if ((i != -1) && (i < owl_view_get_size(v)-1)) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); waddstr(sepwin, " <more> "); wattroff(sepwin, A_BOLD); } if (owl_global_get_rightshift(&g)>0) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wprintw(sepwin, " right: %i ", owl_global_get_rightshift(&g)); } if (owl_global_is_zaway(&g) || owl_global_is_aaway(&g)) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); wattroff(sepwin, A_REVERSE); if (owl_global_is_zaway(&g) && owl_global_is_aaway(&g)) { waddstr(sepwin, " AWAY "); } else if (owl_global_is_zaway(&g)) { waddstr(sepwin, " Z-AWAY "); } else if (owl_global_is_aaway(&g)) { waddstr(sepwin, " A-AWAY "); } wattron(sepwin, A_REVERSE); wattroff(sepwin, A_BOLD); } if (owl_global_get_curmsg_vert_offset(&g)) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); wattron(sepwin, A_BOLD); wattroff(sepwin, A_REVERSE); waddstr(sepwin, " SCROLL "); wattron(sepwin, A_REVERSE); wattroff(sepwin, A_BOLD); } appendtosepbar = owl_global_get_appendtosepbar(&g); if (appendtosepbar && *appendtosepbar) { getyx(sepwin, y, x); wmove(sepwin, y, x+2); waddstr(sepwin, " "); waddstr(sepwin, owl_global_get_appendtosepbar(&g)); waddstr(sepwin, " "); } getyx(sepwin, y, x);//.........这里部分代码省略.........
开发者ID:andersk,项目名称:barnowl,代码行数:101,
示例6: test_opaquestatic inttest_opaque(int level, char **argv, WINDOW *stswin){ WINDOW *txtbox = 0; WINDOW *txtwin = 0; FILE *fp; int ch; int txt_x = 0, txt_y = 0; int base_y; bool in_status = FALSE; int active = 0; if (argv[level] == 0) { beep(); return FALSE; } if (level > 1) { txtbox = newwin(LINES - BASE_Y, COLS - level, BASE_Y, level); box(txtbox, 0, 0); wnoutrefresh(txtbox); txtwin = derwin(txtbox, getmaxy(txtbox) - 2, getmaxx(txtbox) - 2, 1, 1); base_y = 0; } else { txtwin = stdscr; base_y = BASE_Y; } keypad(txtwin, TRUE); /* enable keyboard mapping */ (void) cbreak(); /* take input chars one at a time, no wait for /n */ (void) noecho(); /* don't echo input */ txt_y = base_y; txt_x = 0; wmove(txtwin, txt_y, txt_x); if ((fp = fopen(argv[level], "r")) != 0) { while ((ch = fgetc(fp)) != EOF) { if (waddch(txtwin, UChar(ch)) != OK) { break; } } fclose(fp); } else { wprintw(txtwin, "Cannot open:/n%s", argv[1]); } for (;;) { if (in_status) { to_keyword(stswin, active); ch = wgetch(stswin); show_opaque(stswin, txtwin, TRUE, active); if (Quit(ch)) break; switch (ch) { case '/t': in_status = FALSE; break; case KEY_DOWN: case 'j': if (active < (int) SIZEOF(bool_funcs) - 1) active++; else beep(); break; case KEY_UP: case 'k': if (active > 0) active--; else beep(); break; case ' ': bool_funcs[active].func(txtwin, !bool_funcs[active].func(txtwin, -1)); break; default: beep(); break; } show_opaque(stswin, txtwin, FALSE, in_status ? active : -1); } else { ch = mvwgetch(txtwin, txt_y, txt_x); show_opaque(stswin, txtwin, TRUE, -1); if (Quit(ch)) break; switch (ch) { case '/t': in_status = TRUE; break; case KEY_DOWN: case 'j': if (txt_y < getmaxy(txtwin) - 1)//.........这里部分代码省略.........
开发者ID:SayCV,项目名称:rtems-addon-packages,代码行数:101,
示例7: colprint/* * Prints formatted output onto a window. Borders are handled correctly. * * %s = char * * %d = int * %f = double * %B %/B = bold on/off * %R %/R = reverse on/off * %0-n% %/0-n% = color on/off * */void colprint(BBox * bbox, int y, int x, color * c, const char *fmt, ...){ va_list ap; unsigned int i = 0; double f = 0; string output = ""; bool parse = false; bool attr = false; attr_t attrval = 0; char buf[1024]; string colorstr; int colorint; int pair = 0; unsigned int maxlen; // max allowed characters printed on screen unsigned int printlen = 0; // num characters printed on screen assert(bbox); va_start(ap, fmt); /* Check if string is out of range, and cuts if necessary */ if (x < 0) { if (strlen(fmt) < abs(x)) return; fmt += abs(x); x = 0; } if (c != NULL) pair = c->pair(); wmove(bbox->window, y, x); wattron(bbox->window, pair); maxlen = bbox->width() - x + 1; while(*fmt && printlen < maxlen) { if (*fmt == '%' && !parse) { if (*(fmt + 1) == '%') { fmt += 2; output = "%%"; wprintw(bbox->window, _(output.c_str())); continue; } parse = true; attr = true; ++fmt; } if (parse) { switch(*fmt) { case '/': /* Turn off attribute, SGML style */ attr = false; break; case 'B': if (attr) wattron(bbox->window, A_BOLD); else wattroff(bbox->window, A_BOLD); parse = false; break; case 'R': if (attr) wattron(bbox->window, A_REVERSE); else wattroff(bbox->window, A_REVERSE); parse = false; break; case 'd': parse = false; i = va_arg(ap, int); sprintf(buf, "%d", i); wprintw(bbox->window, _(buf)); printlen += strlen(buf); i = 0; break; case 'f': parse = false; f = va_arg(ap, double); sprintf(buf, "%f", f); wprintw(bbox->window, _(buf));//.........这里部分代码省略.........
开发者ID:PhilT001,项目名称:pms,代码行数:101,
示例8: cmd_statusmsgvoid cmd_statusmsg(ToxWindow *self, Messenger *m, char **args){ char *msg = args[1]; m_set_statusmessage(m, (uint8_t *) msg, strlen(msg) + 1); wprintw(self->window, "Status set to: %s/n", msg);}
开发者ID:notadecent,项目名称:toxic,代码行数:6,
示例9: executestatic void execute(ToxWindow *self, Messenger *m, char *u_cmd){ int newlines = 0; char cmd[MAX_STR_SIZE] = {0}; int i; for (i = 0; i < strlen(prompt_buf); ++i) { if (u_cmd[i] == '/n') ++newlines; else cmd[i - newlines] = u_cmd[i]; } int leading_spc = 0; for (i = 0; i < MAX_STR_SIZE && isspace(cmd[i]); ++i) leading_spc++; memmove(cmd, cmd + leading_spc, MAX_STR_SIZE - leading_spc); int cmd_end = strlen(cmd); while (cmd_end > 0 && cmd_end--) if (!isspace(cmd[cmd_end])) break; cmd[cmd_end + 1] = '/0'; /* insert /0 at argument boundaries */ int numargs = 0; for (i = 0; i < MAX_STR_SIZE; i++) { char quote_chr; if (cmd[i] == '/"' || cmd[i] == '/'') { quote_chr = cmd[i]; while (cmd[++i] != quote_chr && i < MAX_STR_SIZE); /* skip over strings */ /* Check if got qoute character */ if (cmd[i] != quote_chr) { wprintw(self->window, "Missing terminating %c character/n", quote_chr); return; } } if (cmd[i] == ' ') { cmd[i] = '/0'; int j = i; while (++j < MAX_STR_SIZE && isspace(cmd[j])); i = j - 1; numargs++; } } /* excessive arguments */ if (numargs > 3) { wprintw(self->window, "Invalid command: too many arguments./n"); return; } /* read arguments into array */ char *cmdargs[5]; int pos = 0; for (i = 0; i < 5; i++) { cmdargs[i] = cmd + pos; pos += strlen(cmdargs[i]) + 1; while (isspace(cmd[pos]) && pos < MAX_STR_SIZE) ++pos; } /* no input */ if (strlen(cmdargs[0]) == 0) return; /* match input to command list */ for (i = 0; i < NUM_COMMANDS; i++) { if (!strcmp(cmdargs[0], commands[i].name)) { /* check for missing arguments */ int j; for (j = 0; j <= commands[i].numargs; j++) { if (strlen(cmdargs[j]) == 0) { wprintw(self->window, "Invalid command: %s expected %d arguments, got %d./n", commands[i].name, commands[i].numargs, j - 1); return; } } /* check for excess arguments */ if (strcmp(cmdargs[0], "add") && strlen(cmdargs[j]) != 0) { wprintw(self->window, "Invalid command: too many arguments to %s./n", commands[i].name); return; } /* pass arguments to command function */ (commands[i].func)(self, m, cmdargs);//.........这里部分代码省略.........
开发者ID:notadecent,项目名称:toxic,代码行数:101,
示例10: cmd_addvoid cmd_add(ToxWindow *self, Messenger *m, char **args){ uint8_t id_bin[FRIEND_ADDRESS_SIZE]; char xx[3]; uint32_t x; char *id = args[1]; char *msg = args[2]; if (!id) { wprintw(self->window, "Invalid command: add expected at least one argument./n"); return; } if (!msg) msg = ""; if (strlen(id) != 2 * FRIEND_ADDRESS_SIZE) { wprintw(self->window, "Invalid ID length./n"); return; } int i; for (i = 0; i < FRIEND_ADDRESS_SIZE; ++i) { xx[0] = id[2 * i]; xx[1] = id[2 * i + 1]; xx[2] = '/0'; if (sscanf(xx, "%02x", &x) != 1) { wprintw(self->window, "Invalid ID./n"); return; } id_bin[i] = x; } for (i = 0; i < FRIEND_ADDRESS_SIZE; i++) { id[i] = toupper(id[i]); } int num = m_addfriend(m, id_bin, (uint8_t *) msg, strlen(msg) + 1); switch (num) { case FAERR_TOOLONG: wprintw(self->window, "Message is too long./n"); break; case FAERR_NOMESSAGE: wprintw(self->window, "Please add a message to your request./n"); break; case FAERR_OWNKEY: wprintw(self->window, "That appears to be your own ID./n"); break; case FAERR_ALREADYSENT: wprintw(self->window, "Friend request already sent./n"); break; case FAERR_UNKNOWN: wprintw(self->window, "Undefined error when adding friend./n"); break; case FAERR_BADCHECKSUM: wprintw(self->window, "Bad checksum in address./n"); break; case FAERR_SETNEWNOSPAM: wprintw(self->window, "Nospam was different./n"); break; default: wprintw(self->window, "Friend added as %d./n", num); on_friendadded(m, num); break; }}
开发者ID:notadecent,项目名称:toxic,代码行数:77,
示例11: cmd_helpvoid cmd_help(ToxWindow *self, Messenger *m, char **args){ wclear(self->window); wattron(self->window, COLOR_PAIR(2) | A_BOLD); wprintw(self->window, "Commands:/n"); wattroff(self->window, A_BOLD); wprintw(self->window, " connect <ip> <port> <key> : Connect to DHT server/n"); wprintw(self->window, " add <id> <message> : Add friend/n"); wprintw(self->window, " status <type> <message> : Set your status/n"); wprintw(self->window, " statusmsg <message> : Set your status/n"); wprintw(self->window, " nick <nickname> : Set your nickname/n"); wprintw(self->window, " mynick : Print your current nickname/n"); wprintw(self->window, " accept <number> : Accept friend request/n"); wprintw(self->window, " myid : Print your ID/n"); wprintw(self->window, " quit/exit : Exit program/n"); wprintw(self->window, " help : Print this message again/n"); wprintw(self->window, " clear : Clear this window/n"); wattron(self->window, A_BOLD); wprintw(self->window, "TIP: Use the TAB key to navigate through the tabs./n/n"); wattroff(self->window, A_BOLD); wattroff(self->window, COLOR_PAIR(2));}
开发者ID:notadecent,项目名称:toxic,代码行数:25,
示例12: checkmate/*check where the king can moveif the king can move to a place will he be in check?if yes continue to check other conditions else no checkmate*/int checkmate(int row,int col,checkm arr[],int q){ int ccount,valid,i,j,x,y,z,t=0,possible=0,n=0; y=row-1; x=col-1; while(x<0){ x++; } while(y<0) y++; if(turn!=0){ while((y<=row+1)&&(x<=col+1)){ valid=king(row,col,y,x); if((turn!=0)&&board[y][x]<0 || (x==8 || y==8)){ valid=0; wprintw(menuwin," invalid turn 1");wrefresh(menuwin); } if(valid){ t=0; for(j=0;j<=7;j++){ for(i=0;i<=7;i++){ if(t==1){ break; } if(board[j][i]>=9 && board[j][i]<=16) t = pawn(j,i,y,x); else if(board[j][i]==2 || board[j][i]==7) t = horse(j,i,y,x); else if(board[j][i]==4) t = queen(j,i,y,x); else if(board[j][i]==1 || board[j][i]==8) t = rook(j,i,y,x); else if(board[j][i]==3 || board[j][i]==6) t = bishop(j,i,y,x); } } if(t==1){ ccount++; } else if(t==0){ possible++; } } else{ ccount++; } if(y==row+1){ x++; } if(y<row+1){ y++; } } if(possible!=0){ return; } for(z=0;z<q;z++) { x=arr[z].x;y=arr[z].y; switch(abs(arr[z].piece)) { case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:break; case 4:if(arr[z].y-row==arr[z].x-col) goto c3; //go to bishop case if(arr[z].y==row||arr[z].x==col) //go to rook case case 1:case 8://rook if(row==arr[z].y) { for(i=arr[z].x+1;i<col;i++) { if(board[row][i]==0) { if(friendlymove(row,i)){ possible++;goto end;} } } for(i=arr[z].x-1;i>col;i--) { if(board[row][i]==0) { if(friendlymove(row,i)){ possible++;goto end;} } } } else if(col==arr[x].x) { for(i=arr[z].y+1;i<row;i++) { if(board[i][col]==0) { if(friendlymove(i,col)){ possible++;goto end;} } } for(i=arr[z].y-1;i>col;i--) { if(board[i][col]==0) { if(friendlymove(i,col)){ possible++;goto end;} } } } break;//.........这里部分代码省略.........
开发者ID:rasikabhave,项目名称:myminiproject,代码行数:101,
示例13: main//.........这里部分代码省略......... WINDOW *win = newwin(wid, len, 5, 1); box(win, 0, 0); wbkgd(win, COLOR_PAIR(1)); wrefresh(win); wmove(win, y_curr, x_curr); refresh(); cpid = fork(); if(cpid == 0){ // IF CHILD1, handle the OUTPUT WINDOW... char *msg; output_start: msg = readNamedPipe(); getyx(win, y_curr, x_curr); if(y_curr > y_max) y_curr = y_min; wmove(win, y_curr, x_curr); wprintw(win, msg); wrefresh(win); wmove(win, (y_curr+1), x_min); refresh(); goto output_start; } else{ // IF CHILD0, handle the INPUT WINDOW... /* NOTE: Remember how I created the OUTPUT WINDOW before the * FORK? Because that WINDOW now exists in both the * context of CHILD0 and CHILD1, I'm going to delete * it in CHILD0 before proceeding to the creation of * the INPUT WINDOW. * The reason I created the OUTPUT WINDOW first was * because if it was initialized inside of CHILD1, it * caused a protential issue where if CHILD0 finished * creating the INPUT WINDOW before CHILD1 finished * its WINDOW, it would affect the way the latter was * being drawn. */ delwin(win); // Create INPUT WINDOW: wid = 3;
开发者ID:kaethis,项目名称:CS3790_Assign02,代码行数:67,
示例14: mainint main(int argc, char **argv){ int i, sock;// struct timeval tv;// tv.tv_sec = 2;// tv.tv_usec = 500000; initscr(); // Start curses mode. getmaxyx(stdscr, y, x); // Get max screen size. refresh(); // The refresh is just needed? win[0] = newwin(1, x, 0, (int)(x/2)); // Title window. win[1] = newwin(y-2, x, 1, 0); // Main window. win[2] = newwin(1, x, y-1, 0); // Input window. pan[0] = new_panel(win[0]); pan[1] = new_panel(win[1]); pan[2] = new_panel(win[2]); wprintw(win[0], "Title..."); wprintw(win[1], "Server bullshit.../n"); wprintw(win[2], "Input: "); update_panels(); // Put our panels in the right order. doupdate(); // Refresh them on the screen. struct sockaddr_in Sock_in; unsigned short port = 6969; char *servIP, send_buff[BUF], read_buff[BUF]; servIP = "210.155.158.200"; if((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) DieWithError("socket() failed./n"); print_win(win[1], "socket() successful/n"); memset(&Sock_in, 0, sizeof(Sock_in)); Sock_in.sin_family = AF_INET; Sock_in.sin_addr.s_addr = inet_addr(servIP); Sock_in.sin_port = htons(port); if(connect(sock, (struct sockaddr *) &Sock_in, sizeof(Sock_in)) < 0) DieWithError("connect() failed./n"); while(1){ FD_ZERO(&Go_fd); FD_SET(0, &Go_fd); FD_SET(sock, &Go_fd); if(select(sock+1, &Go_fd, NULL, NULL, NULL) < 0) DieWithError("select() failed./n"); if(FD_ISSET(sock, &Go_fd)){ memset(&buf, 0, sizeof(buf)); if(recv(sock, &buf, sizeof(buf)-1, 0) > 0) print_win(win[1], buf); } if(FD_ISSET(0, &Go_fd)){ // Check the socket. get_string(win[2]); sprintf(input, "%s/r", input); if(send(sock, &input, sizeof(input), 0) < sizeof(input)) DieWithError("send() failed"); print_win(win[1], input); } } close(sock); endwin(); // Stop curses. return 0;}
开发者ID:nuestand,项目名称:GoBan,代码行数:62,
示例15: wprintwvoid NWindowEditDigits::setValueDouble (double _val){ wprintw (getWriteWindow (), "%f", _val);}
开发者ID:jerryjiahaha,项目名称:rts2,代码行数:4,
示例16: wdg_dialog_redraw/* * called to redraw a window */static int wdg_dialog_redraw(struct wdg_object *wo){ WDG_WO_EXT(struct wdg_dialog, ww); size_t c, l, x, y; size_t lines, cols; WDG_DEBUG_MSG("wdg_dialog_redraw"); /* calculate the dimension and position */ wdg_dialog_get_size(wo, &lines, &cols); /* center on the screen, but not outside the edges */ if (cols + 4 >= current_screen.cols) wo->x1 = 0; else wo->x1 = (current_screen.cols - (cols + 4)) / 2; wo->y1 = (current_screen.lines - (lines + 4)) / 2; wo->x2 = -wo->x1; wo->y2 = -wo->y1; /* get the cohorditates as usual */ c = wdg_get_ncols(wo); l = wdg_get_nlines(wo); x = wdg_get_begin_x(wo); y = wdg_get_begin_y(wo); /* deal with rouding */ if (l != lines + 4) l = lines + 4; if (c != cols + 4) c = cols + 4; /* the window already exist */ if (ww->win) { /* erase the border */ wbkgd(ww->win, COLOR_PAIR(wo->screen_color)); werase(ww->win); touchwin(ww->win); wnoutrefresh(ww->win); /* resize the window and draw the new border */ mvwin(ww->win, y, x); wresize(ww->win, l, c); wdg_dialog_border(wo); wdg_dialog_buttons(wo); /* resize the actual window and touch it */ mvwin(ww->sub, y + 2, x + 2); wresize(ww->sub, l - 4, c - 4); /* set the window color */ wbkgdset(ww->sub, COLOR_PAIR(wo->window_color)); /* the first time we have to allocate the window */ } else { /* create the outher window */ if ((ww->win = newwin(l, c, y, x)) == NULL) return -WDG_EFATAL; /* draw the borders */ wdg_dialog_border(wo); wdg_dialog_buttons(wo); /* create the inner (actual) window */ if ((ww->sub = newwin(l - 4, c - 4, y + 2, x + 2)) == NULL) return -WDG_EFATAL; /* set the window color */ wbkgdset(ww->sub, COLOR_PAIR(wo->window_color)); werase(ww->sub); redrawwin(ww->sub); } /* print the message text */ wmove(ww->sub, 0, 0); wprintw(ww->sub, ww->text); /* refresh the window */ redrawwin(ww->sub); redrawwin(ww->win); wnoutrefresh(ww->win); wnoutrefresh(ww->sub); wo->flags |= WDG_OBJ_VISIBLE; return WDG_ESUCCESS;}
开发者ID:LocutusOfBorg,项目名称:Ettercap-NG,代码行数:90,
示例17: WriteCharstatic void WriteChar(WINDOW *w, char c){ wmove(w, OutLine, OutputPos); wprintw(w, "%c", c); OutputPos += 1;}
开发者ID:EtchedPixels,项目名称:TaylorMade,代码行数:6,
示例18: hl_wprintwvoid hl_wprintw(WINDOW * win, const char *line, int width, int offset, int line_highlight_attr){ int length; /* Length of the line passed in */ enum hl_group_kind color; /* Color used to print current char */ int i; /* Loops through the line char by char */ int j; /* General iterator */ int p; /* Count of chars printed to screen */ int pad; /* Used to pad partial tabs */ int attr; /* A temp variable used for attributes */ int highlight_tabstop = cgdbrc_get_int(CGDBRC_TABSTOP); /* Jump ahead to the character at offset (process color commands too) */ length = strlen(line); color = HLG_TEXT; for (i = 0, j = 0; i < length && j < offset; i++) { if (line[i] == HL_CHAR && i + 1 < length) { /* Even though we're not printing anything in this loop, * the color attribute needs to be maintained for when we * start printing in the loop below. This way the text * printed will be done in the correct color. */ color = (enum hl_group_kind) line[++i]; } else if (line[i] == '/t') { /* Tab character, expand to size set by user */ j += highlight_tabstop - (j % highlight_tabstop); } else { /* Normal character, just increment counter by one */ j++; } } pad = j - offset; /* Pad tab spaces if offset is less than the size of a tab */ for (j = 0, p = 0; j < pad && p < width; j++, p++) wprintw(win, " "); /* Set the color - if we were given line_highlight, use that, otherwise load */ if (line_highlight_attr) attr = line_highlight_attr; else hl_groups_get_attr(hl_groups_instance, color, &attr); wattron(win, attr); /* Print string 1 char at a time */ for (; i < length && p < width; i++) { if (line[i] == HL_CHAR) { if (++i < length) { /* If we're highlight entire line, skip the line attributes */ if (!line_highlight_attr) { wattroff(win, attr); color = (enum hl_group_kind) line[i]; hl_groups_get_attr(hl_groups_instance, color, &attr); wattron(win, attr); } } } else { switch (line[i]) { case '/t': do { wprintw(win, " "); p++; } while ((p + offset) % highlight_tabstop > 0 && p < width); break; default: wprintw(win, "%c", line[i]); p++; } } } /* If we're highlighting line, draw spaces with attributes set */ if (!line_highlight_attr) wattroff(win, attr); for (; p < width; p++) wprintw(win, " "); /* Turn off attributes if we didn't earlier */ if (line_highlight_attr) wattroff(win, attr);}
开发者ID:scottlu,项目名称:cgdb,代码行数:82,
示例19: renderStatusvoid renderStatus(Frame* frame, Player* player) { frame->clear(); wprintw(frame->getView(), "HP: %d/15", player->hp); frame->update();}
开发者ID:uetchy,项目名称:temp_hero,代码行数:5,
示例20: friendlist_onDrawstatic void friendlist_onDraw(ToxWindow *self, Tox *m){ curs_set(0); werase(self->window); int x2, y2; getmaxyx(self->window, y2, x2); bool fix_statuses = x2 != self->x; /* true if window x axis has changed */ wattron(self->window, COLOR_PAIR(CYAN)); wprintw(self->window, " Open a chat window with the"); wattron(self->window, A_BOLD); wprintw(self->window, " Enter "); wattroff(self->window, A_BOLD); wprintw(self->window, "key. Delete a friend with the"); wattron(self->window, A_BOLD); wprintw(self->window, " Delete "); wattroff(self->window, A_BOLD); wprintw(self->window, "key./n/n"); wattroff(self->window, COLOR_PAIR(CYAN)); wattron(self->window, A_BOLD); wprintw(self->window, " Friends: %d/%d /n/n", tox_get_num_online_friends(m), num_friends); wattroff(self->window, A_BOLD); if ((y2 - FLIST_OFST) <= 0) /* don't allow division by zero */ return; /* Determine which portion of friendlist to draw based on current position */ int page = num_selected / (y2 - FLIST_OFST); int start = (y2 - FLIST_OFST) * page; int end = y2 - FLIST_OFST + start; int i; for (i = start; i < num_friends && i < end; ++i) { int f = friendlist_index[i]; bool f_selected = false; if (friends[f].active) { if (i == num_selected) { wattron(self->window, A_BOLD); wprintw(self->window, " > "); wattroff(self->window, A_BOLD); f_selected = true; } else { wprintw(self->window, " "); } if (friends[f].online) { TOX_USERSTATUS status = friends[f].status; int colour = WHITE; switch (status) { case TOX_USERSTATUS_NONE: colour = GREEN; break; case TOX_USERSTATUS_AWAY: colour = YELLOW; break; case TOX_USERSTATUS_BUSY: colour = RED; break; } wprintw(self->window, "["); wattron(self->window, COLOR_PAIR(colour) | A_BOLD); wprintw(self->window, "O"); wattroff(self->window, COLOR_PAIR(colour) | A_BOLD); wprintw(self->window, "]"); if (f_selected) wattron(self->window, A_BOLD); wprintw(self->window, "%s", friends[f].name); if (f_selected) wattroff(self->window, A_BOLD); /* Reset friends[f].statusmsg on window resize */ if (fix_statuses) { uint8_t statusmsg[TOX_MAX_STATUSMESSAGE_LENGTH] = {'/0'}; tox_get_status_message(m, friends[f].num, statusmsg, TOX_MAX_STATUSMESSAGE_LENGTH); snprintf(friends[f].statusmsg, sizeof(friends[f].statusmsg), "%s", statusmsg); friends[f].statusmsg_len = tox_get_status_message_size(m, f); } /* Truncate note if it doesn't fit on one line */ uint16_t maxlen = x2 - getcurx(self->window) - 4; if (friends[f].statusmsg_len > maxlen) { friends[f].statusmsg[maxlen-3] = '/0'; strcat(friends[f].statusmsg, "..."); friends[f].statusmsg[maxlen] = '/0'; friends[f].statusmsg_len = maxlen; } wprintw(self->window, " (%s)/n", friends[f].statusmsg); } else { wprintw(self->window, "["); wattron(self->window, A_BOLD);//.........这里部分代码省略.........
开发者ID:misson20000,项目名称:toxic,代码行数:101,
示例21: RenderRowvoid RenderRow(WINDOW* win, ND* node, int* row, int basecolumn, int rowindex, int _y, int mode){ int column = basecolumn + (2 * node->_ft_depth); if (node == NULL) { zlog_info(c, "Null Render (mode=%d, rowindex=%d)", mode, rowindex); return; } zlog_info(c, "[%d/%d] Real_rende_call() %s at row %d/%d = col %d/%d", rowindex, mode, node->text, *row, isExpanded(node), column, basecolumn); if (node->children != NULL && isExpanded(node)) { mvwhline(win, *row, column - 1, ACS_HLINE, 2 ); mvwhline(win, *row, column - 1, ACS_URCORNER, 1 ); //if (rowindex > 0) { // mvwvline(win, (*row) - 1, column - 2, ACS_VLINE, 2 ); //} }else{ //if (node->children != NULL) { // mvwhline(win, *row, column - 2, ACS_PLUS, 1 ); //}else{ // //mvwhline(win, *row, column - 2, ACS_VLINE, 1 ); //} } int _fkd = column + 1; /* * Draw out all the lines back for the parent nodes */ if (rowindex == _selected) { wattron(win, COLOR_PAIR(4)); } if (node->_ft_depth > 0) { while (true ) { _fkd--; _fkd--; if (_fkd <= basecolumn) { break; } mvwvline(win, (*row), _fkd, ACS_VLINE, 1 ); zlog_info(c, " Working back, col now %d, %d, %d", node->_ft_depth, _fkd, column); } } if (rowindex == _selected) { wattron(win, COLOR_PAIR(3)); } /* Actually render the node details. */ // Clear the row... wmove(win, *row, column + 3); wprintw(win, " "); // Draw the spine line to the text int SPLINE_COL = 4; mvwhline(win, *row, column - 1, ACS_HLINE, SPLINE_COL ); if (node->next != NULL) { wmove(win, *row, column - 1 ); waddch(win, ACS_LTEE); }else{ wmove(win, *row, column - 1 ); waddch(win, ACS_LLCORNER); } wmove(win, *row, basecolumn - 3); wprintw(win, "%d", *row); if (node->children != NULL && !isExpanded(node)) { wmove(win, *row, column + SPLINE_COL); wprintw(win, "(%d) %s", TotalSize(node->children), substring(node->text, 60)); }else{ wmove(win, *row, column + SPLINE_COL); wprintw(win, substring(node->text, 60)); } wattron(win, COLOR_PAIR(3)); wmove(win, *row, 85); wprintw(win, "cc=%4d d=%4d ", ChildCount(node, false), node->_ft_depth ); wattroff(win, COLOR_PAIR(3)); // deactivate colors if (rowindex == _selected) { wattroff(win, COLOR_PAIR(2)); } zlog_info(c, "Done Rendering Leaving.."); (*row)++; wattron(win, COLOR_PAIR(3)); wmove(win, 2, 55); wprintw(win, "cc=%4d d=%4d TTS=%4d SEL=%3d SR=%d R=%3d, NB=%3d B=%d, WS=%d", ChildCount(node, false), node->_ft_depth, _total_tree_size, _selected, start_row, *row, _selected - start_row, _selected - start_row > WINDOW_SIZE, WINDOW_SIZE ); wattroff(win, COLOR_PAIR(3));}
开发者ID:phatmanace,项目名称:kingsbridge,代码行数:97,
示例22: io_handle_bsint io_handle_bs(int x, int y) { wprintw(winCommandMode, "<BS>"); wrefresh(winCommandMode); return 0;}
开发者ID:prosbloom225,项目名称:mmpc,代码行数:5,
示例23: display_itk_navfixstatic void display_itk_navfix(unsigned char *buf, size_t len){ unsigned int tow, tod, d, svlist; unsigned short gps_week, nsv; unsigned short year, mon, day, hour, min, sec; double epx, epy, epz, evx, evy, evz; double latitude, longitude; float altitude, speed, track, climb; float hdop, gdop, pdop, vdop, tdop; if (len != 296) return;#ifdef __UNUSED__ flags = (unsigned short) getleu16(buf, 7 + 4); */ cflags = (unsigned short) getleu16(buf, 7 + 6); pflags = (unsigned short) getleu16(buf, 7 + 8);#endif /* __UNUSED__ */#define MAX(a,b) (((a) > (b)) ? (a) : (b)) nsv = (unsigned short) MAX(getleu16(buf, 7 + 12), getleu16(buf, 7 + 14)); svlist = (unsigned int) ((unsigned short) getleu32(buf, 7 + 16) | getleu32(buf, 7 + 24)); hour = (unsigned short) getleu16(buf, 7 + 66); min = (unsigned short) getleu16(buf, 7 + 68); sec = (unsigned short) getleu16(buf, 7 + 70); //nsec = (unsigned short) getleu32(buf, 7 + 72); year = (unsigned short) getleu16(buf, 7 + 76); mon = (unsigned short) getleu16(buf, 7 + 78); day = (unsigned short) getleu16(buf, 7 + 80); gps_week = (unsigned short) getles16(buf, 7 + 82); tow = (unsigned short) getleu32(buf, 7 + 84); epx = (double)(getles32(buf, 7 + 96) / 100.0); epy = (double)(getles32(buf, 7 + 100) / 100.0); epz = (double)(getles32(buf, 7 + 104) / 100.0); evx = (double)(getles32(buf, 7 + 186) / 1000.0); evy = (double)(getles32(buf, 7 + 190) / 1000.0); evz = (double)(getles32(buf, 7 + 194) / 1000.0); latitude = (double)(getles32(buf, 7 + 144) / 1e7); longitude = (double)(getles32(buf, 7 + 148) / 1e7); altitude = (float)(getles32(buf, 7 + 152) / 1e3); climb = (float)(getles32(buf, 7 + 206) / 1e3); speed = (float)(getleu32(buf, 7 + 210) / 1e3); track = (float)(getleu16(buf, 7 + 214) / 1e2); hdop = (float)(getleu16(buf, 7 + 56) / 100.0); gdop = (float)(getleu16(buf, 7 + 58) / 100.0); pdop = (float)(getleu16(buf, 7 + 60) / 100.0); vdop = (float)(getleu16(buf, 7 + 62) / 100.0); tdop = (float)(getleu16(buf, 7 + 64) / 100.0); (void)wmove(navfixwin, 1, 11); (void)wprintw(navfixwin, "%12.2lf %12.2lf %12.2lfm", epx, epy, epz); (void)wmove(navfixwin, 2, 11); (void)wprintw(navfixwin, "%11.2lf %11.2lf %11.2lfm/s", evx, evy, evz); (void)wmove(navfixwin, 4, 11); (void)wprintw(navfixwin, "%11.8lf %13.8lf %8.1lfm", latitude, longitude, altitude); (void)mvwaddch(navfixwin, 4, 22, ACS_DEGREE); (void)mvwaddch(navfixwin, 4, 38, ACS_DEGREE); (void)wmove(navfixwin, 5, 11); (void)wprintw(navfixwin, "%6.2lfm/s %5.1lf %6.2lfm/s climb", speed, track, climb); (void)mvwaddch(navfixwin, 5, 27, ACS_DEGREE); (void)wmove(navfixwin, 7, 11); (void)wprintw(navfixwin, "%04u-%02u-%02u %02u:%02u:%02u", year, mon, day, hour, min, sec); (void)wmove(navfixwin, 8, 11); (void)wprintw(navfixwin, "%04u+%010.3lf", gps_week, tow / 1000.0); (void)wmove(navfixwin, 8, 33); d = (tow / 1000) / 86400; tod = (tow / 1000) - (d * 86400); sec = (unsigned short)tod % 60; min = (unsigned short)(tod / 60) % 60; hour = (unsigned short)tod / 3600; (void)wprintw(navfixwin, "%1d %02d:%02d:%02d", d, hour, min, sec); (void)wmove(navfixwin, 10, 9); (void)wprintw(navfixwin, "%-5.1f", hdop); (void)wmove(navfixwin, 10, 18); (void)wprintw(navfixwin, "%-5.1f", vdop); (void)wmove(navfixwin, 10, 27); (void)wprintw(navfixwin, "%-5.1f", pdop); (void)wmove(navfixwin, 10, 36); (void)wprintw(navfixwin, "%-5.1f", tdop); (void)wmove(navfixwin, 10, 45); (void)wprintw(navfixwin, "%-5.1f", gdop); (void)wmove(navfixwin, 11, 6); { char prn[4], satlist[38]; unsigned int i; satlist[0] = '/0'; for (i = 0; i < 32; i++) { if (svlist & (1 << i)) {//.........这里部分代码省略.........
开发者ID:vyacht,项目名称:carambola,代码行数:101,
示例24: printatvoid printat(int row, int column, char* text) { move(column,row); wprintw(stdscr, text);}
开发者ID:Howlinmoon,项目名称:Hacking_With_C,代码行数:4,
示例25: inputTeststatic voidinputTest(WINDOW *win){ int answered; int repeat; int w, h, bx, by, sw, sh, i, c, num; char buffer[80]; WINDOW *subWin; wclear(win); getmaxyx(win, h, w); getbegyx(win, by, bx); sw = w / 3; sh = h / 3; if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL) return;#ifdef A_COLOR if (has_colors()) { init_pair(2, COLOR_WHITE, COLOR_RED); wbkgd(subWin, (chtype) COLOR_PAIR(2) | A_BOLD); } else wbkgd(subWin, A_BOLD);#else wbkgd(subWin, A_BOLD);#endif box(subWin, ACS_VLINE, ACS_HLINE); wrefresh(win); nocbreak(); MvWAddStr(win, 2, 1, "Press some keys for 5 seconds"); MvWAddStr(win, 1, 1, "Pressing ^C should do nothing"); wrefresh(win); werase(subWin); box(subWin, ACS_VLINE, ACS_HLINE); for (i = 0; i < 5; i++) { MvWPrintw(subWin, 1, 1, "Time = %d", i); wrefresh(subWin); napms(1000); flushinp(); } delwin(subWin); werase(win); flash(); wrefresh(win); napms(500); MvWAddStr(win, 2, 1, "Press a key, followed by ENTER"); wmove(win, 9, 10); wrefresh(win); echo(); noraw(); wgetch(win); flushinp(); wmove(win, 9, 10); wdelch(win); MvWAddStr(win, 4, 1, "The character should now have been deleted"); Continue(win); wclear(win); MvWAddStr(win, 1, 1, "Press keys (or mouse buttons) to show their names"); MvWAddStr(win, 2, 1, "Press spacebar to finish"); wrefresh(win); keypad(win, TRUE); raw(); noecho();#if HAVE_TYPEAHEAD typeahead(-1);#endif#ifdef NCURSES_MOUSE_VERSION mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0);#endif#if defined(PDCURSES) mouse_set(ALL_MOUSE_EVENTS);#endif for (;;) { wmove(win, 3, 5); c = wgetch(win); wclrtobot(win); if (c >= KEY_MIN) wprintw(win, "Key Pressed: %s", keyname(c)); else if (isprint(c)) wprintw(win, "Key Pressed: %c", c); else wprintw(win, "Key Pressed: %s", unctrl(UChar(c)));#ifdef KEY_MOUSE if (c == KEY_MOUSE) {#if defined(NCURSES_MOUSE_VERSION)#define ButtonChanged(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, 037))#define ButtonPressed(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED))#define ButtonDouble(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED))#define ButtonTriple(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED))#define ButtonRelease(n) ((event.bstate) & NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED))//.........这里部分代码省略.........
开发者ID:ThomasDickey,项目名称:ncurses-snapshots,代码行数:101,
示例26: clrtext/* This routine simply clears out the old messages */void clrtext(void) { move(3,24); wprintw(stdscr," ");}
开发者ID:Howlinmoon,项目名称:Hacking_With_C,代码行数:5,
示例27: help_edit_field/* * Display a temporary window listing the keystroke-commands we recognize. */voidhelp_edit_field(void){ int x0 = 4; int y0 = 2; int y1 = 0; int y2 = 0; int wide = COLS - ((x0 + 1) * 2); int high = LINES - ((y0 + 1) * 2); WINDOW *help = newwin(high, wide, y0, x0); WINDOW *data = newpad(2 + SIZEOF(commands), wide - 4); unsigned n; int ch = ERR; begin_popup(); keypad(help, TRUE); keypad(data, TRUE); waddstr(data, "Defined form edit/traversal keys:/n"); for (n = 0; n < SIZEOF(commands); ++n) { const char *name;#ifdef NCURSES_VERSION if ((name = form_request_name(commands[n].result)) == 0)#endif name = commands[n].help; wprintw(data, "%s -- %s/n", keyname(commands[n].code), name != 0 ? name : commands[n].help); } waddstr(data, "Arrow keys move within a field as you would expect."); y2 = getcury(data); do { switch (ch) { case KEY_HOME: y1 = 0; break; case KEY_END: y1 = y2; break; case KEY_PREVIOUS: case KEY_PPAGE: if (y1 > 0) { y1 -= high / 2; if (y1 < 0) y1 = 0; } else { beep(); } break; case KEY_NEXT: case KEY_NPAGE: if (y1 < y2) { y1 += high / 2; if (y1 >= y2) y1 = y2; } else { beep(); } break; case CTRL('P'): case KEY_UP: if (y1 > 0) --y1; else beep(); break; case CTRL('N'): case KEY_DOWN: if (y1 < y2) ++y1; else beep(); break; default: beep(); break; case ERR: break; } werase(help); box(help, 0, 0); wnoutrefresh(help); pnoutrefresh(data, y1, 0, y0 + 1, x0 + 1, high, wide); doupdate(); } while ((ch = wgetch(data)) != ERR && ch != QUIT && ch != ESCAPE); werase(help); wrefresh(help); delwin(help); delwin(data); end_popup();}
开发者ID:ysleu,项目名称:RTL8685,代码行数:96,
示例28: PrintMemScreen//.........这里部分代码省略......... if( ibuf <= '9' ) { wbuf |= ibuf - 0x30; } else if( ibuf > 'F' ) { wbuf |= ibuf - 0x60 + 9; } else { wbuf |= ibuf - 0x40 + 9; } } } // // Print Offset Text // PrintFixedWin( MemScreen, offset, 17, 52, 4, 1, RED_BLUE, "0000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F0000/n0010/n0020/n0030/n0040/n0050/n0060/n0070/n0080/n0090/n00A0/n00B0/n00C0/n00D0/n00E0/n00F0" ); // // Print memory address // if( !MemScreen.info ) { MemScreen.info = newwin( 1, 47, 22, 0 ); MemScreen.p_info = new_panel( MemScreen.info ); } wbkgd( MemScreen.info, COLOR_PAIR( WHITE_BLUE ) ); wattrset( MemScreen.info, COLOR_PAIR( WHITE_BLUE ) | A_BOLD ); mvwprintw( MemScreen.info, 0, 0, "Type: Memory Address: " ); if( enter_mem ) { if( counter % 2 ) { wattrset( MemScreen.info, COLOR_PAIR( YELLOW_RED ) | A_BOLD ); } else { wattrset( MemScreen.info, COLOR_PAIR( YELLOW_BLACK ) | A_BOLD ); } wprintw( MemScreen.info, "%8.8X", phyaddr ); counter++; } else { wattrset( MemScreen.info, COLOR_PAIR( WHITE_BLUE ) | A_BOLD ); wprintw( MemScreen.info, "%8.8X", phyaddr ); } wattrset( MemScreen.info, COLOR_PAIR( WHITE_BLUE ) | A_BOLD ); wprintw( MemScreen.info, "h" ); wattrset( MemScreen.info, A_NORMAL ); // // Read memory space 256 bytes //
开发者ID:denir-li,项目名称:lfdk2,代码行数:67,
示例29: _cons_splash_logostatic void_cons_splash_logo(void){ win_print_time(console, '-'); wprintw(console->win, "Welcome to/n"); win_print_time(console, '-'); wattron(console->win, COLOUR_SPLASH); wprintw(console->win, " ___ _ /n"); wattroff(console->win, COLOUR_SPLASH); win_print_time(console, '-'); wattron(console->win, COLOUR_SPLASH); wprintw(console->win, " / __) (_)_ /n"); wattroff(console->win, COLOUR_SPLASH); win_print_time(console, '-'); wattron(console->win, COLOUR_SPLASH); wprintw(console->win, " ____ ____ ___ | |__ ____ ____ _| |_ _ _ /n"); wattroff(console->win, COLOUR_SPLASH); win_print_time(console, '-'); wattron(console->win, COLOUR_SPLASH); wprintw(console->win, "| _ // / ___) _ //| __) _ | _ //| | _) | | |/n"); wattroff(console->win, COLOUR_SPLASH); win_print_time(console, '-'); wattron(console->win, COLOUR_SPLASH); wprintw(console->win, "| | | | | | |_| | | ( ( | | | | | | |_| |_| |/n"); wattroff(console->win, COLOUR_SPLASH); win_print_time(console, '-'); wattron(console->win, COLOUR_SPLASH); wprintw(console->win, "| ||_/|_| //___/|_| //_||_|_| |_|_|//___)__ |/n"); wattroff(console->win, COLOUR_SPLASH); win_print_time(console, '-'); wattron(console->win, COLOUR_SPLASH); wprintw(console->win, "|_| (____/ /n"); wattroff(console->win, COLOUR_SPLASH); win_print_time(console, '-'); wprintw(console->win, "/n"); win_print_time(console, '-'); if (strcmp(PACKAGE_STATUS, "development") == 0) { wprintw(console->win, "Version %sdev/n", PACKAGE_VERSION); } else { wprintw(console->win, "Version %s/n", PACKAGE_VERSION); }}
开发者ID:cjopcjop,项目名称:profanity,代码行数:50,
示例30: help_draw_chatstatic void help_draw_chat(ToxWindow *self){ WINDOW *win = self->help->win; wmove(win, 1, 1); wattron(win, A_BOLD | COLOR_PAIR(RED)); wprintw(win, "Chat Commands:/n"); wattroff(win, A_BOLD | COLOR_PAIR(RED)); wprintw(win, " /invite <n> : Invite contact to a group chat/n"); wprintw(win, " /join : Join a pending group chat/n"); wprintw(win, " /sendfile <path> : Send a file/n"); wprintw(win, " /savefile <id> : Receive a file/n"); wprintw(win, " /cancel <type> <id> : Cancel file transfer where type: in|out/n");#ifdef AUDIO wattron(win, A_BOLD); wprintw(win, "/n Audio:/n"); wattroff(win, A_BOLD); wprintw(win, " /call : Audio call/n"); wprintw(win, " /answer : Answer incoming call/n"); wprintw(win, " /reject : Reject incoming call/n"); wprintw(win, " /hangup : Hangup active call/n"); wprintw(win, " /sdev <type> <id> : Change active device/n"); wprintw(win, " /mute <type> : Mute active device if in call/n"); wprintw(win, " /sense <n> : VAD sensitivity threshold/n"); wprintw(win, " /bitrate <n> : Set the audio encoding bitrate/n");#endif /* AUDIO */#ifdef VIDEO wattron(win, A_BOLD); wprintw(win, "/n Video:/n"); wattroff(win, A_BOLD); wprintw(win, " /video : Toggle video call/n");#endif /* VIDEO */ help_draw_bottom_menu(win); box(win, ACS_VLINE, ACS_HLINE); wnoutrefresh(win);}
开发者ID:JFreegman,项目名称:toxic,代码行数:43,
注:本文中的wprintw函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ wprintz函数代码示例 C++ wprintf_s函数代码示例 |