本文整理汇总了C++中KEY_F函数的典型用法代码示例。如果您正苦于以下问题:C++ KEY_F函数的具体用法?C++ KEY_F怎么用?C++ KEY_F使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KEY_F函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char const *argv[]) {
WIN win;
int ch;
initscr();
start_color();
cbreak();
keypad(stdscr, TRUE);
noecho();
init_pair(1, COLOR_CYAN, COLOR_BLACK);
init_win_params(&win);
print_win_params(&win);
attron(COLOR_PAIR(1));
printw("Press F1 to exit");
refresh();
attroff(COLOR_PAIR(1));
create_box(&win, TRUE);
while ((ch = getch()) != KEY_F(1)) {
switch (ch) {
case KEY_LEFT:
create_box(&win, FALSE);
--win.startx;
create_box(&win, TRUE);
break;
case KEY_RIGHT:
create_box(&win, FALSE);
++win.startx;
create_box(&win, TRUE);
break;
case KEY_UP:
create_box(&win, FALSE);
--win.starty;
create_box(&win, TRUE);
break;
case KEY_DOWN:
create_box(&win, FALSE);
++win.starty;
create_box(&win, TRUE);
break;
}
}
endwin();
return 0;
}
开发者ID:bachue,项目名称:libncurses-test,代码行数:49,代码来源:8_more_bolder.c
示例2: main
int main(void) {
int flag=0;
initscr();
atexit(quit);
clear();
noecho();
curs_set(0);
cbreak();
keypad(stdscr, 1);
start_color();
init_pair(1, COLOR_YELLOW, COLOR_BLUE);
init_pair(2, COLOR_BLACK, COLOR_WHITE);
init_pair(3, COLOR_BLACK, COLOR_YELLOW);
win1 = newwin(10, 25, 5, 10);
win2 = newwin(10, 25, 10, 15);
box(win1, ACS_VLINE, ACS_HLINE);
box(win2, ACS_VLINE, ACS_HLINE);
pan1 = new_panel(win1);
pan2 = new_panel(win2);
bkgd(COLOR_PAIR(1));
wbkgd(win1, COLOR_PAIR(2));
wbkgd(win2, COLOR_PAIR(3));
mvaddstr(2,4, "F9 beendet das Programm");
mvwaddstr(win1, 2, 3, "Druecke eine Taste");
mvwaddstr(win2, 7, 3, "Druecke eine Taste");
update_panels();
doupdate();
while(getch() != KEY_F(9)) {
if (flag==0) {
top_panel(pan1);
flag = 1;
} else {
top_panel(pan2);
flag = 0;
}
update_panels();
doupdate();
}
return (0);
}
开发者ID:bakkertj,项目名称:6502,代码行数:49,代码来源:ncurses_panel_test.c
示例3: main
int main(void)
{
extern int flag;
int i, j;
int arr[HIGHT][WIDTH] = {0};
int ch;
initArr(arr);
initscr();/* Start curses mode */
cbreak();/* Line buffering disabled, Pass on * everty thing to me */
keypad(stdscr, TRUE);/* I need that nift y F1 */
noecho();
start_color();/* Start the color functionality */
printWin(arr);
/* Initialize the window parameters */
mvprintw(0,0,"%s","Press F1 to exit");
while((ch = getch()) != KEY_F(1))
{
switch(ch)
{
case KEY_LEFT:
case 'h':
leftArrow(arr);
printWin(arr);
break;
case KEY_RIGHT:
case 'l':
rightArrow(arr);
printWin(arr);
break;
case KEY_UP:
case 'k':
upArrow(arr);
printWin(arr);
break;
case KEY_DOWN:
case 'j':
downArrow(arr);
printWin(arr);
break;
}
}
endwin();
return 0;
}
开发者ID:oohcoder,项目名称:2048-game,代码行数:49,代码来源:main.c
示例4: main
int main(int argc, char *argv[])
{ WIN win;
int ch;
initscr(); /* Start curses mode */
start_color(); /* Start the color functionality */
cbreak(); /* Line buffering disabled, Pass on
* everty thing to me */
keypad(stdscr, TRUE); /* I need that nifty F1 */
noecho();
init_pair(1, COLOR_CYAN, COLOR_BLACK);
/* Initialize the window parameters */
init_win_params(&win);
print_win_params(&win);
attron(COLOR_PAIR(1));
printw("Press F1 to exit");
refresh();
attroff(COLOR_PAIR(1));
create_box(&win, TRUE);
while((ch = getch()) != KEY_F(1))
{ switch(ch)
{ case KEY_LEFT:
create_box(&win, FALSE);
--win.startx;
create_box(&win, TRUE);
break;
case KEY_RIGHT:
create_box(&win, FALSE);
++win.startx;
create_box(&win, TRUE);
break;
case KEY_UP:
create_box(&win, FALSE);
--win.starty;
create_box(&win, TRUE);
break;
case KEY_DOWN:
create_box(&win, FALSE);
++win.starty;
create_box(&win, TRUE);
break;
}
}
endwin(); /* End curses mode */
return 0;
}
开发者ID:kfatehi,项目名称:nim,代码行数:49,代码来源:window_2.c
示例5: CRT_init
void CRT_init(int delay, int colorScheme) {
initscr();
noecho();
CRT_delay = delay;
CRT_colorScheme = colorScheme;
halfdelay(CRT_delay/2);
nonl();
intrflush(stdscr, false);
keypad(stdscr, true);
curs_set(0);
if (has_colors()) {
start_color();
CRT_hasColors = true;
} else {
CRT_hasColors = false;
}
CRT_termType = getenv("TERM");
if (String_eq(CRT_termType, "xterm") || String_eq(CRT_termType, "xterm-color") || String_eq(CRT_termType, "vt220")) {
define_key("\033[H", KEY_HOME);
define_key("\033[F", KEY_END);
define_key("\033OP", KEY_F(1));
define_key("\033OQ", KEY_F(2));
define_key("\033OR", KEY_F(3));
define_key("\033OS", KEY_F(4));
define_key("\033[11~", KEY_F(1));
define_key("\033[12~", KEY_F(2));
define_key("\033[13~", KEY_F(3));
define_key("\033[14~", KEY_F(4));
define_key("\033[17;2~", KEY_F(18));
}
#ifndef DEBUG
signal(11, CRT_handleSIGSEGV);
#endif
signal(SIGTERM, CRT_handleSIGTERM);
use_default_colors();
if (!has_colors())
CRT_colorScheme = 1;
CRT_setColors(CRT_colorScheme);
mousemask(BUTTON1_CLICKED, NULL);
}
开发者ID:lyase,项目名称:htop,代码行数:41,代码来源:CRT.c
示例6: keyCodeToString
static const char *
keyCodeToString (int code)
{
if (code >= KEY_F(1) and code <= KEY_F(12)) {
char *buf = GetBuf ();
sprintf (buf, "F%d", code - KEY_F(1) + 1);
return buf;
}
for (int i = 0; i < n_keys; ++i)
if (KeyNames[i].key == code)
return KeyNames[i].name;
if (code < ' ') {
char *buf = GetBuf ();
sprintf (buf, "ctrl %c", code + 64);
return buf;
} else {
char *buf = GetBuf ();
sprintf (buf, "%c", code);
return buf;
}
return "(unkn)";
}
开发者ID:ronw23,项目名称:prime-osx,代码行数:24,代码来源:NCUI.cpp
示例7: getch
void Gui::handleInput()
{
int k = getch();
switch(k)
{
case ERR:
return;
case KEY_RESIZE:
recreateWindows();
return;
case KEY_F(12):
ioService.stop();
return;
}
}
开发者ID:hashedone,项目名称:snl,代码行数:15,代码来源:Gui.cpp
示例8: main
int main(int argc, char ** argv)
{
WINDOW * my_win;
int startx, starty, width, height;
int ch;
initscr();
cbreak(); // Line buffering disabled, Pass on everty thing to me
keypad(stdscr, TRUE); // I need that nifty F1
height = 3;
width = 10;
starty = (LINES - height) / 2; // Calculating for a center placement
startx = (COLS - width) / 2; // of the window
printw("Press F1 to exit");
refresh();
my_win = create_newwin(height, width, starty, startx);
while ((ch = getch()) != KEY_F(1)) {
switch (ch) {
case KEY_LEFT:
destroy_win(my_win);
my_win = create_newwin(height, width, starty,--startx);
break;
case KEY_RIGHT:
destroy_win(my_win);
my_win = create_newwin(height, width, starty,++startx);
break;
case KEY_UP:
destroy_win(my_win);
my_win = create_newwin(height, width, --starty,startx);
break;
case KEY_DOWN:
destroy_win(my_win);
my_win = create_newwin(height, width, ++starty,startx);
break;
}
}
endwin();
return 0;
}
开发者ID:osom8979,项目名称:example,代码行数:46,代码来源:main7.cpp
示例9: main
int main()
{ FIELD *f1[2];
FORM *frm1;
chtype ch;
int error;
HOOK fptr=getbuf;
initscr();
f1[0]=new_field(24,80,0,0,1,1);
assert(f1[0]!=NULL);
f1[1]=NULL;
frm1=new_form(f1);
assert(frm1!=NULL);
set_field_fore(f1[0],A_REVERSE);
field_opts_off(f1[0],O_STATIC);
//set_field_buffer(f1[0],0,"Sajid");
set_field_type(f1[0],TYPE_ALPHA,80);
set_field_term(f1[0],fptr);
post_form(frm1);
wrefresh(stdscr);
keypad(stdscr,TRUE);
while((ch=getch())!=KEY_F(3))
{ switch(ch)
{ case KEY_LEFT:
error=form_driver(frm1,REQ_PREV_CHAR);
if(error==E_REQUEST_DENIED)
form_driver(frm1,REQ_SCR_BCHAR);
break;
case KEY_RIGHT:
form_driver(frm1,REQ_NEXT_CHAR);
break;
default:
form_driver(frm1,ch);
break;
}
}
unpost_form(frm1);
free_form(frm1);
free_field(f1[0]);
getch();
printw(ptr);
endwin();
}
开发者ID:smsajid,项目名称:scdk,代码行数:45,代码来源:form.c
示例10: wprintw
void wrapNcs::bye(){
/*This method will replace exitEvent function*/
int hIntro,wIntro,xIntro,yIntro;
hIntro=LINES-10;
wIntro=COLS-10;
xIntro=(COLS-wIntro)/2;
yIntro=(LINES-hIntro)/2;
WINDOW *deco_w1=create_newwin(hIntro,wIntro,yIntro,xIntro);
WINDOW *deco_w2=create_newwin(hIntro-4,wIntro-4,yIntro+2,xIntro+2);
WINDOW *winText=create_newwinInv(hIntro-6,wIntro-6,yIntro+3,xIntro+3);
wprintw(winText,"%s",str.c_str());
wprintw(winText,"\nbye bye !! \nhit F2 key to finish\n");
wrefresh(winText);
while(getch()!=KEY_F(2)){}
destroy_win(winText);
destroy_win(deco_w1);
destroy_win(deco_w2);
}
开发者ID:ScrapCodes,项目名称:cbrainy,代码行数:18,代码来源:wrapncs.cpp
示例11: MessageType
//циклический ввод и отправка сообщений
void MessageType(void)
{
int ch,x,y,i=0;//,j=1;
char message[getmaxx(mpanel[2])-1];
while((ch=wgetch(mpanel[2]))!=KEY_F(5)&&end==0)
{
wrefresh(mpanel[2]);
//обработка enter
if(ch==10)
{
GetMessage(message);
ClearPanel(2);
wmove(mpanel[2],1,1);
i=0;
ClientSendMsg(message);
}
else if(ch==KEY_BACKSPACE)
{
getyx(mpanel[2],y,x);
if(x!=1)
{
wmove(mpanel[2],y,x-1);
wdelch(mpanel[2]);
box(mpanel[2],0,0);
wmove(mpanel[2],0,getmaxx(mpanel[2])/2-13);
wprintw(mpanel[2]," Type your message, %ld ",(long)getpid());
wmove(mpanel[2],1,getmaxx(mpanel[2])-2);
wprintw(mpanel[2]," ");
wmove(mpanel[2],y,x-1);
i--;
}
}
else
{
//не даем печатать за границу
if(i>=getmaxx(mpanel[2])-2)
{
continue;
}
wprintw(mpanel[2],"%c",ch);
i++;
}
}
}
开发者ID:kirill-lastochkin,项目名称:local_chat,代码行数:45,代码来源:ww_graf.c
示例12: HelpEditHook
void HelpEditHook(int Key) {
pdebug("HelpEditHook()\n");
char Type;
Type = 0;
if (Key < 256) {
Type = 1;
} else switch(Key) {
case KEY_LEFT:
case KEY_RIGHT:
case KEY_UP:
case KEY_DOWN:
case KEY_HOME:
case KEY_END:
case KEY_PPAGE:
case KEY_NPAGE:
case KEY_IC:
case '\t':
case KEY_BACKSPACE:
case KEY_ENTER:
case KEY_F(9): /* XXX */
Type = 1;
break;
}
if (Type == 1 && !IsNonModal) {
if (in_help) {
end_loop_help(Key);
} else {
end_loop(Key);
}
if (HelpWindow) {
/* in_help value may be different here ? */
if (in_help) {
start_loop_help();
} else {
start_loop();
}
}
} else {
ProcessSpecialKey(Key);
}
}
开发者ID:rpodgorny,项目名称:ewterm,代码行数:44,代码来源:help.c
示例13: main
int main(int argc, char *argv[])
{ int **s_board;
int n, i, ch;
tile blank;
if(argc != 2)
{ printf("Usage: %s <shuffle board order>\n", argv[0]);
exit(1);
}
n = atoi(argv[1]);
s_board = (int **)calloc(n, sizeof(int *));
for(i = 0;i < n; ++i)
s_board[i] = (int *)calloc(n, sizeof(int));
init_board(s_board, n, &blank);
initscr();
keypad(stdscr, TRUE);
cbreak();
shuffle_board(s_board, n);
while((ch = getch()) != KEY_F(1))
{ switch(ch)
{ case KEY_LEFT:
move_blank(RIGHT, s_board, n, &blank);
break;
case KEY_RIGHT:
move_blank(LEFT, s_board, n, &blank);
break;
case KEY_UP:
move_blank(DOWN, s_board, n, &blank);
break;
case KEY_DOWN:
move_blank(UP, s_board, n, &blank);
break;
}
shuffle_board(s_board, n);
if(check_win(s_board, n, &blank) == TRUE)
{ mvprintw(24, 0, "You Win !!!\n");
refresh();
break;
}
}
endwin();
return 0;
}
开发者ID:Fat-Zer,项目名称:LDP,代码行数:44,代码来源:shuffle.c
示例14: ncurses_KEY_F
JSBool
ncurses_KEY_F (JSContext* cx, JSObject* object, uintN argc, jsval* argv, jsval* rval)
{
if (argc < 1) {
JS_ReportError(cx, "Not enough parameters.");
return JS_FALSE;
}
jsint n; JS_ValueToInt32(cx, argv[0], &n);
if (n < 0 || n > 63) {
JS_ReportError(cx, "Out of range.");
return JS_FALSE;
}
*rval = INT_TO_JSVAL(KEY_F(n));
return JS_TRUE;
}
开发者ID:meh,项目名称:lulzjs-ncurses,代码行数:19,代码来源:ncurses.cpp
示例15: main
int main(int argc, char *argv[]) {
WINDOW *my_win;
int startx, starty, width, height;
int ch;
initscr();
cbreak();
keypad(stdscr, TRUE);
height = 3;
width = 10;
starty = (LINES - height) / 2;
startx = (COLS - width) / 2;
printw("Press F1 to exit");
refresh();
my_win = create_newwin(height, width, starty, startx);
while ((ch = getch()) != KEY_F(1)) {
switch(ch) {
case KEY_LEFT:
destroy_win(my_win);
my_win = create_newwin(height, width, starty, --startx);
break;
case KEY_RIGHT:
destroy_win(my_win);
my_win = create_newwin(height, width, starty, ++startx);
break;
case KEY_UP:
destroy_win(my_win);
my_win = create_newwin(height, width, --starty, startx);
break;
case KEY_DOWN:
destroy_win(my_win);
my_win = create_newwin(height, width, ++starty, startx);
break;
}
}
endwin();
return 0;
}
开发者ID:firisu,项目名称:sandbox,代码行数:42,代码来源:example7.c
示例16: main
int main(int argc, char *argv[]) {
int ch;
initscr();
atexit(quit);
clear();
noecho();
curs_set(0);
nl();
keypad(stdscr, TRUE);
it = (ITEM **)calloc(5, sizeof(ITEM *));
it[0] = new_item("M1", "");
it[1] = new_item("M2", "");
it[2] = new_item("M3", "");
it[3] = new_item("Ende", "");
it[4] = 0;
me = new_menu(it);
post_menu(me);
mvaddstr(7, 3, "Programm mittels Menü oder F2-Funktionstaste beenden");
refresh();
while ((ch = getch()) != KEY_F(2)) {
switch (ch) {
case KEY_DOWN:
menu_driver(me, REQ_DOWN_ITEM);
break;
case KEY_UP:
menu_driver(me, REQ_UP_ITEM);
break;
case 0xA:
if (item_index(current_item(me)) == 3) {
exit(0);
}
break;
}
}
return 0;
}
开发者ID:pwarnimo,项目名称:misc_projects,代码行数:42,代码来源:m1.c
示例17: main
int main (void) {
int tab[DIM_JEU][DIM_JEU], key, int_jeu_2048, score=0;
char continuer='y';
srand(time(NULL));
init_curses();
bkgd(COLOR_PAIR(1));
affiche_menu();
key=getch();
while(key!=ESCAPE)
{
if(key == KEY_F(2))
{
clear();
affiche_menu();
InitJeu(tab, &score);
do
{
int_jeu_2048 = jeu_2048(tab, &score);
if(int_jeu_2048 == 3)
{
move(4,0);
printw(" Vous avez atteint l'objectif ! \n");
printw(" Vous voulez continuer? (y/n) ");
continuer = SaisieOuiNon();
}
}
while (continuer == 'y' && int_jeu_2048 > 1);
if(int_jeu_2048 == 0)
printw(" Vouz avez perdu. \n");
if(int_jeu_2048 == 1)
printw(" Vouz ne pouvez plus retasser. \n");
}
key=getch();
}
endwin();
return 0;
}
开发者ID:isputra,项目名称:jeu2048,代码行数:42,代码来源:jeu_2048_curse.c
示例18: print
int print(int *positions, int num_queens)
{ int count;
int y = 2, x = 2, w = 4, h = 2;
static int solution = 1;
mvprintw(0, 0, "Solution No: %d", solution++);
board(stdscr, y, x, num_queens, num_queens, w, h);
for(count = 1; count <= num_queens; ++count)
{ int tempy = y + (count - 1) * h + h / 2;
int tempx = x + (positions[count] - 1) * w + w / 2;
mvaddch(tempy, tempx, QUEEN_CHAR);
}
refresh();
mvprintw(LINES - 2, 0, "Press Any Key to See next solution (F1 to Exit)");
if(getch() == KEY_F(1))
{ endwin();
exit(0);
}
clear();
}
开发者ID:cpressey,项目名称:ncurses_programs,代码行数:20,代码来源:queens.c
示例19: test1
void
test1(void) {
int ch;
printw("Type any character to see it in bold\n\r");
ch = getch(); /* If raw() hadn't been called we have
* to press enter before it gets to the
* program */
if (ch == KEY_F(1)) {
printw("F1 key pressed");
} else {
mvprintw(30, 2, "The key pressed is: ");
attron(A_BOLD);
printw("%c", ch);
attroff(A_BOLD);
}
refresh(); /* Prints it on the real screen */
getch(); /* Wait for user input */
}
开发者ID:olilea,项目名称:trim,代码行数:20,代码来源:tests.c
示例20: buttonbar_set_label
void
buttonbar_set_label (WButtonBar * bb, int idx, const char *text,
const struct global_keymap_t *keymap, const Widget * receiver)
{
if ((bb != NULL) && (idx >= 1) && (idx <= BUTTONBAR_LABELS_NUM))
{
unsigned long command = CK_IgnoreKey;
if (keymap != NULL)
command = keybind_lookup_keymap_command (keymap, KEY_F (idx));
if ((text == NULL) || (text[0] == '\0'))
set_label_text (bb, idx, "");
else
set_label_text (bb, idx, text);
bb->labels[idx - 1].command = command;
bb->labels[idx - 1].receiver = WIDGET (receiver);
}
}
开发者ID:GalaxyTab4,项目名称:workbench,代码行数:20,代码来源:buttonbar.c
注:本文中的KEY_F函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论