这篇教程C++ wmove函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wmove函数的典型用法代码示例。如果您正苦于以下问题:C++ wmove函数的具体用法?C++ wmove怎么用?C++ wmove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wmove函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dialog_menu/* * Display a menu for choosing among a number of options */int dialog_menu(const char *title, const char *prompt, int height, int width, int menu_height, const char *current, int item_no, const char *const *items){ int i, j, x, y, box_x, box_y; int key = 0, button = 0, scroll = 0, choice = 0; int first_item = 0, max_choice; WINDOW *dialog, *menu; FILE *f; max_choice = MIN(menu_height, item_no); /* center dialog box on screen */ x = (COLS - width) / 2; y = (LINES - height) / 2; draw_shadow(stdscr, y, x, height, width); dialog = newwin(height, width, y, x); keypad(dialog, TRUE); draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); wattrset(dialog, border_attr); mvwaddch(dialog, height - 3, 0, ACS_LTEE); for (i = 0; i < width - 2; i++) waddch(dialog, ACS_HLINE); wattrset(dialog, dialog_attr); wbkgdset(dialog, dialog_attr & A_COLOR); waddch(dialog, ACS_RTEE); print_title(dialog, title, width); wattrset(dialog, dialog_attr); print_autowrap(dialog, prompt, width - 2, 1, 3); menu_width = width - 6; box_y = height - menu_height - 5; box_x = (width - menu_width) / 2 - 1; /* create new window for the menu */ menu = subwin(dialog, menu_height, menu_width, y + box_y + 1, x + box_x + 1); keypad(menu, TRUE); /* draw a box around the menu items */ draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, menubox_border_attr, menubox_attr); item_x = (menu_width - 70) / 2; /* Set choice to default item */ for (i = 0; i < item_no; i++) if (strcmp(current, items[i * 2]) == 0) choice = i; /* get the scroll info from the temp file */ if ((f = fopen("lxdialog.scrltmp", "r")) != NULL) { if ((fscanf(f, "%d/n", &scroll) == 1) && (scroll <= choice) && (scroll + max_choice > choice) && (scroll >= 0) && (scroll + max_choice <= item_no)) { first_item = scroll; choice = choice - scroll; fclose(f); } else { scroll = 0; remove("lxdialog.scrltmp"); fclose(f); f = NULL; } } if ((choice >= max_choice) || (f == NULL && choice >= max_choice / 2)) { if (choice >= item_no - max_choice / 2) scroll = first_item = item_no - max_choice; else scroll = first_item = choice - max_choice / 2; choice = choice - scroll; } /* Print the menu */ for (i = 0; i < max_choice; i++) { print_item(first_item + i, i, i == choice); } wnoutrefresh(menu); print_arrows(dialog, item_no, scroll, box_y, box_x + item_x + 1, menu_height); print_buttons(dialog, height, width, 0); wmove(menu, choice, item_x + 1); wrefresh(menu); while (key != ESC) { key = wgetch(menu); if (key < 256 && isalpha(key)) key = tolower(key);//.........这里部分代码省略.........
开发者ID:ThinkIntegrate,项目名称:busybox,代码行数:101,
示例2: draw_slotvoiddraw_slot(void){ if (!boarding(ms, 0)) { mvwaddstr(slot_w, 0, 0, " "); mvwaddstr(slot_w, 1, 0, " "); } else mvwaddstr(slot_w, 1, 0, "OBP"); if (!boarding(ms, 1)) { mvwaddstr(slot_w, 2, 0, " "); mvwaddstr(slot_w, 3, 0, " "); } else mvwaddstr(slot_w, 3, 0, "DBP"); wmove(slot_w, SLOT_Y-4, 0); if (mf->RH) wprintw(slot_w, "%dRH", mf->RH); else waddstr(slot_w, " "); wmove(slot_w, SLOT_Y-3, 0); if (mf->RG) wprintw(slot_w, "%dRG", mf->RG); else waddstr(slot_w, " "); wmove(slot_w, SLOT_Y-2, 0); if (mf->RR) wprintw(slot_w, "%dRR", mf->RR); else waddstr(slot_w, " ");#define Y (SLOT_Y/2) wmove(slot_w, 7, 1); wprintw(slot_w,"%d", windspeed); mvwaddch(slot_w, Y, 0, ' '); mvwaddch(slot_w, Y, 2, ' '); mvwaddch(slot_w, Y-1, 0, ' '); mvwaddch(slot_w, Y-1, 1, ' '); mvwaddch(slot_w, Y-1, 2, ' '); mvwaddch(slot_w, Y+1, 0, ' '); mvwaddch(slot_w, Y+1, 1, ' '); mvwaddch(slot_w, Y+1, 2, ' '); wmove(slot_w, Y - dr[winddir], 1 - dc[winddir]); switch (winddir) { case 1: case 5: waddch(slot_w, '|'); break; case 2: case 6: waddch(slot_w, '/'); break; case 3: case 7: waddch(slot_w, '-'); break; case 4: case 8: waddch(slot_w, '//'); break; } mvwaddch(slot_w, Y + dr[winddir], 1 + dc[winddir], '+'); wrefresh(slot_w);}
开发者ID:mihaicarabas,项目名称:dragonfly,代码行数:63,
示例3: inputTestvoid inputTest(WINDOW *win){ int w, h, bx, by, sw, sh, i, c, num = 0; char buffer[80]; WINDOW *subWin; static const char spinner[4] = "/-//|"; int spinner_count = 0; 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, COLOR_PAIR(2) | A_BOLD); } else#endif wbkgd(subWin, A_BOLD); box(subWin, ACS_VLINE, ACS_HLINE); wrefresh(win); nocbreak(); 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(); wtimeout(win, 200);#ifdef PDCURSES mouse_set(ALL_MOUSE_EVENTS); PDC_save_key_modifiers(TRUE); PDC_return_key_modifiers(TRUE);#endif curs_set(0); /* turn cursor off */ while (1) { while (1) { c = wgetch(win); if (c == ERR) { spinner_count++; if (spinner_count == 4) spinner_count = 0; mvwaddch(win, 3, 3, spinner[spinner_count]); wrefresh(win); } else break; }#ifdef PDCURSES wmove(win, 4, 18); wclrtoeol(win);#endif mvwaddstr(win, 3, 5, "Key Pressed: "); wclrtoeol(win); if (c >= KEY_MIN) wprintw(win, "%s", keyname(c)); else if (isprint(c)) wprintw(win, "%c", c); else wprintw(win, "%s", unctrl(c));#ifdef PDCURSES if (c == KEY_MOUSE) { int button = 0; request_mouse_pos(); if (BUTTON_CHANGED(1)) button = 1; else if (BUTTON_CHANGED(2)) button = 2; else if (BUTTON_CHANGED(3)) button = 3; if (button && (BUTTON_STATUS(button) & BUTTON_MODIFIER_MASK)) {//.........这里部分代码省略.........
开发者ID:ttldtor,项目名称:PDCurses,代码行数:101,
示例4: update_statusstatic voidupdate_status(WINDOW *win, STATUS * sp){ switch (sp->ch) { case ' ': /* next test-iteration */ if (has_colors()) { if ((sp->c_msg = color_params(++(sp->c), &(sp->pair))) == 0) { sp->c_msg = color_params(sp->c = 0, &(sp->pair)); if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) { sp->v_msg = video_params(sp->v = 0, &(sp->attr)); } } } else { if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) { sp->v_msg = video_params(sp->v = 0, &(sp->attr)); } } sp->count = 0; show_status(win, sp); break; case KEY_LEFT: case 'h': if (sp->x_val > 0) wmove(win, sp->y_val, --(sp->x_val)); break; case KEY_DOWN: case 'j': if (sp->y_val < sp->y_max) wmove(win, ++(sp->y_val), sp->x_val); break; case KEY_UP: case 'k': if (sp->y_val > 0) wmove(win, --(sp->y_val), sp->x_val); break; case KEY_RIGHT: case 'l': if (sp->x_val < sp->x_max) wmove(win, sp->y_val, ++(sp->x_val)); break; case 't': touchline(win, sp->y_val, 1); break; case '=': sp->count = 0; show_status(win, sp); break; case '-': sp->count = -(sp->count); show_status(win, sp); break; case '?': do_subwindow(win, sp, show_help); break; default: if (isdigit(sp->ch)) { sp->count = (sp->count * 10) + (sp->ch - '0'); show_status(win, sp); } else { beep(); } break; }}
开发者ID:Scarletts,项目名称:LiteBSD,代码行数:64,
示例5: blocklist_onDrawstatic void blocklist_onDraw(ToxWindow *self, Tox *m, int y2, int x2){ wattron(self->window, A_BOLD); wprintw(self->window, " Blocked: "); wattroff(self->window, A_BOLD); wprintw(self->window, "%d/n/n", Blocked_Contacts.num_blocked); if ((y2 - FLIST_OFST) <= 0) return; int selected_num = 0; /* Determine which portion of friendlist to draw based on current position */ int page = Blocked_Contacts.num_selected / (y2 - FLIST_OFST); int start = (y2 - FLIST_OFST) * page; int end = y2 - FLIST_OFST + start; int i; for (i = start; i < Blocked_Contacts.num_blocked && i < end; ++i) { int f = Blocked_Contacts.index[i]; bool f_selected = false; if (i == Blocked_Contacts.num_selected) { wattron(self->window, A_BOLD); wprintw(self->window, " > "); wattroff(self->window, A_BOLD); selected_num = f; f_selected = true; } else { wprintw(self->window, " "); } wattron(self->window, COLOR_PAIR(RED)); wprintw(self->window, "x"); wattroff(self->window, COLOR_PAIR(RED)); if (f_selected) wattron(self->window, COLOR_PAIR(BLUE)); wattron(self->window, A_BOLD); wprintw(self->window, " %s/n", Blocked_Contacts.list[f].name); wattroff(self->window, A_BOLD); if (f_selected) wattroff(self->window, COLOR_PAIR(BLUE)); } wprintw(self->window, "/n"); self->x = x2; if (Blocked_Contacts.num_blocked) { wmove(self->window, y2 - 1, 1); wattron(self->window, A_BOLD); wprintw(self->window, "ID: "); wattroff(self->window, A_BOLD); int i; for (i = 0; i < TOX_CLIENT_ID_SIZE; ++i) wprintw(self->window, "%02X", Blocked_Contacts.list[selected_num].pub_key[i] & 0xff); } wrefresh(self->window); draw_del_popup(); if (self->help->active) help_onDraw(self);}
开发者ID:prodigeni,项目名称:toxic,代码行数:70,
示例6: quaffvoidquaff(){ THING *obj, *tp, *mp; bool discardit = FALSE; bool show, trip; obj = get_item("quaff", POTION); /* * Make certain that it is somethings that we want to drink */ if (obj == NULL) return; if (obj->o_type != POTION) { if (!terse) msg("yuk! Why would you want to drink that?"); else msg("that's undrinkable"); return; } if (obj == cur_weapon) cur_weapon = NULL; /* * Calculate the effect it has on the poor guy. */ trip = on(player, ISHALU); discardit = (bool)(obj->o_count == 1); leave_pack(obj, FALSE, FALSE); switch (obj->o_which) { case P_CONFUSE: do_pot(P_CONFUSE, !trip); when P_POISON: pot_info[P_POISON].oi_know = TRUE; if (ISWEARING(R_SUSTSTR)) msg("you feel momentarily sick"); else { chg_str(-(rnd(3) + 1)); msg("you feel very sick now"); come_down(); } when P_HEALING: pot_info[P_HEALING].oi_know = TRUE; if ((pstats.s_hpt += roll(pstats.s_lvl, 4)) > max_hp) pstats.s_hpt = ++max_hp; sight(); msg("you begin to feel better"); when P_STRENGTH: pot_info[P_STRENGTH].oi_know = TRUE; chg_str(1); msg("you feel stronger, now. What bulging muscles!"); when P_MFIND: player.t_flags |= SEEMONST; fuse((void(*)())turn_see, TRUE, HUHDURATION, AFTER); if (!turn_see(FALSE)) msg("you have a %s feeling for a moment, then it passes", choose_str("normal", "strange")); when P_TFIND: /* * Potion of magic detection. Show the potions and scrolls */ show = FALSE; if (lvl_obj != NULL) { wclear(hw); for (tp = lvl_obj; tp != NULL; tp = next(tp)) { if (is_magic(tp)) { show = TRUE; wmove(hw, tp->o_pos.y, tp->o_pos.x); waddch(hw, MAGIC); pot_info[P_TFIND].oi_know = TRUE; } } for (mp = mlist; mp != NULL; mp = next(mp)) { for (tp = mp->t_pack; tp != NULL; tp = next(tp)) { if (is_magic(tp)) { show = TRUE; wmove(hw, mp->t_pos.y, mp->t_pos.x); waddch(hw, MAGIC); } } } } if (show) { pot_info[P_TFIND].oi_know = TRUE; show_win("You sense the presence of magic on this level.--More--"); } else msg("you have a %s feeling for a moment, then it passes", choose_str("normal", "strange")); when P_LSD://.........这里部分代码省略.........
开发者ID:Elronnd,项目名称:rogomatic,代码行数:101,
示例7: input_string/* implement basic frame work to build a field input */char *input_string (WINDOW * win, int pos_y, int pos_x, size_t max_width, const char *str, int enable_case, int *toggle_case){ char *s = xmalloc (max_width + 1), *tmp; size_t pos = 0, x = 0, quit = 1, c; /* window dimensions */ size_t size_x = 0, size_y = 0, i; getmaxyx (win, size_y, size_x); size_x -= 4; /* are we setting a default string */ if (str) { size_t len = MIN (max_width, strlen (str)); memcpy (s, str, len); s[len] = '/0'; x = pos = 0; /* is the default str length greater than input field? */ if (strlen (s) > size_x) { tmp = xstrdup (&s[0]); tmp[size_x] = '/0'; mvwprintw (win, pos_y, pos_x, "%s", tmp); free (tmp); } else mvwprintw (win, pos_y, pos_x, "%s", s); } else s[0] = '/0'; if (enable_case) draw_header (win, "[x] case sensitive", " %s", size_y - 2, 1, size_x - 2, 2, 0); wmove (win, pos_y, pos_x + x); wrefresh (win); curs_set (1); while (quit) { c = wgetch (stdscr); switch (c) { case 1: /* ^a */ case 262: /* HOME */ pos = x = 0; break; case 5: case 360: /* END of line */ if (strlen (s) > size_x) { x = size_x; pos = strlen (s) - size_x; } else { pos = 0; x = strlen (s); } break; case 7: /* ^g */ case 27: /* ESC */ pos = x = 0; if (str && *str == '/0') s[0] = '/0'; quit = 0; break; case 9: /* TAB */ if (!enable_case) break; *toggle_case = *toggle_case == 0 ? 1 : 0; if (*toggle_case) draw_header (win, "[ ] case sensitive", " %s", size_y - 2, 1, size_x - 2, 2, 0); else if (!*toggle_case) draw_header (win, "[x] case sensitive", " %s", size_y - 2, 1, size_x - 2, 2, 0); break; case 21: /* ^u */ s[0] = '/0'; pos = x = 0; break; case 8: /* xterm-256color */ case 127: case KEY_BACKSPACE: if (pos + x > 0) { memmove (&s[(pos + x) - 1], &s[pos + x], (max_width - (pos + x)) + 1); if (pos <= 0) x--; else pos--; } break; case KEY_LEFT: if (x > 0) x--; else if (pos > 0) pos--; break; case KEY_RIGHT: if ((x + pos) < strlen (s)) { if (x < size_x) x++; else//.........这里部分代码省略.........
开发者ID:M2shad0w,项目名称:goaccess,代码行数:101,
示例8: ui_refresh_displayvoid ui_refresh_display (unsigned int x, unsigned int y, char c){ wmove (display_win, y+1, x+1); wprintw (display_win, "%c", c); wrefresh (display_win);}
开发者ID:Dave2084,项目名称:freewpc,代码行数:6,
示例9: ui_update_ball_trackervoid ui_update_ball_tracker (unsigned int ballno, const char *location){ wmove (ball_tracker_win, ballno+1, 1); wprintw (ball_tracker_win, "%d: %-14.14s", ballno, location); wrefresh (ball_tracker_win);}
开发者ID:Dave2084,项目名称:freewpc,代码行数:6,
示例10: ui_write_sound_commandvoid ui_write_sound_command (unsigned int x){ wmove (sound_win, 1, 1); wprintw (sound_win, "%04X", x); wrefresh (sound_win);}
开发者ID:Dave2084,项目名称:freewpc,代码行数:6,
示例11: ui_write_sound_resetvoid ui_write_sound_reset (void){ wmove (sound_win, 1, 1); wprintw (sound_win, " "); wrefresh (sound_win);}
开发者ID:Dave2084,项目名称:freewpc,代码行数:6,
示例12: main/*MAINEnvoyer et recevoir des donnesGere les fenetres du GUI*/int main (int argc, char* argv[]) { if ( argc < 2 ) { printf ("Usage: %s PORT/n", argv[0]); exit (EXIT_FAILURE); } initscr(); // Start curses mode cbreak(); // Line buffering disabled, Pass on everty thing to me //my_win = create_newwin(height, width, starty, startx); f_haut = definirFenetre( f_haut_hauteur, COLS, 0, 0 ); f_bas = definirFenetre( f_bas_hauteur, COLS, (LINES - f_bas_hauteur - marge_bas), 0 ); f_info = definirFenetre( f_info_hauteur, COLS, (LINES - donnerHauteur(f_bas) - f_info_hauteur - marge_bas), 0 ); f_cmd = definirFenetre( f_cmd_hauteur, COLS, (LINES - donnerHauteur(f_bas) - donnerHauteur(f_info) - marge_bas - f_cmd_hauteur), 0); f_chat = definirFenetre( (LINES - donnerHauteur(f_haut) - donnerHauteur(f_cmd) - donnerHauteur(f_info) - donnerHauteur(f_bas) - marge_bas), COLS, donnerHauteur(f_haut), 0 ); refresh(); w_haut = create_newwin_with_border( f_haut ); w_bas = create_newwin_no_border( f_bas ); w_info = create_newwin_with_border( f_info ); w_cmd = create_newwin_with_border( f_cmd ); w_chat = create_newwin_no_border( f_chat ); scrollok( w_chat, 1 ); wsetscrreg( w_chat, donnerStarty(f_chat), donnerHauteur(f_chat) ); wtimeout(w_bas, 500); mvwprintw(w_haut, 1, 1, "CHAT CLIENT"); mvwprintw(w_cmd, 1, 1, ""); mvwprintw(w_info, 1, 1, "/nom usager/t/mp usager msg/t/creer groupe type/t/info groupe/t/t/accept usager groupe"); mvwprintw(w_info, 2, 1, "/t/t/mg groupe msg/t/joindre groupe/t/t/liste usagers/t/t/refuser usager groupe"); mvwprintw(w_info, 3, 1, "/quitter/t/t/t/byebye groupe/t/t/liste groupes/t/t/stats groupe"); wmove( w_bas, 0, 0 ); wrefresh(w_haut); wrefresh(w_info); wrefresh(w_bas); wrefresh(w_cmd); struct sockaddr_in serveur; struct hostent* hp; socket_d = socket (AF_INET, SOCK_STREAM, 0); if (socket_d < 0) { endwin(); printf("Erreur lors de la création de la socket !/n"); return 1; } setnonblocking (socket_d); hp = gethostbyname("localhost"); if (hp==0) { endwin(); close (socket_d); printf("H C++ wnoutrefresh函数代码示例 C++ wmemset函数代码示例
|