hsgj@batcomputer.tn.cornell.edu (Dan Green) (09/29/87)
This program is very trivial. All it does is display all 8 sprites, and wait for you to kill the window. The only use for this program is to RUN it, and then RUN preferences, and watch how sliding the preferences centering gadget around will trash your sprites. PLEASE NOTE that in a moment of stupidity I named this program "test". Thus you may want to rename it to "sprite tester", assuming you don't delete it after you use it to try out your preferences. Again, I am posting this to comp.sys.amiga because of a snafu in comp.sources.amiga. By the way, I sure hope that doc gets on the ball, because I am really looking forwards to Shell v2.07... # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by tcgould.tn.cornell.edu!hsgj on Mon Sep 28 20:25:10 EDT 1987 # Contents: test.uue test.c echo x - test.uue sed 's/^@//' > "test.uue" <<'@//E*O*F test.uue//' begin 0 test M #\P / X " <0 &X #E 8 "4 M > "0 D ! #P "8 2 &0 !$ /I D[Y M #[ $ ! @ /R #Z0 '$CSP !PC MP "0CR "A"N0 " L>0 0CS@ 23R4ZN_MHH0$JL *QG "H M80 !;"!L *S1R-'((&@ $-'(T<A(YR P1?D "L1_D L= %P ! 8)LI@ M A384<C__$(:(#D D('D H$AA3@&\># $ (&_T4H(FRF *$AA3@ P! M "!O!!3!8/)"&F#<0AI"FR "3-\,!$AY +"\ 3KD <(\ 03KD M L(\ 4(\ 83KD ,<< N>0 !Q.=6$ ,9A "P(\ @ M0J<O "1 ("H )&<0+'D (($ B* 3J[_@B(J "!G*"0\ #[4ZN_^(C MP ! CP !0CP !AG"N6(($ I: ( *1.N0 QQP & $("\ !"YY M '"\ +'D $(#D (9P(B0$ZN_F)*N0 "!G#DZN_WPB>0 "!. MKOZ&(!].=4CG 08N/ #@ <L> $3J[_E$S?8(!P9&"P0>P 7$ZN_H!![ !< M3J[^C$YU0KD (0_D &L(#P >3J[]V"/ "&>V3G4 ^P M : @ ;H &J !I 6H %> !4 4( $B !' M 18 #V Y -0 #& P +0 "F <@ &P !4 M3@ " 4 #@ @ " @ , $T S ( * M K@ +H #\@ ^H !N $ M M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P $R !&@ 0X #V /@ " M ; !0 T@ ,J # @ O@ +J "V@ KH *: "; M A0 '& !G 8X %X !8 4H $H !! +0 "L MG@ )8 "( @ '( !J 3@ $ & ![@ $ ( M W D + #<@ U( - "* 2 #\ N@ *0 M !< P P ,( !T@ "X % #0 90 %P !0@ M (X !X ! X +& "I@ HX &^ _( /J M8%-P<FET92!497-T !0 #( $ 4 \ M4W!R:71E(%1E<W0 "P% +W__P @ A ( L M / !_X ?^ _P'_@/\!_X M#_ ?^ _P'_@/\!_X !__@ 558 '__ 0 8 X , # M !I;G1U:71I;VXN;&EB<F%R>0!#;W5L9&XG="!O<&5N(&EN='5I=&EO M;B!L:6)R87)Y &=R87!H:6-S+FQI8G)A<GD 0V]U;&1N)W0@;W!E;B!G<F%P M:&EC<R!L:6)R87)Y $-O=6QD;B=T(&]P96X@<V-R965N $-O=6QD;B=T(&]P M96X@=VEN9&]W $-O=6QD;B=T(&%L;&]C871E('-P<FET92 E;&0* $-O=6QD M;B=T(&%L;&]C871E(&-H:7 @;65M;W)Y ^P " ! %( @ M _( /K )0 _( /I 'DCG #HH;P 4(&\ &")O !Q% M^@ Z3^__="9/+'D $3J[]]G#_2AM7R/_\1H!G$B\ 2&\ !$A43KD M3^\ #$_O (Q,WUP 3G46P$YU2.< .B9O !0@;P 80^\ '$7Z !(L>0 1. MKOWV3-]< $YU%L!.=0 ^P ! "@ #H #\@ ^D ) M2.<P "8O PD+P 02&\ %"\"+P-.N0 !/[P ,3-\ #$YU #[ $ M & %@ /R #Z0 DO B0O @O DAY "\Y %$ZY M $_O PD'TYU /L 0 ( 0 0 < 6 M 0 D * _( /J 25S"@ /R #Z0 ](YS " M+'D (3.\ #@ 03J[_T$S?0 Q.=0 +PXL>0 A.KO_*+%].=2\.+'D M (3J[_Q"Q?3G4 /L P ( P ( 8 #\@ M ^D F+PXL>0 1,[P # A.KO\Z+%].=0 +PXL>0 0B;P (("\ M#$ZN_RXL7TYU+PXL>0 0@+P (3J[^PBQ?3G4O#BQY !"!O A.KOZ, M+%].=2\.+'D $(F\ "$ZN_H8L7TYU+PXL>0 0B;P (3J[^8BQ?3G4O M#BQY !")O @@+P ,3J[]V"Q?3G4 /L !P ( "$ < M %P !( - !P $ _( /I $B\.+'D !P(&\ M"" O Q.KOYH+%].=2\.+'D !P("\ "$ZN_F(L7TYU2.< (BQY <$SO M!P #$ZN_EQ,WT0 3G4 ^P # !0 #( < ! M /R #Z0 !DO#BQY ;"!O A.KO^^+%].=2\.+'D !L(&\ "$ZN M_[@L7TYU+PXL>0 &P@;P (3J[_.BQ?3G4O#BQY ;"!O A.KO\T+%]. M=2\.+'D !L(&\ "$ZN_M0L7TYU #[ 4 % 5 $ L M & 0 #\@ ^D 12.=X "@ LX1*@&<P:@)$@"0 2H%F M!$* 8")J D2!)@#&P4A"Q,%(0D)"UH)(0<#!2$!"0-"#2H1J D2 3-\ 'DYU & /R end @//E*O*F test.uue// chmod u=rw,g=r,o=r test.uue echo x - test.c sed 's/^@//' > "test.c" <<'@//E*O*F test.c//' /* Program to test to see which sprites, if any, work ok. * NOTE: Uses default colors for sprites. * NOTE: Does not use Sprite 0, which is the mouse pointer sprite. */ #include "exec/types.h" #include "exec/memory.h" #include "intuition/intuition.h" #include "graphics/gfxbase.h" #include "graphics/sprite.h" #define FIRST_SPRITE 1 #define NUM_SPRITES 8 #define SPR_WORDS 68 /* Number of words of sprite data */ #define SPR_HEIGHT 14 /* Height of sprite in scan lines */ #define SPR_INIT_X 30 /* Initial (x,y) of first sprite */ #define SPR_INIT_Y 50 #define SPR_INC_X 30 /* dx, dy of subsequent sprites */ #define SPR_INC_Y 0 /* ================ Data Section ================ */ struct Screen *Screen; struct Window *Window; struct SimpleSprite sprite[NUM_SPRITES]; struct ViewPort *vp; struct IntuitionBase *IntuitionBase; struct GfxBase *GfxBase; UWORD *sprite_data[NUM_SPRITES]; /* A little screen that knows about sprites */ struct NewScreen newscreen = { 0, 0, 320, 200, 1, 0, 1, SPRITES, CUSTOMSCREEN, NULL, "Sprite Test", NULL, NULL }; /* A window that has a close button */ struct NewWindow newwindow = { 0, 11, 320, 189, -1, -1, CLOSEWINDOW, WINDOWCLOSE | SMART_REFRESH | NOCAREREFRESH | ACTIVATE, NULL, NULL, "Sprite Test", NULL, NULL, 0, 0, 0, 0, CUSTOMSCREEN }; /* Bits 0-7 in these words are set to 1 if the corresponding * * sprite or sprite data has been successfully allocated */ ULONG sprites_allocated = 0; ULONG spr_mem_allocated = 0; /* Sprite data (a very bad picture of a generic computer) */ UWORD init_data[] = { 0,0, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x1FF8, 0x0FF0, 0x1FF8, 0x0FF0, 0x1FF8, 0x0FF0, 0x1FF8, 0x0FF0, 0x1FF8, 0x0FF0, 0x1FF8, 0x0000, 0x7FFE, 0x0000, 0x5556, 0x0000, 0x7FFF, 0x0000, 0x0001, 0x0000, 0x0006, 0x0000, 0x0038, 0x0000, 0x0030, 0x0000, 0x0030, 0x0000, 0,0 }; /* ================ Code Section ================ */ /* Close any resources used by this program */ void cleanup() { int i; for (i = FIRST_SPRITE; i < NUM_SPRITES; i++) { if ((sprites_allocated & (1 << i)) != 0) FreeSprite(i); if ((spr_mem_allocated & (1 << i)) != 0) FreeMem(sprite_data[i],SPR_WORDS*sizeof(UWORD)); } if (Window != NULL) CloseWindow(Window); if (Screen != NULL) CloseScreen(Screen); if (GfxBase != NULL) CloseLibrary(GfxBase); if (IntuitionBase != NULL) CloseLibrary(IntuitionBase); } /* Close any allocated resources, print error message, and exit */ void fatal(msg) char *msg; { cleanup(); if (msg) puts(msg); exit(1); } /* Open all display resources */ void init_display() { /* Open intuition */ if ((IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",0)) == NULL) fatal("Couldn't open intuition library"); /* Open graphics */ if ((GfxBase = (struct GfxBase *) OpenLibrary("graphics.library",0)) == NULL) fatal("Couldn't open graphics library"); /* Open Screen */ if ((Screen = (struct Screen *) OpenScreen(&newscreen)) == NULL) fatal("Couldn't open screen"); /* Open Window */ newwindow.Screen = Screen; if ((Window = (struct Window *) OpenWindow(&newwindow)) == NULL) fatal("Couldn't open window"); /* Find the window's viewport */ vp = (struct ViewPort *)ViewPortAddress(Window); } /* Allocate and display the sprites */ init_sprites() { int i, j; char buf[80]; /* Allocate and initialize each sprite */ for (i = FIRST_SPRITE; i < NUM_SPRITES; i++) { if (GetSprite(&sprite[i],i) != i) { sprintf(buf,"Couldn't allocate sprite %ld\n",i); fatal(buf); } sprites_allocated |= (1 << i); /* Allocate image memory for the sprite */ if ((sprite_data[i] = (UWORD *) AllocMem(SPR_WORDS * sizeof(UWORD),MEMF_CHIP)) == NULL) fatal("Couldn't allocate chip memory"); spr_mem_allocated |= (1 << i); /* Copy sprite image into chip memory */ for (j = 0; j < SPR_WORDS; j++) sprite_data[i][j] = init_data[j]; /* Set sprite position */ sprite[i].x = SPR_INIT_X + (i * SPR_INC_X); sprite[i].y = SPR_INIT_Y + (i * SPR_INC_Y); sprite[i].height = SPR_HEIGHT; ChangeSprite(vp,&sprite[i],sprite_data[i]); } } /* Program to test to see which sprites, if any, work ok. */ main() { struct IntuiMessage *message; ULONG class; USHORT code; /* Open screen and sprites */ init_display(); init_sprites(); /* Wait for close button to be pushed */ for (;;) { Wait( 1 << Window->UserPort->mp_SigBit ); while ((message = (struct IntuiMessage *) GetMsg(Window->UserPort)) != NULL) { class = message->Class; code = message->Code; ReplyMsg(message); switch (class) { case CLOSEWINDOW: cleanup(); exit(0); break; default: break; } } } } @//E*O*F test.c// chmod u=rw,g=r,o=r test.c echo Inspecting for damage in transit... temp=/tmp/shar$$; dtemp=/tmp/.shar$$ trap "rm -f $temp $dtemp; exit" 0 1 2 3 15 cat > $temp <<\!!! 90 658 5361 test.uue 192 651 4677 test.c 282 1309 10038 total !!! wc test.uue test.c | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp if [ -s $dtemp ] then echo "Ouch [diff of wc output]:" ; cat $dtemp else echo "No problems found." fi exit 0 -- ARPA: hsgj@tcgould.tn.cornell.edu UUCP: ihnp4!cornell!batcomputer!hsgj BITNET: hsgj@cornella