Advertisement
Guest User

Untitled

a guest
Dec 24th, 2011
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. class JulMouse {
  2.     public:
  3.         WINDOW *Win;
  4.         JulMouse(WINDOW *Win) {
  5.             this->Win=Win;
  6.         }
  7.         void start() {
  8.             int c;
  9.             MEVENT event;
  10.             mousemask(ALL_MOUSE_EVENTS, 0);
  11.             while(1) {
  12.                 c = wgetch(this->Win);
  13.                 if(getmouse(&event) == OK) {;
  14.                     if(1) {
  15.                         ostringstream spos;
  16.                         string pos;
  17.                         spos << "x: " << event.x << " y: " << event.y << " " << c;
  18.                         pos = spos.str();
  19.                         wmove(Win,22/2,1);
  20.                         whline(Win, ' ', 60);
  21.                         mvwprintw(Win,22/2, (62-pos.length())/2,pos.c_str());
  22.                     }
  23.                 } else {
  24.                     perror("Getmouse");
  25.                     JulEnd(-1);
  26.                 }
  27.             }
  28.         }
  29.         ~JulMouse() {}
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement