--- founts-11.old/Makefile +++ founts-11/Makefile @@ -2,7 +2,7 @@ CFLAGS = -O3 -I/usr/local/include/SDL -D_REENTRANT founts: founts.o - gcc -o founts founts.o -lm -lpthread -lSDL -ldl + gcc -o founts founts.o -lm -lpthread -lSDL -lSDL_image -ldl founts.o: founts.c founts.h --- founts-11.old/founts.c +++ founts-11/founts.c @@ -1,5 +1,4 @@ /* - Founts by David Ashley http://www.xdr.com/dash dash@xdr.com @@ -20,7 +19,7 @@ #include #include #include "founts.h" -#include "SDL.h" +#include #include "math.h" #include @@ -446,8 +445,9 @@ } void addtail(void *header,void *entry) { - while(((list *)header)->next) ((list *)header)=((list *)header)->next; - ((list *)header)->next=entry; + list *hp = (list *) header; + while(hp->next) hp = hp->next; + hp->next = entry; ((list *)entry)->next=0; } void delink(void *header,void *entry) @@ -2204,17 +2204,18 @@ printf("dash@xdr.com\n"); printf("Use: founts [screenwidth]\n"); printf("screenwidth is optional argument 100-2048 (default 640)\n"); - printf("c Change background colors\n"); - printf("e Eye demo\n"); - printf("f New fractal background\n"); - printf("h Hide/unhide the non-ball objects\n"); - printf("m Turn on/off mixing\n"); - printf("p Pause movement\n"); - printf("r Rotate hoses\n"); - printf("s Spiral pattern (escape to exit)\n"); - printf("x Delete everything\n"); - printf("1-9 Load preset\n"); - printf("shift 1-9 Store preset\n"); + printf("c Change background colors\n"); + printf("e Eye demo\n"); + printf("f New fractal background\n"); + printf("h Hide/unhide the non-ball objects\n"); + printf("m Turn on/off mixing\n"); + printf("p Pause movement\n"); + printf("q or ESCAPE Quit\n"); + printf("r Rotate hoses\n"); + printf("s Spiral pattern (escape to exit)\n"); + printf("x Delete everything\n"); + printf("1-9 Load preset\n"); + printf("shift 1-9 Store preset\n"); printf("Drag the fountains over the colors to change their color\n"); if(argc>1) @@ -2261,11 +2262,12 @@ int dx,dy; int xsize,ysize; unsigned char *pc; +signed short ssvtake; if(!take) take=dummyball; - dx=*((signed short *)take)++; - dy=*((signed short *)take)++; + ssvtake = *take++; dx = ssvtake; + ssvtake = *take++; dy = ssvtake; xsize=*take++; ysize=*take++; x+=dx; @@ -2274,8 +2276,9 @@ { while(run=*take++) { - dx=*((signed short *)take)++; - dy=*((signed short *)take)++; + ssvtake = *take++; dx = ssvtake; + ssvtake = *take++; dy = ssvtake; + if(bitsperpixel==16) { p1=(unsigned short *)(videomem+stridemult[y+dy]+(x+dx<<1)); @@ -2292,8 +2295,8 @@ { while(run=*take++) { - dx=*((signed short *)take)++; - dy=*((signed short *)take)++; + ssvtake = *take++; dx = ssvtake; + ssvtake = *take++; dy = ssvtake; dx+=x; dy+=y; p2=take; @@ -2344,9 +2347,13 @@ fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); exit(1); } - videoflags = SDL_SWSURFACE|SDL_HWPALETTE|SDL_ANYFORMAT; - thescreen = SDL_SetVideoMode(IXSIZE, IYSIZE, 16, videoflags); + SDL_WM_SetCaption ("founts", "founts"); + SDL_WM_SetIcon (IMG_Load ("__META_PREFIX__/data/founts.png"), NULL); + + videoflags = SDL_SWSURFACE|SDL_HWPALETTE; + thescreen = SDL_SetVideoMode (IXSIZE, IYSIZE, 16, videoflags); + if ( thescreen == NULL ) { fprintf(stderr, "Couldn't set display mode: %s\n", @@ -2374,9 +2381,14 @@ case SDL_KEYDOWN: key=event.key.keysym.sym; mod=event.key.keysym.mod; - if(key==SDLK_ESCAPE) - exitflag=1; - else processkey(key,mod); + + if ((key == SDLK_ESCAPE) || (key == SDLK_q)) + exitflag = 1; + else if ((key == SDLK_c) && ((mod & KMOD_CTRL) != 0)) + exitflag = 1; + else + processkey (key, mod); + break; case SDL_MOUSEBUTTONUP: buttonstate=NOTDOWN;