Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // compile with:
- // gcc `xosd-config --cflags --libs` test3.c -o test3
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <locale.h>
- #include <xosd.h>
- #include <X11/Xlib.h>
- #include <time.h>
- int basket_x = 160;
- int basket_y = 412;
- int ball_x = 0;
- int ball_y = 0;
- int main (int argc, char *argv[])
- {
- xosd *osd;
- setlocale(LC_ALL, "");
- osd = xosd_create (2);
- xosd_set_font (osd, "-adobe-helvetica-bold-r-normal-*-*-320-*-*-p-*-*");
- Display *display = XOpenDisplay(NULL);
- Window root, fromroot, tmpwin;
- int x, y,prev_x,prev_y, tmp;
- uint tmp2;
- root = DefaultRootWindow(display);
- XQueryPointer(display, root, &fromroot, &tmpwin, &prev_x, &prev_y, &tmp, &tmp, &tmp2);
- char * the_text = malloc(200);
- while(1){
- XQueryPointer(display, root, &fromroot, &tmpwin, &x, &y, &tmp, &tmp, &tmp2);
- if(x!=prev_x || y!=prev_y){
- prev_x = x;
- prev_y = y;
- sprintf(the_text, "! %d %d !", x, y);
- xosd_set_vertical_offset (osd, y);
- xosd_set_horizontal_offset (osd, x);
- xosd_display (osd, 0, XOSD_string, the_text);
- }
- usleep(50000);
- }
- sleep (8);
- xosd_destroy (osd);
- exit (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement