Changeset 493
- Timestamp:
- Jun 25, 2005, 1:27:31 PM (17 years ago)
- Location:
- libcaca/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/event.c
r487 r493 65 65 extern int gl_new_width; 66 66 extern int gl_new_height; 67 67 extern unsigned char gl_mouse_changed, gl_mouse_clicked; 68 extern unsigned int gl_mouse_x, gl_mouse_y; 69 extern unsigned int gl_mouse_button, gl_mouse_state; 68 70 #endif 69 71 #include "caca.h" … … 747 749 if(!_caca_resize) 748 750 { 749 750 751 751 _caca_resize = 1; 752 752 gl_resized=0; … … 754 754 } 755 755 } 756 756 if(gl_mouse_changed) 757 { 758 if(gl_mouse_clicked) 759 { 760 event|= CACA_EVENT_MOUSE_PRESS | gl_mouse_button; 761 gl_mouse_clicked=0; 762 } 763 mouse_x = gl_mouse_x; 764 mouse_y = gl_mouse_y; 765 event |= CACA_EVENT_MOUSE_MOTION | (mouse_x << 12) | mouse_y; 766 gl_mouse_changed = 0; 767 } 757 768 if(gl_key!=0) 758 769 { -
libcaca/trunk/src/graphics.c
r491 r493 266 266 int id[94]; 267 267 unsigned char gl_resized=0, gl_bit=0; 268 unsigned char gl_mouse_changed=0, gl_mouse_clicked=0; 269 unsigned int gl_mouse_x, gl_mouse_y; 270 unsigned int gl_mouse_button=0, gl_mouse_state=0; 268 271 #endif 269 272 … … 325 328 else 326 329 gl_bit=1; 327 328 } 330 } 331 static void gl_handle_mouse(int button, int state, int x, int y) 332 { 333 gl_mouse_clicked = 1; 334 gl_mouse_button = button; 335 gl_mouse_state = state; 336 gl_mouse_x = x/gl_font_width; 337 gl_mouse_y = y/gl_font_height; 338 gl_mouse_changed = 1; 339 } 340 static void gl_handle_mouse_motion(int x, int y) 341 { 342 gl_mouse_x = x/gl_font_width; 343 gl_mouse_y = y/gl_font_height; 344 gl_mouse_changed = 1; 345 } 346 329 347 #endif 330 348 … … 1009 1027 glutReshapeFunc(gl_handle_reshape); 1010 1028 1029 glutMouseFunc(gl_handle_mouse); 1030 glutMotionFunc(gl_handle_mouse_motion); 1031 glutPassiveMotionFunc(gl_handle_mouse_motion); 1032 1033 1011 1034 glLoadIdentity(); 1012 1035
Note: See TracChangeset
for help on using the changeset viewer.