diff options
-rw-r--r-- | daemon.c | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -1,11 +1,12 @@ /* Build with - gcc `pkg-config --cflags --libs gio-2.0` daemon.c -o daemon + gcc `pkg-config --cflags --libs gio-2.0` -lm daemon.c -o daemon */ #include <gio/gio.h> #include <string.h> #include <stdint.h> #include <arpa/inet.h> +#include <math.h> /************************************************************************ * conversion of raw image data to uncompressed png data: uris * @@ -743,6 +744,7 @@ demo (GOutputStream *out) GOutputStream *cout; char *header; int i; + int x, y, dx; int ball, save; header = @@ -776,16 +778,26 @@ demo (GOutputStream *out) send_text(cout, "welcome to ajax broadway", 403, 403); i = 0; + x = 0; dx = 9; while (1) { send_select_surface(cout, 0); - send_rgb (cout, 0xff0000 + i * 32); - send_rect (cout, i*10, i*10, 15, 15); - send_rgba (cout, 0x80ff0000 + i * 32); - send_rect (cout, i*10 + 50, i*10, 15, 15); - send_blend_alpha (cout, ball, 0, 0, 50, 50, - 200 + i * 20, 200 - i * 30, 70); + send_rgb (cout, 0x00000); + send_rect (cout, x, y, ball_w, ball_h); + + x += dx; + if (x > 700) { + x = 700 - (x-700); + dx = -dx; + } + if (x < 0) { + x = -x; + dx = -dx; + } + y = 300 - fabs(sin(i * M_PI * 2 / 60)) * 300; + send_blend (cout, ball, 0, 0, ball_w, ball_h, + x, y); i ++; |