Category : Pascal Source Code
Archive   : SPRITES.ZIP
Filename : DEMO1.PAS

 
Output of file : DEMO1.PAS contained in archive : SPRITES.ZIP

(* ************************************************************** *)
(* *)
(* SpriteDemo1.Pas *)
(* *)
(* This program shows how to use sprites for multiple page *)
(* animation. The basic strategy is to use three pages: *)
(* the colorscreen, a hidden workbuffer which is a identical *)
(* (and may be written to unseen), and a third buffer which *)
(* is the part of the scene that does not change. One creates *)
(* the background and stores it both in backgroundbuffer and *)
(* in the workbuffer. Next, one writes to the workbuffer *)
(* ( that is, draws the sprites ). Next the workbuffer is *)
(* displayed by transferring it to the colorscreen. Then one *)
(* erases the workbuffer by transferring the backgroundbuffer *)
(* to it. The now blank workscreen can again be modified, *)
(* displayed, and erased again ... and again ... and ... *)
(* *)
(* The workbuffer and the backgroundbuffer each use 16K of *)
(* your data segment ( 32K out of your total of 64K ). You can *)
(* easily reduce this to 16K if after writing the background- *)
(* buffer you store it in the heapspace rather than in the *)
(* the data segment. However, in this small program it is not *)
(* necessary. *)
(* *)
(* The procedures PutSpriteC (x,y) and PutSpriteW (x,y) are *)
(* found in the in the include file Sprites.Lib which also *)
(* contains the important definitions for the program. The *)
(* procedure LoadTable (filename) will also be found in the *)
(* include file. *)
(* *)
(* (c) Donald L. Pavia *)
(* Department of Chemistry *)
(* ( Ver 2.0 ) Western Washington University *)
(* Bellingham, Washington 98225 *)
(* February 12, 1986 *)
(* *)
(* ************************************************************** *)

program SpriteDemo1;

{----------------------------------------------------------------------------}
{$I Sprites.Lib}
{----------------------------------------------------------------------------}

var i : integer;

{----------------------------------------------------------------------------}

BEGIN
clrscr; { clear the deck for }
GraphColorMode; GraphBackGround (1); Palette (2); { action and set up }

LoadTable ('DEMO1.TAB'); { load the table of sprites }

{----------------------------------------------------------------------}
{ draw background screen }

gotoxy (5,3); write ('Three Page Animation With Sprites');

Sprite := Table [2]; PutSpriteC (20,50); { draw direct to screen: }
Sprite := Table [4]; PutSpriteC (60,50); { this displays a number }
Sprite := Table[12]; PutSpriteC (100,50); { of different sprites }
Sprite := Table[14]; PutSpriteC (140,50); { which are to become a }
Sprite := Table[15]; PutSpriteC (180,50); { part of the background }
Sprite := Table [3]; PutSpriteC (210,50);
Sprite := Table [5]; PutSpriteC (250,50); { C = colorbuffer }
Sprite := Table[13]; PutSpriteC (290,50);

draw (0,100,319,100,1); draw (319,100,319,199,1); { box for the }
draw (319,199,0,199,1); draw (0,199,0,100,1); { animation }

WorkBuffer := ColorBuffer; { copy screen into workbuffer }
BackGroundBuffer := ColorBuffer; { copy screen for background }

TextColor (2); gotoxy (25,17); write ('Press ');
read (kbd,Wait);
{-----------------------------------------------------------------------}
{ multipage animation cycles }

{ Table[12] and Table[13] are a dragon }
for i := 3 to 33 do begin { Table[23] is the blast of fire }

{ W = workbuffer }
Sprite := Table[12]; PutSpriteW (8*i,150); { draw in workbuffer }
ColorBuffer := WorkBuffer; { display workbuffer }
WorkBuffer := BackGroundBuffer; { refresh workbuffer }

Sprite := Table[13]; PutSpriteW (8*i,150); { draw in workbuffer }
Sprite := Table[23]; PutSpriteW (8*i+28,150);
ColorBuffer := WorkBuffer; { display workbuffer }
WorkBuffer := BackGroundBuffer; { refresh workbuffer }

end;
{-----------------------------------------------------------------------}

read (Kbd,Wait); gotoxy (1,23);
TextMode (c80); clrscr; { exit gracefully }

END.


  3 Responses to “Category : Pascal Source Code
Archive   : SPRITES.ZIP
Filename : DEMO1.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/