A Conversation for h2g2 Demo Award - The Gathering 2000
What?
Lisa the Freak // Poet by the Toga Started conversation Apr 22, 2000
?!?!?!?!??!?!?!?!?!?!?!?!?!?!?!!
What?
Cybernard Posted Apr 23, 2000
--- cut here ---
#include
#include
#include
#include "allegro.h"
int main()
{
BITMAP *memory_bitmap;
int mypal[256];
int counter, c, temp;
float x, y, xcount, ycount, rad, length, col, twist, height, maxheight, lenstep, arms;
allegro_init();
install_keyboard();
set_gfx_mode(GFX_VESA1, 800, 600, 0, 0); /* 800, 600 is the resolution... */
memory_bitmap = create_bitmap(SCREEN_W, SCREEN_H);
clear(memory_bitmap);
for (counter=0;counter<=63;counter++) {
mypal[counter+63*0]=63+counter*256;
mypal[counter+63*1]=(-counter+64)+63*256;
mypal[counter+63*2]=(-counter+64)*256+counter*65536;
mypal[counter+63*3]=counter+(-counter+64)*65536;
}
mypal[253]=0;
set_palette(mypal);
floodfill (memory_bitmap, 0, 0, 253);
arms = 5; /* Try changing this to 1 or 20 */
lenstep = 30;
for (ycount = 1; ycount <= SCREEN_H; ycount += 1) {
for (xcount = 1; xcount <= SCREEN_W; xcount += 1) {
x = xcount - SCREEN_W / 2;
y = ycount - SCREEN_H / 2;
length = hypot (x, y) / 2;
rad = atan2 (x, y) * length;
twist = sin (length / 15) * 5;
col = (sin (rad / length * arms + twist) * 252 / 2 + 252 / 2 +
sin (length / lenstep) * 252 / 2 + 252 / 2) / 2;
putpixel (memory_bitmap, xcount, ycount, col);
}
}
blit (memory_bitmap, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
while ( !keypressed() ) { /* This code cycles the palette, creating a cool psychedelic effect... */
temp = mypal[252];
for (c = 252; c > 0; c--)
mypal[c] = mypal[c - 1];
mypal[0] = temp;
set_palette (mypal);
}
destroy_bitmap(memory_bitmap);
return 0;
}
--- cut here ---
There. If you compile that code under djgpp with allegro (gcc filename.c -o filename.exe -O2 -m486 -lalleg) you should get a cool psychedelic screensaver.
Now, a demo is sort of like this, only in 3d and a hundred times cooler.
What?
Lisa the Freak // Poet by the Toga Posted Apr 23, 2000
I still haven't got the faintest idea what this is
What?
Bruce Posted Apr 26, 2000
Maybe this will help http://www.gathering.org/presse/tg95/wired/democoders.html
;^)#
Key: Complain about this post
What?
More Conversations for h2g2 Demo Award - The Gathering 2000
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."