Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mouse(int button,int state,int x,int y){
- if(button==GLUT_LEFT_BUTTON&&state==GLUT_DOWN)
- printf("%d,%d\n",x,y);
- if(button==GLUT_LEFT_BUTTON&&state==GLUT_DOWN&&
- x>=0&&x<=400&&y>=0&&y<=500){
- clicked = true;
- dragging = true;
- currentX = x;
- currentY = y;
- glutPostRedisplay();
- }
- if(button==GLUT_LEFT_BUTTON&&state==GLUT_UP) clicked = false;
- else if(button==GLUT_LEFT_BUTTON&&state==GLUT_DOWN&&
- x>400&&y>=0&&y<=500){
- clicked = false;
- dragging= false;
- }
- if(button==GLUT_RIGHT_BUTTON){
- clicked = false;
- glClearColor(0,0,0,0);
- }
- }
- void drag(int x, int y){
- if(dragging&&x<=400){
- currentX = x;
- currentY = y;
- glutPostRedisplay();
- }
- }
Add Comment
Please, Sign In to add comment