Des (deskitty) wrote,
Des
deskitty

  • Mood:

Random Acts of Boredom

I logged into my server today, and it gave me the following little gem:

You have a strong appeal for members of your own sex.

condor@deneb ~>


::sigh:: If only that were true ... ::rolls eyes::

>>>

Dr. Nico told me about this amusing little program called xroach. It makes roaches run around on your desktop (if you have UNIX) and hide under your windows. It amused me, so I just spent the past half-hour hacking on it to get the roaches to move at a reasonable speed.

Here's the patch:

diff -Nru xroach-4.0/xroach.c xroach-4.0-des1/xroach.c
--- xroach-4.0/xroach.c 1991-06-06 05:12:07.000000000 -0700
+++ xroach-4.0-des1/xroach.c    2005-02-16 10:30:12.000000000 -0800
@@ -32,6 +32,8 @@
 #include <malloc.h>
 #include <signal.h>

+#include <time.h>
+
 #if __STDC__
 #include <stdlib.h>
 #else
@@ -85,7 +87,8 @@
 Roach *roaches;
 int maxRoaches = 10;
 int curRoaches = 0;
-float roachSpeed = 20.0;
+float roachSpeed = 20;
+float roachStep = 20.0;

 Region rootVisible = NULL;

@@ -133,6 +136,9 @@
    else if (strcmp(arg, "-speed") == 0) {
        roachSpeed = strtod(av[++ax], (char **)NULL);
    }
+    else if (strcmp(arg, "-step") == 0) {
+        roachStep = strtod(av[++ax], (char **)NULL);
+    }
    else if (strcmp(arg, "-roaches") == 0) {
        maxRoaches = strtol(av[++ax], (char **)NULL, 0);
    }
@@ -231,6 +237,10 @@
        XNextEvent(display, &ev);
    }
    else {
+        struct timespec ts;
+        ts.tv_sec = 0;
+        ts.tv_nsec = (long)(1000000000/roachSpeed);
+        nanosleep(&ts, NULL);
        if (needCalc) {
        needCalc = CalcRootVisible();
        }
@@ -303,6 +313,7 @@
     USEPRT("       -rc      roachcolor\n");
     USEPRT("       -roaches numroaches\n");
     USEPRT("       -speed   roachspeed\n");
+    USEPRT("       -step    roachstep\n");
     USEPRT("       -squish\n");
     USEPRT("       -rgc     roachgutscolor\n");

@@ -494,8 +505,8 @@
     int ii;

     roach = &roaches[rx];
-    newX = roach->x + (roachSpeed * roach->rp->cosine);
-    newY = roach->y - (roachSpeed * roach->rp->sine);
+    newX = roach->x + (roachStep * roach->rp->cosine);
+    newY = roach->y - (roachStep * roach->rp->sine);

     if (RoachInRect(roach, (int)newX, (int)newY,
                0, 0, display_width, display_height)) {




So, yeah ... maybe I should actually work on that compilers homework that's due later today ...

-- Des
Subscribe

  • (no subject)

    Ugh...I feel shitty. This is what happens when you don't take care of yourself or eat properly all week. Even a long, hot shower didn't fix…

  • DennysCon 1

    Wow...this is incredibly weird... So, I went to Denny's tonight (more on that later), and on my way home, once I got over the Grade, it was…

  • (no subject)

    I'm still at kion's house...spending the night here, in fact (if it wasn't immediately obvious by the fact that it's about 4:30 AM).…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments