Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <curses.h>
- static WINDOW* mainwin;
- static WINDOW* ekran;
- char * tab[10];
- int main()
- {
- tab[10]="takaby";
- int ch,i=0;
- int y=1;
- int x=1;
- mainwin = initscr();
- noecho();
- wrefresh(mainwin);
- ekran = newwin(15, 40, 7, 20);
- box(ekran, ACS_VLINE, ACS_HLINE);
- wrefresh(ekran);
- keypad(ekran, TRUE);
- curs_set(0);
- while ((ch= wgetch(ekran)) != '\n')
- {
- wclear(ekran);
- box(ekran, ACS_VLINE, ACS_HLINE);
- if (ch == KEY_UP)
- {
- y-=1;
- }
- else if (ch == KEY_DOWN)
- {
- y+=1;
- }
- else if (ch == KEY_RIGHT)
- {
- x+=1;
- }
- else if (ch == KEY_LEFT)
- {
- x-=1;
- }
- mvwaddstr(ekran, y, x, tab[10]);
- wrefresh(ekran);
- }
- refresh();
- wrefresh(mainwin);
- endwin();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement