Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <curses.h>
  2.  
  3. static WINDOW* mainwin;
  4. static WINDOW* ekran;
  5. char * tab[10];
  6.  
  7. int main()
  8. {
  9. tab[10]="takaby";
  10. int ch,i=0;
  11. int y=1;
  12. int x=1;
  13. mainwin = initscr();
  14. noecho();
  15. wrefresh(mainwin);
  16.  
  17. ekran = newwin(15, 40, 7, 20);
  18. box(ekran, ACS_VLINE, ACS_HLINE);
  19. wrefresh(ekran);
  20. keypad(ekran, TRUE);
  21. curs_set(0);
  22.  
  23. while ((ch= wgetch(ekran)) != '\n')
  24. {
  25. wclear(ekran);
  26. box(ekran, ACS_VLINE, ACS_HLINE);
  27. if (ch == KEY_UP)
  28. {
  29. y-=1;
  30. }
  31. else if (ch == KEY_DOWN)
  32. {
  33. y+=1;
  34. }
  35. else if (ch == KEY_RIGHT)
  36. {
  37. x+=1;
  38. }
  39. else if (ch == KEY_LEFT)
  40. {
  41. x-=1;
  42. }
  43. mvwaddstr(ekran, y, x, tab[10]);
  44. wrefresh(ekran);
  45. }
  46.  
  47. refresh();
  48. wrefresh(mainwin);
  49.  
  50. endwin();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement