Eenvaders: an animated wallpaper for enlightenment

While browsing levitated.net which is an interesting site with lots of original flash animations, I stumbled across Invader.fractal. I wanted to make the same as a wallpaper for enlightenment.

A bit of code

I’ve put all the code on github.

In order for the wallpaper to be fast and use low ressources, I decided to have an evas smart object used inside an edje external module. That module is then used in a very small edc file making it a background usable by enlightenment.

In order to draw a 7x7 random eenvader, here’s the code:

    #define FG 0xff839496
    uint16_t u = rand();
    int *mem = calloc(7 * 7, sizeof(int));

    for (int i = 0; i < 15; i++) {
        if (u & (1 << i)) {
            mem[7 + 7*(i/3) + 1 + i%3] = FG;
            mem[7 + 7*(i/3) + 5 - i%3] = FG;
        }
    }

I let my C compiler unroll the loop and optimise the code for me.

What does it look like?

I use colors from solarized.

eenvarders screenshot

And if you click and kill the big one on the left, here’s what you get:

eenvarders screenshot with the big one on the left killed

The wallpaper is refreshed every 30 seconds.