home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / grafik / sprite / designer.doc < prev    next >
Encoding:
Text File  |  1986-04-29  |  19.0 KB  |  396 lines

  1.  
  2.  
  3.                                DESIGNER.COM
  4.  
  5.                     TURBO PASCAL SPRITE AND SPRITE TABLE
  6.                                   EDITOR
  7.  
  8.        { Requires : IBM Compatible Computer, PC or MS.DOS 2.xx, 256 k,   }
  9.        {            and a CGA compatible color card.                     }
  10.  
  11.                             version 2.00 Feb 1986
  12.  
  13.         This disk contains  procedures, functions and a utility that allow
  14.       the use of sprites and animation in Turbo Pascal programs.  I am re-
  15.       leasing the disk to the Public Domain for distribution by User Groups
  16.       or Bulletin Boards subject to the following stipulations:
  17.  
  18.       1) Any person may obtain a copy of the BASE FILES on this disk either
  19.          through their local User's Group or Bulletin Board, or by sending
  20.          me a blank, double-sided, double-density 5 1/4 inch floppy diskette
  21.          along with a PRE-PAID, SELF-ADDRESSED floppy diskette mailer.
  22.  
  23.              send to  :       Donald L. Pavia
  24.                               1488 Lahti Dr.
  25.                               Bellingham, WA. 98226   USA
  26.  
  27.          Clubs may freely copy and distribute the diskette with the base files
  28.          for a nominal distribution fee, not to exceed $10.
  29.  
  30.       2) This disk contains a .COM file version of the sprite editor/designer,
  31.          a .COM file of a sprite composer, and sample routines showing how to
  32.          use the sprite files generated by the utility program. You may freely
  33.          use the sprite files and the <COMPILED CODE> for the driver routines
  34.          (mostly from Sprites.inc) in any of your own programs. If you find
  35.          regular use, a $10 donation would be greatly appreciated, or better
  36.          yet, buy the source code (see below).
  37.  
  38.       3) I retain all rights to the SOURCE CODE of the two utilities and that
  39.          of Sprites.inc,  and  I have not released that code  into the Public
  40.          Domain. You may acquire a copy of the commented Turbo Pascal source
  41.          code for the two utilities in one of the following ways:
  42.  
  43.             1) Send me a check for $20 ($15 plus S/H)     OR
  44.  
  45.             2) Send me a check for $15 and a blank double-sided, double-density
  46.                5 1/4 inch floppy diskette along with a PRE-PAID, SELF-ADDRESSED
  47.                floppy diskette mailer      OR
  48.  
  49.             3) From another individual if you send me a legitimizing check
  50.                for $15.
  51.  
  52.          You may not obtain or distribute the source code except under the
  53.          conditions stated above. Nor may unaltered functions and procedures
  54.          from the source code, or from sprites.inc, be incorporated into other
  55.          source code of your own which you distribute. You really don't re-
  56.          quire the source code unless you wish to learn from it, or modify it
  57.          to your own needs. It would, for instance, be quite possible to re-
  58.          compile the source code with overlays so that it might run on a 128k
  59.          machine. It would also be possible to alter the size of the sprites.
  60.  
  61.            SORRY ABOUT THE LEGALITIES  -  HOWEVER,  I DO WISH TO PROTECT
  62.            MYSELF AND PERHAPS TO GAIN SOMETHING FROM MY TIME SPENT. YOUR
  63.            COOPERATION WILL ENCOURAGE ME TO RELEASE  MORE OF MY PROGRAMS.
  64.            I WOULD APPRECIATE HEARING OF ANY BUGS OR IMPROVEMENTS.
  65.  
  66.  
  67.  
  68.                                         2
  69.  
  70.          The following files will be found on this free distribution disk:
  71.  
  72.          {----------------------------------------------------------------}
  73.  
  74.            DESIGNER.COM   The Sprite designing utility which allows you to
  75.                           create sprite arrays and store them in a table of
  76.                           up to 24 sprites written to disk. Single sprites
  77.                           may also be stored.
  78.  
  79.          {-----------------------------------------------------------------}
  80.  
  81.            DESIGNER.__1   These are necessary screen files for Designer.com
  82.            DESIGNER.__2   and they must reside on the same disk drive.
  83.  
  84.          {-----------------------------------------------------------------}
  85.  
  86.  
  87.            COMPOSER.COM   A programming utility that allows you to load a
  88.                           saved screen file (or a blank screen) and a sprite
  89.                           table, and to move the sprites around freely so as
  90.                           to design an arrangement or an animation pathway.
  91.                           Composer gives screen coordinates of the active
  92.                           sprite, and you may write the positions to a
  93.                           printer. This output can be used to write code.
  94.  
  95.          {------------------------------------------------------------------}
  96.  
  97.            SPRITES.LIB    These are the definitions and driver routines that
  98.                           allow you to use sprites in your own programs. You
  99.                           may not need them all. For a given program those
  100.                           that are unused may be deleted.
  101.  
  102.          {------------------------------------------------------------------}
  103.  
  104.            DEMOx.PAS      A variety of sample programs that show how to do
  105.                           multiple page animation (4 color graphics mode),
  106.                           xor animation, zone-clearing animation and the
  107.                           like. Most of these use external files of sprite
  108.                           tables. There are eight demo programs.
  109.  
  110.          {------------------------------------------------------------------}
  111.  
  112.            DEMOx.TAB      These are 3072 byte sprite tables (24 sprites)
  113.            ????????.TAB   which are stored on disk and used in the sample
  114.                           programs.
  115.  
  116.          {------------------------------------------------------------------}
  117.  
  118.            ????????.SPR   These are 128 byte individual sprites stored on
  119.                           disk. They are used in the demo programs.
  120.  
  121.          {------------------------------------------------------------------}
  122.  
  123.            ????????.INC   These are individual sprites that have been con-
  124.                           verted to typed constant arrays that may be di-
  125.                           rectly included in your code. Their sizes will
  126.                           vary.
  127.  
  128.          {------------------------------------------------------------------}
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                                         3
  135.  
  136.                                    THE PROGRAM
  137.  
  138.          The program loads immediately to the single sprite editor. There is
  139.       also a sprite table editor which may be seen by pressing menu selection
  140.       T for (T)able. You may return to the single sprite editor by pressing R
  141.       for (R)eturn. I will explain each editor separately, the single sprite
  142.       editor first.
  143.  
  144.      (* ******************************************************************* *)
  145.  
  146.  
  147.       I. SINGLE SPRITE EDITOR/DESIGNER
  148.  
  149.          You will immediately see the sprite designing grid. It has dimensions
  150.       of  24 pixels across  and  20 pixels down.   It designs sprites for the
  151.       medium resolution 320 x 200 pixel 4 color graphics mode (GraphColorMode).
  152.       The actual sized sprite is displayed in a box in the upper left-hand
  153.       corner of the screen. The design grid is of course magnified.
  154.  
  155.          The following options are found on the main menu.
  156.  
  157.      {-----------------------------------------------------------------------}
  158.  
  159.       (N)ew        Erases the work grid and sets the sprite array to zero.
  160.       (S)ave       Saves the sprite on the work grid to disk (128 byte file).
  161.       (L)oad       Loads a saved sprite from a disk file into the work grid.
  162.       (T)able      Changes over to the sprite table editor.
  163.       (A)nim       Xor animates sprite in the work grid at bottom of screen.
  164.       (B)ackgr     Changes background color for editor   (0 - 16).
  165.       (C)olrs      Changes palette for the sprite editor (0 - 4).
  166.       (D)imen      Dimensions sprite in grid by rows and columns.
  167.       (I)nc        Generates include file code for defining sprites.
  168.       (F)iles      Gives a file directory and access to file rename/erase.
  169.  
  170.       (X) Exit     Goodbye. Return to DOS.
  171.  
  172.       (0)          Sets a pixel to background color (blank or erased).
  173.       (1)          Sets a pixel to green      (or  cyan    ).
  174.       (2)          Sets a pixel to red        (or  magenta ).
  175.       (3)          Sets a pixel to brown      (or  white   ).
  176.  
  177.       CURSOR KEYS  Move the cursor around the workgrid.
  178.  
  179.  
  180.                          BRIEF EXPLANATIONS OF MENU SELECTIONS
  181.  
  182.                             (Press the Indicated Character)
  183.  
  184.      {-----------------------------------------------------------------------}
  185.  
  186.          A more detailed explanation of each of these options follows below.
  187.       All commands are case insensitive. You may use either lower or upper
  188.       case.
  189.  
  190.      {------------------------------------------------------------------------}
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.                                         4
  202.  
  203.       (N)ew    Pressing N causes both the workgrid and the sprite array to
  204.                be erased. All work is lost and you start anew. However, New
  205.                does not erase the sprite table that might be loaded in the
  206.                TABLE EDITOR.
  207.  
  208.       (S)ave   Pressing S causes the current sprite (the one in the workgrid)
  209.                to be saved to disk as a 128 byte file. This file contains a
  210.                single sprite. It is my convention to name single-sprite files
  211.                with the extension .SPR. You may abort this command by pressing
  212.                <ENTER>.
  213.  
  214.       (L)oad   Pressing L will allow you to load a single-sprite file into the
  215.                workgrid. You will be asked for the name of the file. The files
  216.                Santa.spr, Dragon.spr, Zone1.spr and Zone2.spr can be found on
  217.                the distribution disk. You may abort this command by pressing
  218.                <ENTER>.
  219.  
  220.       (T)able  Pressing T will take you to the TABLE EDITOR. The current sprite
  221.                in the workgrid will be taken along so that it may be loaded
  222.                into the table. This current sprite will be seen at the center
  223.                top of the sprite table screen.
  224.  
  225.       (A)nim   Pressing A will cause the sprite currently loaded in the work-
  226.                grid to be xor animated at the bottom of the screen. This will
  227.                allow you a rough idea of what your sprite will look like in an
  228.                animated sequence.
  229.  
  230.       (B)ckgr  Pressing B will change the background color of the screen. You
  231.                may step through all 16 possible colors. Keep in mind that the
  232.                background color is not stored with the sprite when it is saved
  233.                to disk, and in your programs you must set the background color
  234.                you desire prior to display of the sprite.
  235.  
  236.       (C)olrs  Pressing C changes the palette used for the screen display. You
  237.                may step through all four palettes (0..3). Again, keep in mind
  238.                that the palette is not stored with the sprite when it is saved
  239.                to disk; in your programs you must set the palette prior to the
  240.                display of the sprite.
  241.  
  242.       (D)imen  Pressing D allows you to dimension the sprite. You will be
  243.                prompted for the number of rows and columns which the sprite
  244.                occupies. This is done so that display procedure will know how
  245.                many lines and columns to write to the screen. This procedure
  246.                does not waste time writing the unused portion of the sprite.
  247.                A column is one byte wide (4 pixels) and you will see tick
  248.                marks at the top of the grid. The columns are numbered 0 - 5.
  249.                The row dimension is HALF of the number of rows seen on the
  250.                workgrid (odd and even lines are stored separately in the
  251.                sprite array). The rows may be seen as tick marks along the left
  252.                hand edge of the work grid. The rows are numbered 0 - 9. If
  253.                you do not follow this, you may obtain the correct dimensions
  254.                by placing the cursor at the lower right hand corner of the
  255.                sprite. The correct dimensions will appear as the first set of
  256.                numbers at the lower left hand corner of the screen ( row and
  257.                col ). The second set of numbers tell you the current dimen-
  258.                sions of the sprite.
  259.  
  260.       (I)nc    Pressing I allows you to convert the sprite which is current-
  261.                ly loaded into the work grid to an include file. The include
  262.                file redefines the sprite as a typed constant. This typed
  263.                constant may be $I included in your code at compile time or
  264.                may be copied directly into your code file. See Demo8.
  265.  
  266.  
  267.                                         5
  268.  
  269.  
  270.       (F)iles  Pressing F will give you a directory of files on the logged
  271.                disk drive. You may also delete or rename files once the dir-
  272.                ectory is displayed. For the convenience of Pascal programmers
  273.                files with extensions .PAS, .BAK, .COM, .EXE, and .SYS are not
  274.                displayed.
  275.  
  276.       (X) Exit  Exit to DOS.
  277.  
  278.  
  279.      (* ******************************************************************* *)
  280.  
  281.  
  282.       II. TABLE EDITOR
  283.  
  284.          The Table editor allows creation of a table of up to 24 sprites. This
  285.       table may be saved to disk and a 3072 byte file.
  286.  
  287.  
  288.          The following options are found on the table editor screen:
  289.  
  290.      {-----------------------------------------------------------------------}
  291.  
  292.                  (L)oad / (S)ave          (E)nter / (C)hoose
  293.                       Table                     Sprite
  294.  
  295.  
  296.                     (R)eturn       (N)ew      (F)rameSeq
  297.  
  298.  
  299.                        Brief Summary of Table Commands
  300.                            ( press indicated key )
  301.  
  302.      {------------------------------------------------------------------------}
  303.  
  304.           A more detailed description of each one follows.
  305.  
  306.  
  307.  
  308.       (L)oad Table  Reads a sprite table from disk. You will be prompted for
  309.                     a name. It is my convention to name all sprite tables with
  310.                     with the extension .TAB. You may abort this command by
  311.                     pressing <ENTER>.
  312.  
  313.  
  314.       (S)ave Table  Writes the  currently active sprite table  to disk as a
  315.                     3072 byte file. It is my convention to name sprite tables
  316.                     with the extension .TAB. You may abort this command by
  317.                     pressing <ENTER>.
  318.  
  319.       (N)ew         Clears the currently loaded table. All work is lost if it
  320.                     hasn't been previously saved. The currently active sprite
  321.                     is not lost. It may be erased by choosing a blank table
  322.                     entry (see (C)hoose below).
  323.  
  324.  
  325.       When you enter the table editor the currently active sprite is displayed
  326.       at the top center of the screen. If you return to the sprite editor this
  327.       sprite will be re-loaded into the work grid.  You may load this sprite
  328.       into the sprite table by pressing E.
  329.  
  330.  
  331.  
  332.  
  333.                                         6
  334.  
  335.       (E)nter       When you press E the currently active sprite will be
  336.                     entered into the sprite table. (This will be either the
  337.                     one that was loaded on the work grid or a new one if you
  338.                     used (C)hoose).  You will be asked if it has been
  339.                     dimensioned and which table position you wish to enter
  340.                     it into. If you respond that it has not been dimensioned
  341.                     you will be given an opportunity to dimension it.
  342.                     You may abort this command by pressing <ENTER> after you
  343.                     respond to the dimensioning question.
  344.  
  345.       (C)hoose      When you press C you may choose a new active sprite from
  346.                     the sprite table.  You will be asked  which number  to
  347.                     choose.  When you select a new sprite it will be displayed
  348.                     immediately at the top center of the screen. When you
  349.                     return to the sprite editor, the newly chosen sprite will
  350.                     be loaded into the work grid.
  351.  
  352.       (R)eturn      pressing R returns you to the sprite editor. If you have
  353.                     chosen a new sprite from the sprite table this will take
  354.                     a few moments to be completed EVEN IF A BLANK TABLE ENTRY
  355.                     WAS CHOSEN, wait for the cursor. If you have not chosen a
  356.                     new sprite return will be immediate.
  357.  
  358.       (F)rameSeq    This command allows you to check an animation sequence.
  359.                     You may display any range of sprites from the sprite table
  360.                     in sequence. The sequence must be a continuous one, but may
  361.                     involve any start and stop point in the table. You may
  362.                     display this sequence at a fixed location by setting step
  363.                     to zero, or simulate linear motion by setting step to 4,8
  364.                     or 12 pixels. You may also set a delay between each stage
  365.                     of the animation. Try a delay of about 75. If you display
  366.                     too rapidly the image will appear to be ghostly and to
  367.                     flicker. The eye needs a little time to grasp the image.
  368.                     You will be prompted for Start, Stop, Step and Delay.
  369.  
  370.       Erasing a Single Sprite
  371.  
  372.           You may erase a single sprite entry in the table by choosing a
  373.       blank entry in the table with (C)hoose and then entering it with
  374.       (E)nter into the position you wish to erase. Alternatively, you may
  375.       return to the sprite editor and clear the work grid with (N)ew. The
  376.       active sprite will then be a blank one. Return to the table and
  377.       enter the blank whereever desired.
  378.  
  379.       Designing Animation
  380.  
  381.           You may notice that the actual-size sprite image in the upper left
  382.       had corner of the sprite editor screen blinks as you move the cursor.
  383.       This is intentional. If you go to the sprite table and load an image,
  384.       when you return to the sprite editor the chosen sprite will be display-
  385.       ed. Now make changes in the sprite on the work grid. As you do so the
  386.       actual-size sprite will toggle between the originally loaded image and
  387.       the one now under design. This really helps when designing successive
  388.       frames for an animation sequence. Note that each sprite must be loaded
  389.       into the sprite table and then chosen with (C)hoose in order for this
  390.       feature to work. You cannot go to the sprite table, enter the sprite,
  391.       and return to the editor to design a new frame. You must (C)hoose the
  392.       sprite you have just entered before returning to the sprite editor.
  393.           Of course once you have a sequence of sprites loaded into the sprite
  394.       table you may use (F)rameSeq to see the actual animation.
  395.  
  396.