Copyright 1995 by:
Marek A. Chmielowski
All rights reserved - see disclaimer at the end of this document.
Real Time Scaleable Sprites for Borland's Delphi consists of two components:
Animation background and transparent sprites (up to 100) are created as instances of corresponding components by double clicking on Delphi component palette and by selecting proper image (e.g. bitmap) with Object Inspector property editor (Picture Editor). All initialisation is handled by components themselves. Instance of MChSprite can be moved on instance of MChSpriteBgr with single method call e.g. MChSprite1.SprGo(From, Dest, AtTime). Sprite position is determined by real time clock and is independent on computer and graphic cart performance (slow cart results in jetted movements). Sprites are implemented as autonomous objects and support transparent colour, collision, Z-order (overlapping), Z-order dynamic change, sprite scaling, dynamic scale change, image flipping, linear movement and movement along curve. Sprites can respond to mouse pointer and can be drag with mouse to new position. Sprite movement can be synchronised with sound effects.
Source code for components and demo program is provided in PKzip compressed package .
These components and source code is FREE for non-profit applications - see copyright information and disclaimer at the end of this document.
Source code for Sprites components and demo programs (also executable for IBM-PC and Windows 3.1) is in PKzip compressed package sprites.zip . To get sprites.zip package from: http://sunsite.icm.edu.pl/archive/delphi/ftp/freeware/sprites.zip double click on any "sprites.zip " name and then on highlighted http external link.
PkZip package sprites.zip
To unpack type on IBM-PC compatible computer type:
You can run SprDemo2.exe and SprDemo3.exe demos on IBM-PC compatible computer from Windows 3.1 without installing components (you can run them without Delphi at all). Do NOT load their source code into Delphi before installing Sprites components. Demo using Sound Blaster compatible cart: SprDm2SB.dpr is provided in source code version only, because I do not have rights to distribute samples of sound files provided with my Sound Blaster card. Please edit filename property of multimedia components in SprDmSB2.dfm form to select your sound files - see Delphi help about TMultimediaComponent and it's properties. For Sound Blaster 16 I have used s_8_22.wav and jazz.mid for MediaPlayer 1 and 2 respectively.
Both executables are running fine on my desktop PC and on my laptop, however they are crashing at my PC at work. I suspect that Windows driver is incompatible with Delphi expectation, but I do not intent to bother. If demos (executables) are not working and this will not discourage you from using this software (it should) just tray install components and recompile demo source code.
Read first Delphi User's Manual - page 68.
Run SprDemo2.exe first - you can do this before installing components into Delphi.
If you like what you have seen - instal components .
Test SprDemo1 source code first:
Open Project SprDemo1.dpr , than open Form1 and from Object Inspector:
Run SprDemo1 with yours background and yours sprites
From now you are on your own - tray SprDemo2.dpr and then SprDemo3.dpr . Read help file and look at the code UntDemo0.pas , UntDemo1.pas , UntDemo2.pas , and UntDemo3.pas . If you have Sound Cart look also at UntDm2SB.pas .
Send me e-mail if you like or hate this package .
See Delphi Component Writer's Guide page 80.
If you have trouble in understanding Borland's documentation (I had) you can use SpritesH.hlp directly from Windows:
Associate extension .hlp with WinHelp and just double click on spritesh.hlp (You can read Sprites help but there is no link from Delphi). You can also create New program Item WinHelp spritesh.hlp from program Manager.
To have help available from Delphi IDE on pressing F1 (it should display help when cursor is on Component Palette, if Sprite or Sprite Background component are selected on Form, or if TMChSprite or TMChSpriteBgr words are selected in source editor) is more complex:
Real Time Scaleable Sprites have been implemented using autonomous object approach as opposite to frame based technique . Movement, visibility, and scale of each sprite is determined only by sprite itself (i.e. by it's properties). This way only single image for sprite is required and there is no need for huge filmstrip bitmaps required by frame animation. Background component is resolving conflicting request from sprites (e.g. request from two sprites to be display in the same place) and synchronise screen update in flicker free fashion.
Sprites components have been developed on the base of excellent book about animation in Windows by Nigel Thompson. The only drawback I have found in this book are programming examples based on non-structured, non-modular, and with messy syntax C++ computer slang.
Animation techniques in Win32, by Nigel Thompson, Microsoft Programming Series, Microsoft Press.
If you are allergic to C++ (I am) you can find Delphi Object Pascal examples illustrating basic techniques of using transparent bitmaps on newsgroup comp.lang.pascal:
Very simple and concise:
Transparent Bitblt - by Bryan Zarnett
Somewhat more complex and showing very strong C heritage:
Transparent Bitmap - by Michael Vincze
For easy to understand Delphi example of simple object based animation see very nice example:
Flickerless Sprite Animation - by David R. McDermitt in freeware section
Example of Delphi frame based animation component can be found in shareware section
Animation component by Dare Baldwin (free for freeware writers)
These components and source code is FREE for non-profit applications. This package may be copied and distributed freely providing that it is not modified, no fee is charged, and it is not used by package for which a charge is made.
Use this package entirely on your own risk as no warranty is provided. Even if this software will cause the whole universe to blow I will be responsible only to God.
(Will you DARE to press Super Nova button in SprDemo3 now.)
Please do NOT distribute components or source code if you altered them -
EVEN IF THIS IS ONLY BUG CORRECTION.
Let me know about the problem and the solution and I will implement it in the next
version (may be it will be the next version). Also suggestions are appreciated.
If you would like to use this components for shareware or commercial application
please contact me first by mail :
My (Marek Chmielowski) e-mail:on Compuserve: 76360,2775 on Internet: 76360,firstname.lastname@example.org
Mail:Marek Chmielowski 5/56 Kozia St. Warsaw 00-070 Poland (48) (22) 226-01-85
orMarek Chmielowski 10005 Broad St. Bethesda, MD 20814 USA (301) 897-5266