home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-04-30 | 61.6 KB | 2,167 lines |
- <html>
-
- <head>
- <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
- <title>ASprite ActiveX Control DocumentationHome Page /</title>
- </head>
-
- <body bgcolor="#FFFFFF">
- <div align="center"><center>
-
- <table border="2" bordercolor="#008080">
- <tr>
- <td><p align="center"><br>
- <font color="#004040" size="5" face="Comic Sans MS"><strong><u>ASprite
- ActiveX Control v2.0 Documentation</u></strong></font><br>
- <font size="2"><br>
- <strong>For complete and most recent documentation and
- samples, visit</strong></font><font size="1"><br>
- </font><a href="http://www.dreamscape.com/beaulieu/"><font
- size="2"><strong>http://www.dreamscape.com/beaulieu/</strong></font></a></p>
- </td>
- </tr>
- </table>
- </center></div>
-
- <p><font size="5"><strong><u>Overview</u></strong></font><br>
- The ASprite ActiveX Control enables programmers to <em><strong>easily</strong></em>
- create video games for Windows 95 and NT using DirectX. The
- control can be used within most 4GL tools such as Visual Basic,
- and examples are included. Some of the features of the ASprite
- Control are:</p>
-
- <ul>
- <li>Sprite Animation via DirectDraw</li>
- <li>Joystick Support</li>
- <li>Keyboard Support</li>
- <li>Buffered Sound via DirectSound</li>
- </ul>
-
- <p><font size="5"><strong><u>Legal Information<br>
- </u></strong></font>The ASprite ActiveX Control is Freeware. This
- means you can freely use and distribute the control (ASPRITE.OCX)
- in its original unmodified form. <br>
- The author makes no warranties, either express or implied, as to
- the reliability of this software and accompanying information and
- examples or its fitness to be used for your particular
- purpose. The entire risk of the use of, or the results from
- the use of this software remains with you.</p>
-
- <p align="left"><font size="5"><strong><u>What's New in Version
- 2.0<br>
- </u></strong></font>Here are some the highlights for the new
- version:</p>
-
- <ul>
- <li>Any code written for version 1.0 of the control is still <strong>compatible</strong>;
- simply recompile against the new control.</li>
- <li><strong>Multiple bitmap</strong> (BMP) files supported!</li>
- <li>Complete sample projects in VB5 show you how to do fast <strong>full
- page scrolling</strong> and multiple BMP support.</li>
- <li>It's still <strong>FREEWARE</strong>!</li>
- <li>Here's a summary of the <strong>new properties and
- methods</strong> for v2.0:</li>
- </ul>
-
- <table border="0">
- <tr>
- <td width="50"> </td>
- <td> </td>
- <td><strong>SoundPlayLoop</strong></td>
- <td>Plays a WAV file in a looping manner.</td>
- </tr>
- <tr>
- <td width="50"> </td>
- <td> </td>
- <td><strong>SoundStopLoop</strong></td>
- <td>Stops playing a WAV loop started with SoundPlayLoop.</td>
- </tr>
- <tr>
- <td width="50"> </td>
- <td> </td>
- <td><strong>SoundGetVolume</strong></td>
- <td>Gets the current playback volume for SoundPlay
- calls..</td>
- </tr>
- <tr>
- <td width="50"> </td>
- <td> </td>
- <td><strong>SoundSetVolume</strong> </td>
- <td>Sets the playback volume for all SoundPlay calls..</td>
- </tr>
- <tr>
- <td width="50"> </td>
- <td> </td>
- <td><strong>SpriteFileNum property</strong></td>
- <td>Used for applications requiring multiple bitmap (BMP)
- files.</td>
- </tr>
- <tr>
- <td width="50"> </td>
- <td> </td>
- <td><strong>SpriteTestCollisionExt</strong></td>
- <td>Tests for a collision between sprites in different
- BMP files. </td>
- </tr>
- <tr>
- <td width="50"> </td>
- <td> </td>
- <td><strong>InputJoystickButtons</strong></td>
- <td>Gives detailed information about joystick buttons.</td>
- </tr>
- </table>
-
- <p><font size="5"><strong><u>List of Properties and Methods</u></strong></font><br>
- Below is a list of properties and methods for the ASprite ActiveX
- Control:</p>
-
- <table border="0">
- <tr>
- <td><a href="#hWnd Property"><strong>hWnd Property</strong></a></td>
- <td>Notifies ASprite Control of what window to use for
- DirectX.</td>
- </tr>
- <tr>
- <td><a href="#AboutBox Method"><strong>AboutBox</strong></a></td>
- <td>Displays control information in a dialog box.</td>
- </tr>
- <tr>
- <td><a href="#DrawInit Method"><strong>DrawInit</strong></a></td>
- <td>Initializes DirectDraw for use.</td>
- </tr>
- <tr>
- <td><a href="#DrawDisable Method"><strong>DrawDisable</strong></a></td>
- <td>Releases DirectDraw resources.</td>
- </tr>
- <tr>
- <td><a href="#DrawFloodFill Method"><strong>DrawFloodFill</strong></a></td>
- <td>Fills the back buffer with a specified palette entry.</td>
- </tr>
- <tr>
- <td><a href="#DrawFlipBackBuffer Method"><strong>DrawFlipBackBuffer</strong></a></td>
- <td>Flips the back buffer to the visible front buffer.</td>
- </tr>
- <tr>
- <td><a href="#InputIsKeyPressed Method"><strong>InputIsKeyPressed</strong></a></td>
- <td>Determines whether a specific key is down.</td>
- </tr>
- <tr>
- <td><a href="#InputJoystickButtonDown Method"><strong>InputJoystickButtonDown</strong></a></td>
- <td>Determines whether joystick button #1 is down.</td>
- </tr>
- <tr>
- <td><a href="#InputJoystickButtons Method"><strong>InputJoystickButtons</strong></a></td>
- <td>Gives detailed information about joystick buttons.</td>
- </tr>
- <tr>
- <td><a href="#InputJoystickDirection Method"><strong>InputJoystickDirection</strong></a></td>
- <td>Gets the current direction of the joystick.</td>
- </tr>
- <tr>
- <td><a href="#InputKeyArrowDirection Method"><strong>InputKeyArrowDirection</strong></a></td>
- <td>Gets the current direction of the keyboard arrow
- keys.</td>
- </tr>
- <tr>
- <td><a href="#SpriteFileNum Property"><strong>SpriteFileNum
- property</strong></a></td>
- <td>Used for applications requiring multiple bitmap (BMP)
- files.</td>
- </tr>
- <tr>
- <td><a href="#SpriteLoad Method"><strong>SpriteLoad</strong></a></td>
- <td>Loads a BMP file into memory for use as a sprite.</td>
- </tr>
- <tr>
- <td><a href="#SpriteDefine Method"><strong>SpriteDefine</strong></a></td>
- <td>Defines a sprite within a BMP file.</td>
- </tr>
- <tr>
- <td><a href="#SpriteDisplay Method"><strong>SpriteDisplay</strong></a></td>
- <td>Displays a sprite to the back buffer.</td>
- </tr>
- <tr>
- <td><a href="#SpriteMove Method"><strong>SpriteMove</strong></a></td>
- <td>Moves a sprite.</td>
- </tr>
- <tr>
- <td><a href="#SpriteDefineCollisionRect Method"><strong>SpriteDefineCollisionRect</strong></a></td>
- <td>Defines a sprite's collision rectangle for use in
- collision detection.</td>
- </tr>
- <tr>
- <td><a href="#SpriteGetDirection Method"><strong>SpriteGetDirection</strong></a></td>
- <td>Gets the last direction SpriteMove was called with.</td>
- </tr>
- <tr>
- <td><a href="#SpriteGetFrame Method"><strong>SpriteGetFrame</strong></a></td>
- <td>Gets a sprite's animation frame.</td>
- </tr>
- <tr>
- <td><a
- href="#SpriteGetXPosition, SpriteGetYPosition Methods"><strong>SpriteGetXPosition</strong></a></td>
- <td>Gets a sprite's current X coordinate position.</td>
- </tr>
- <tr>
- <td><a
- href="#SpriteGetXPosition, SpriteGetYPosition Methods"><strong>SpriteGetYPosition</strong></a></td>
- <td>Gets a sprite's current Y coordinate position.</td>
- </tr>
- <tr>
- <td><a href="#SpriteSetFrame Method"><strong>SpriteSetFrame</strong></a></td>
- <td>Sets a sprite's animation frame.</td>
- </tr>
- <tr>
- <td><a href="#SpriteGetActive Method"><strong>SpriteGetActive</strong></a></td>
- <td>Gets a sprite's current active state.</td>
- </tr>
- <tr>
- <td><a href="#SpriteSetActive Method"><strong>SpriteSetActive</strong></a></td>
- <td>Sets a sprite as active or inactive.</td>
- </tr>
- <tr>
- <td><a
- href="#SpriteSetNextFrame, SpriteSetPrevFrame Methods"><strong>SpriteSetNextFrame</strong></a></td>
- <td>Increments a sprite's animation frame.</td>
- </tr>
- <tr>
- <td><a
- href="#SpriteSetNextFrame, SpriteSetPrevFrame Methods"><strong>SpriteSetPrevFrame</strong></a></td>
- <td>Decrements a sprite's animation frame.</td>
- </tr>
- <tr>
- <td><a href="#SpriteSetPosition Method"><strong>SpriteSetPosition</strong></a></td>
- <td>Sets a sprite's X,Y coordinate position.</td>
- </tr>
- <tr>
- <td><a href="#SpriteTestCollision Method"><strong>SpriteTestCollision</strong></a></td>
- <td>Tests whether two sprites collide.</td>
- </tr>
- <tr>
- <td><a href="#SpriteTestCollisionExt Method"><strong>SpriteTestCollisionExt</strong></a></td>
- <td>Tests for a collision between sprites in different
- BMP files. </td>
- </tr>
- <tr>
- <td><a href="#TextSetAttributes Method"><strong>TextSetAttributes</strong></a></td>
- <td>Sets font, size, and color attributes for displayed
- text.</td>
- </tr>
- <tr>
- <td><a href="#TextDisplay Method"><strong>TextDisplay</strong></a></td>
- <td>Displays text to the back buffer.</td>
- </tr>
- <tr>
- <td><a href="#SoundInit Method"><strong>SoundInit</strong></a></td>
- <td>Initializes DirectSound for use.</td>
- </tr>
- <tr>
- <td><a href="#SoundDisable Method"><strong>SoundDisable</strong></a></td>
- <td>Releases DirectSound resources.</td>
- </tr>
- <tr>
- <td><a href="#SoundLoad Method"><strong>SoundLoad</strong></a></td>
- <td>Loads a WAV file into memory for use as a sound.</td>
- </tr>
- <tr>
- <td><a href="#SoundPlay Method"><strong>SoundPlay</strong></a></td>
- <td>Plays a WAV file previously loaded with SoundLoad.</td>
- </tr>
- <tr>
- <td><a href="#SoundPlayFile Method"><strong>SoundPlayFile</strong></a></td>
- <td>Plays a WAV file <em>without</em> utilizing
- DirectSound (unbuffered).</td>
- </tr>
- <tr>
- <td><a href="#SoundPlayLoop Method"><strong>SoundPlayLoop</strong></a></td>
- <td>Plays a WAV file in a looping manner.</td>
- </tr>
- <tr>
- <td><a href="#SoundStopLoop Method"><strong>SoundStopLoop</strong></a></td>
- <td>Stops playing a WAV loop started with SoundPlayLoop.</td>
- </tr>
- <tr>
- <td><a href="#SoundGetVolume Method"><strong>SoundGetVolume</strong></a></td>
- <td>Gets the current playback volume for SoundPlay
- calls..</td>
- </tr>
- <tr>
- <td><a href="#SoundSetVolume Method"><strong>SoundSetVolume</strong></a>
- </td>
- <td>Sets the playback volume for all SoundPlay calls..</td>
- </tr>
- <tr>
- <td><a href="#TimerGetTickCount Method"><strong>TimerGetTickCount</strong></a></td>
- <td>Returns the number of milliseconds since Windows was
- started.</td>
- </tr>
- </table>
-
- <hr>
-
- <p><a name="hWnd Property"><font color="#0000FF" size="4"><strong>hWnd
- Property</strong></font></a></p>
-
- <p>Notifies DirectX of what window to use for functionality<br>
- <br>
- <strong>Syntax</strong><br>
- ASprite.<strong>hWnd = Form1.hWnd</strong><br>
- <br>
- <br>
- <strong>Remarks</strong><br>
- You <strong>must always</strong> set the hWnd property for the
- ASprite Control before doing any DirectX functionality.</p>
-
- <hr>
-
- <p><a name="AboutBox Method"><font color="#0000FF" size="4"><strong>AboutBox
- Method</strong></font></a></p>
-
- <p>Displays the About box for the control.<br>
- <br>
- <strong>Syntax</strong><br>
- ASprite.<strong>AboutBox</strong><br>
- <br>
- <br>
- <strong>Remarks</strong><br>
- This is the same as clicking About in the Properties window.</p>
-
- <hr>
-
- <p><a name="DrawInit Method"><font color="#0000FF" size="4"><strong>DrawInit
- Method</strong></font></a></p>
-
- <p>Initializes DirectDraw and sets resolution mode.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>DrawInit(long lXRes, long lYRes, long
- lColorDepth, long lRamNeeded </strong>)<br>
- <br>
- <strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><em>lXRes</em></td>
- <td>The X resolution, in pixels, of the desired graphics
- mode.</td>
- </tr>
- <tr>
- <td><em>lYRes</em></td>
- <td>The Y resolution, in pixels, of the desired graphics
- mode.</td>
- </tr>
- <tr>
- <td><em>lColorDepth<br>
- <br>
- </em></td>
- <td>The color depth, in bits, of the desired graphics
- mode. For example, to get 256 colors, you would use 8 for
- lColorDepth, since 2<font size="1"><sup><sup><sup>8</sup></sup></sup></font>
- is 256.</td>
- </tr>
- <tr>
- <td><em>lRamNeeded</em></td>
- <td>The amount of memory you expect you application to
- require. DrawInit will return a failure code if this
- amount of RAM is not available.</td>
- </tr>
- </table>
-
- <p><strong>Return Values<br>
- </strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- <tr>
- <td width="10%">1 </td>
- <td>DDRAW.DLL not found; DirectDraw not installed.</td>
- </tr>
- <tr>
- <td width="10%">2</td>
- <td>Could not create DirectDraw Object.</td>
- </tr>
- <tr>
- <td width="10%">3</td>
- <td>Could not get exclusive access.</td>
- </tr>
- <tr>
- <td width="10%">4</td>
- <td>Could not set display mode.</td>
- </tr>
- <tr>
- <td width="10%">5</td>
- <td>Not enough RAM available.</td>
- </tr>
- <tr>
- <td width="10%">6</td>
- <td>hWnd property not set.</td>
- </tr>
- </table>
-
- <p><strong><br>
- Remarks</strong><br>
- Use DrawInit before doing any other Draw methods. This function
- is responsible for setting up DirectDraw and its buffers. Be sure
- to set the ASprite.hWnd property before calling this function.</p>
-
- <p><strong>Example<br>
- </strong><font size="2" face="Courier New">ASprite1.hWnd =
- Form1.hWnd<br>
- ASprite1.SoundInit<br>
- ASprite1.SoundLoad 0, "gun.wav"<br>
- ASprite1.<strong>DrawInit</strong> 640, 480, 8, 0 </font><font
- color="#008000" size="2" face="Courier New">'Initialize to 640 x
- 480, 256 colors</font><font size="2" face="Courier New"><br>
- ASprite1.SpriteLoad "example.bmp", 2, 11<br>
- ASprite1.SpriteDefine 0, 290, 215, 0, 0, 60, 50, 72, 9, 1, 1</font><br>
- ...</p>
-
- <hr>
-
- <p><a name="DrawDisable Method"><font color="#0000FF" size="4"><strong>DrawDisable
- Method</strong></font></a></p>
-
- <p>Disables DirectDraw and frees associated resources.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>DrawDisable</strong><br>
- <br>
- </p>
-
- <p><strong>Return Values<br>
- </strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- </table>
-
- <p><strong><br>
- Remarks</strong><br>
- Use <strong>DrawDisable</strong> to clean up all DirectDraw
- resources when your application is done with them.</p>
-
- <hr>
-
- <p><a name="DrawFloodFill Method"><font color="#0000FF" size="4"><strong>DrawFloodFill
- Method</strong></font></a></p>
-
- <p>Fills the back buffer with a specific palette entry.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>DrawFloodFill(double dwColor)</strong><br>
- <br>
- <strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- </table>
-
- <p><strong><br>
- Remarks</strong><br>
- Use <strong>DrawFloodFill</strong> to clear out the back buffer
- by filling it with a specific color.</p>
-
- <hr>
-
- <p><a name="DrawFlipBackBuffer Method"><font color="#0000FF"
- size="4"><strong>DrawFlipBackBuffer Method</strong></font></a></p>
-
- <p>Flips the back buffer to the visible screen.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>DrawFlipBackBuffer()</strong><br>
- <br>
- <strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- </table>
-
- <p><strong><br>
- Remarks</strong><br>
- Use <strong>DrawFlipBackBuffer</strong> to display the contents
- of the back buffer to the screen after you have rendered an
- entire scene.</p>
-
- <hr>
-
- <p><a name="InputIsKeyPressed Method"><font color="#0000FF"
- size="4"><strong>InputIsKeyPressed Method</strong></font></a></p>
-
- <p>Determines whether a specific key is currently being pressed.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>InputIsKeyPressed(long lKeyCode)</strong><br>
- <br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lKeyCode<br>
- </strong></td>
- <td>The system key code for the key to test for. For
- Visual Basic, use the vbKeyCode constants.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- </table>
-
- <p><strong><br>
- Remarks</strong><br>
- Use <strong>InputIsKeyPressed</strong> to determine whether the
- user is pressing a specific key.<br>
- <br>
- <strong>Example<br>
- </strong><font size="2" face="Courier New">If
- ASprite1.InputIsKeyPressed(vbKeyEscape) Then<br>
- </font><font color="#008000" size="2" face="Courier New">'User
- wants to quit!</font><font size="2" face="Courier New"><br>
- bContinue = False<br>
- End If<br>
- </font></p>
-
- <hr>
-
- <p><a name="InputJoystickButtonDown Method"><font color="#0000FF"
- size="4"><strong>InputJoystickButtonDown Method</strong></font></a></p>
-
- <p>Determines whether the joystick button is currently being
- pressed. You must call <a href="#InputJoystickDirection Method">InputJoystickDirection</a>
- prior to this function to get accurate results.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- bRetVal = ASprite.<strong>InputJoystickButtonDown()</strong><br>
- <br>
- </p>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">TRUE </td>
- <td>The joystick button is down.</td>
- </tr>
- <tr>
- <td>FALSE </td>
- <td>The joystick button is up.</td>
- </tr>
- </table>
-
- <hr>
-
- <p><a name="InputJoystickButtons Method"><font color="#0000FF"
- size="4"><strong>InputJoystickButtons Method</strong></font></a></p>
-
- <p>Determines which the joystick buttons are currently being
- pressed. You must call <a href="#InputJoystickDirection Method">InputJoystickDirection</a>
- prior to this function to get accurate results.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- bRetVal = ASprite.<strong>InputJoystickButtons()</strong><br>
- </p>
-
- <p><strong>Return Values<br>
- </strong>Returns the added binary value of all buttons currently
- being pressed. You may use a bitwise AND in VB to see if a button
- is down. For example, if button two is pressed, then the
- expression (ASprite1.InputJoystickButtons() And 1) is true.<br>
- </p>
-
- <p><strong>Remarks<br>
- </strong>InputJoystickButtons gives extended information on what
- joystick buttons are currently being pressed by the user. If you
- simply want to see if button 1 is being pressed, you can use the
- InputJoystickButtonDown() function instead.<br>
- </p>
-
- <p><strong>Example<br>
- </strong>iJoyButton = ASprite1.InputJoystickButtons()<br>
- If iJoyButton And 1 Then<br>
- <font color="#0000FF" size="3" face="Times New Roman"><code><img
- src="pics/tab.gif" width="20" height="1"></code></font>ASprite1.TextDisplay
- "Button 1 is down!", 1, 1<br>
- End If<br>
- If iJoyButton And 2 Then<br>
- <font color="#0000FF" size="3" face="Times New Roman"><code><img
- src="pics/tab.gif" width="20" height="1"></code></font>ASprite1.TextDisplay
- "Button 2 is down!", 1, 100<br>
- End If</p>
-
- <hr>
-
- <p><a name="InputJoystickDirection Method"><font color="#0000FF"
- size="4"><strong>InputJoystickDirection Method</strong></font></a></p>
-
- <p>Returns the current direction of the joystick.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- lDirection = ASprite.<strong>InputJoystickDirection</strong><br>
- <br>
- <strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Center position (no user movement)</td>
- </tr>
- <tr>
- <td>1 </td>
- <td>The joystick is pointed right.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>The joystick is pointed down and right.</td>
- </tr>
- <tr>
- <td>3</td>
- <td>The joystick is pointed down.</td>
- </tr>
- <tr>
- <td>4</td>
- <td>The joystick is pointed down and left.</td>
- </tr>
- <tr>
- <td>5</td>
- <td>The joystick is pointed left.</td>
- </tr>
- <tr>
- <td>6</td>
- <td>The joystick is pointed up and left.</td>
- </tr>
- <tr>
- <td>7</td>
- <td>The joystick is pointed up.</td>
- </tr>
- <tr>
- <td>8</td>
- <td>The joystick is pointed up and right.</td>
- </tr>
- </table>
-
- <hr>
-
- <p><a name="InputKeyArrowDirection Method"><font color="#0000FF"
- size="4"><strong>InputKeyArrowDirection Method</strong></font></a></p>
-
- <p>Returns the current direction of the arrow keys on the
- keyboard. </p>
-
- <p><br>
- <strong>Syntax</strong><br>
- lDirection = ASprite.<strong>InputKeyArrowDirection</strong><br>
- <br>
- <strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Center position (no user movement)</td>
- </tr>
- <tr>
- <td>1 </td>
- <td>The arrows are pointed right.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>The arrows are pointed down and right.</td>
- </tr>
- <tr>
- <td>3</td>
- <td>The arrows are pointed down.</td>
- </tr>
- <tr>
- <td>4</td>
- <td>The arrows are pointed down and left.</td>
- </tr>
- <tr>
- <td>5</td>
- <td>The arrows are pointed left.</td>
- </tr>
- <tr>
- <td>6</td>
- <td>The arrows are pointed up and left.</td>
- </tr>
- <tr>
- <td>7</td>
- <td>The arrows are pointed up.</td>
- </tr>
- <tr>
- <td>8</td>
- <td>The arrows are pointed up and right.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use <strong>InputKeyArrowDirection </strong>to easily
- determine what direction the user is inputting with the keyboard
- arrow keys. These keys are used in many game applications to get
- user input.</p>
-
- <hr>
-
- <p><a name="SpriteFileNum Property"><font color="#0000FF"
- size="4"><strong>SpriteFileNum Property</strong></font></a></p>
-
- <p>Used to access sprites across multiple bitmap (BMP) files. </p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteFileNum</strong> = lBMPFileNumber</p>
-
- <p><strong>Remarks<br>
- </strong>The SpriteFileNum property is used in applications that
- require two or more bitmap (BMP) files for storing sprites. Since
- each BMP file contains sprites with the same reference (e.g. both
- files contain a sprite number 0, sprite number 1, etc...), it is
- necessary to use this property for accessing each bitmap's
- sprites.<br>
- <br>
- Lets suppose you have two bitmap files, "A.BMP" and
- "B.BMP". The first file, A.BMP, contains animation
- frames for 3 sprites, and the second file, B.BMP, contains
- animation frames for 4 sprites. In this example, you can think of
- having two "sprite arrays." <br>
- <br>
- A.BMP is BMP file number 0. It is composed of sprites 0,1, and 2.<br>
- B.BMP is BMP file number 1. It is composed of sprites 0,1,2, and
- 3.<br>
- <br>
- You would set the ASprite.SpriteFileNum property to 0 whenever
- you need to set or get properties for its three sprites. You
- would set the ASprite.SpriteFileNum property to 1 whenever you
- want to set or get properties for its four sprites.<br>
- <br>
- <strong>Example</strong><br>
- <font size="2" face="Courier New">ASprite1.hWnd = Form1.hWnd<br>
- ASprite1.DrawInit 640, 480, 8, 0<br>
- <br>
- </font><font color="#008000" size="2" face="Courier New">'Load
- A.BMP, and define its three sprites.<br>
- </font><font size="2" face="Courier New">ASprite1.SpriteFileNum =
- 1<br>
- ASprite1.SpriteLoad "a.bmp", 16, 11<br>
- ASprite1.SpriteDefine 0, 290, 215, 0, 0, 80, 65, 16, 8, 1, 1<br>
- ASprite1.SpriteDefine 1, 290, 215, 0, 65, 80, 65, 16, 8, 1, 1<br>
- ASprite1.SpriteDefine 2, 290, 215, 0, 130, 80, 65, 16, 8, 1, 1<br>
- <br>
- </font><font color="#008000" size="2" face="Courier New">'Load
- B.BMP, and define its four sprites.<br>
- </font><font size="2" face="Courier New">ASprite1.SpriteFileNum =
- 2<br>
- ASprite1.SpriteLoad "b.bmp", 16, 11<br>
- ASprite1.SpriteDefine 0, 290, 215, 0, 0, 80, 65, 16, 8, 1, 1<br>
- ASprite1.SpriteDefine 1, 290, 215, 0, 65, 80, 65, 16, 8, 1, 1<br>
- ASprite1.SpriteDefine 2, 290, 215, 0, 130, 80, 65, 16, 8, 1, 1<br>
- ASprite1.SpriteDefine 3, 290, 215, 0, 195, 80, 65, 16, 8, 1, 1<br>
- </font></p>
-
- <hr>
-
- <p><a name="SpriteTestCollisionExt Method"><font color="#0000FF"
- size="4"><strong>SpriteTestCollisionExt Method</strong></font></a></p>
-
- <p>Tests for a collision between two sprites which exist in
- DIFFERENT<br>
- bitmap (BMP) files. </p>
-
- <p><br>
- <strong>Syntax</strong><br>
- bRetVal = ASprite.<strong>SpriteTestCollisionExt</strong>(long
- lSprite1, long lFileNum1,long lSprite2, long lFileNum2)<br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSprite1<br>
- </strong></td>
- <td>The number of the sprite for the first sprite
- involved in the collision test. <br>
- </td>
- </tr>
- <tr>
- <td><strong>lFileNum1 <br>
- </strong></td>
- <td>The number of the file for the first sprite involved
- in the collision test. </td>
- </tr>
- <tr>
- <td><strong>lSprite2<br>
- </strong></td>
- <td>The number of the sprite for the second sprite
- involved in the collision test. </td>
- </tr>
- <tr>
- <td><strong>lFileNum2</strong></td>
- <td>The number of the file for the second sprite involved
- in the collision test. </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">TRUE </td>
- <td>lSprite1 Collides with lSprite2.</td>
- </tr>
- <tr>
- <td>FALSE </td>
- <td>lSprite1 does not collide with lSprite2.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>The SpriteTestCollisionExt method is used in
- applications that utilize two or more bitmap (BMP) files for
- storing sprites. Separate BMP files are loaded and used with the
- SpriteFileNum property. </p>
-
- <p>Since each BMP file contains sprites with the same reference
- (e.g. both files contain a sprite number 0, sprite number 1,
- etc...), it is necessary to use this method for collision testing
- INSTEAD OF the SpriteTestCollision method.</p>
-
- <hr>
-
- <p><a name="SpriteLoad Method"><font color="#0000FF" size="4"><strong>SpriteLoad
- Method</strong></font></a></p>
-
- <p>Loads a Windows Bitmap (BMP) file into memory for use as one
- or more sprites.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteLoad(string lpctstrFileName, short
- iNumSprites, long lTransparentColorEntry) </strong><br>
- <br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lpctstrFileName<br>
- </strong></td>
- <td>The BMP file which you want to load for use as a
- sprite.<br>
- </td>
- </tr>
- <tr>
- <td><strong>iNumSprites<br>
- </strong></td>
- <td>The number of sprites you will later define in the
- BMP file with SpriteDefine.</td>
- </tr>
- <tr>
- <td><strong>lTransparentColorEntry<br>
- </strong></td>
- <td>The color in the image that you wish to have
- transparent when the sprites are drawn to the back
- buffer.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- <tr>
- <td>1 </td>
- <td>Failure, normally due to lack of resources</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use <strong>SpriteLoad </strong>to get a BMP file in
- memory before using SpriteDefine to set up your sprites. When
- creating your bitmaps, use a color such as black or bright blue
- in the background, and give this palette entry for <strong>lTransparentColorEntry.</strong></p>
-
- <hr>
-
- <p><a name="SpriteDefine Method"><font color="#0000FF" size="4"><strong>SpriteDefine
- Method</strong></font></a></p>
-
- <p>Defines a sprite within a bitmap previously loaded with
- SpriteLoad.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteDefine(long lSpriteNum, long iXPos, long
- iYPos, <br>
- long iXPosBMP, long iYPosBMP, <br>
- long iFrameWidth, long iFrameHeight, <br>
- long iFrameCount, long iFramesPerRow, <br>
- long iCurrentFrame, short iDirection) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The sprite number you are defining. Start with 0 and
- increment by 1 for each sprite.<br>
- </td>
- </tr>
- <tr>
- <td><strong>iXPos<br>
- </strong></td>
- <td>The initial X screen coordinate position for the
- sprite.</td>
- </tr>
- <tr>
- <td><strong>iYPos<br>
- </strong></td>
- <td>The initial Y screen coordinate position for the
- sprite.</td>
- </tr>
- <tr>
- <td><strong>iXPosBMP</strong></td>
- <td>The X coordinate position of the beginning of the
- sprite data inside the BMP file you loaded with
- SpriteLoad. </td>
- </tr>
- <tr>
- <td><strong>iYPosBMP</strong></td>
- <td>The Y coordinate position of the beginning of the
- sprite data inside the BMP file you loaded with
- SpriteLoad. </td>
- </tr>
- <tr>
- <td><strong>iFrameWidth</strong></td>
- <td>The width of each animation frame for the sprite.</td>
- </tr>
- <tr>
- <td><strong>iFrameHeight</strong></td>
- <td>The height of each animation frame for the sprite.</td>
- </tr>
- <tr>
- <td><strong>iFrameCount</strong></td>
- <td>The number of animation frames for the sprite.</td>
- </tr>
- <tr>
- <td><strong>iFramesPerRow</strong></td>
- <td>The number of frames on each row inside the BMP file.</td>
- </tr>
- <tr>
- <td><strong>iCurrentFrame</strong></td>
- <td>The initial frame number to display for the sprite.</td>
- </tr>
- <tr>
- <td><strong>iDirection</strong></td>
- <td>For future use, not currently supported by control.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- <tr>
- <td>1 </td>
- <td>Failure</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use <strong>SpriteDefine </strong>to define the sprites
- that exist in the BMP file you loaded with the SpriteLoad method.
- When creating the BMP file, be sure each frame of the sprite
- occupies an equal sized rectangular region.</p>
-
- <p><strong>Example<br>
- </strong><font size="2" face="Courier New">ASprite1.hWnd =
- Form1.hWnd<br>
- ASprite1.DrawInit 640, 480, 8, 0<br>
- ASprite1.SpriteLoad "example.bmp", 2, 11<br>
- </font><font color="#008000" size="2" face="Courier New">'Define
- the first Sprite (0). Its initial position will be 290, 215.<br>
- 'It exists in example.bmp at coordinates 0,0.<br>
- 'Each frame is 60 x 50.<br>
- 'There are 72 frames of animation, with 9 frames on each row.<br>
- 'Frame 1 will be the initial frame to display, and its direction
- is 1.<br>
- </font><font size="2" face="Courier New">ASprite1.SpriteDefine 0,
- 290, 215, 0, 0, 60, 50, 72, 9, 1, 1<br>
- </font></p>
-
- <hr>
-
- <p><a name="SpriteDisplay Method"><font color="#0000FF" size="4"><strong>SpriteDisplay
- Method</strong></font></a></p>
-
- <p>Displays a sprite onto the back buffer.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteDisplay(long lSpriteNum) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum <br>
- </strong></td>
- <td>The sprite number you want to display to the back
- buffer.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td>no return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use <strong>SpriteDisplay </strong>to draw a sprite onto
- the back buffer at its current position and animation frame. The
- Sprite must be active for it to display. Use SpriteSetActive to
- set active states.</p>
-
- <hr>
-
- <p><a name="SpriteMove Method"><font color="#0000FF" size="4"><strong>SpriteMove
- Method</strong></font></a></p>
-
- <p>Sets the position of a sprite on the screen.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteMove(long lSpriteNum, long lDirection, long
- lDistance) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you are moving. <br>
- </td>
- </tr>
- <tr>
- <td><strong>lDirection<br>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- <br>
- </strong></td>
- <td>The direction you want to move the sprite in:<br>
- <table border="0">
- <tr>
- <td>1 </td>
- <td>Move the sprite right.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Move the sprite down and right.</td>
- </tr>
- <tr>
- <td>3</td>
- <td>Move the sprite down.</td>
- </tr>
- <tr>
- <td>4</td>
- <td>Move the sprite down and left.</td>
- </tr>
- <tr>
- <td>5</td>
- <td>Move the sprite left.</td>
- </tr>
- <tr>
- <td>6</td>
- <td>Move the sprite up and left.</td>
- </tr>
- <tr>
- <td>7</td>
- <td>Move the sprite up.</td>
- </tr>
- <tr>
- <td>8</td>
- <td>Move the sprite up and right.</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td><strong>lDistance<br>
- </strong></td>
- <td>The number of pixels to move the sprite.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>No return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use <strong>SpriteMove </strong>to move a sprite a
- specified distance in a specified direction.</p>
-
- <hr>
-
- <p><a name="SpriteDefineCollisionRect Method"><font
- color="#0000FF" size="4"><strong>SpriteDefineCollisionRect Method</strong></font></a></p>
-
- <p>Defines a more precise collision rectangle for a sprite.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteDefineCollisionRect(long lSpriteNum, long
- lLeft, long lTop, long lRight, long lBottom) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you are defining a collision
- rectangle for. <br>
- </td>
- </tr>
- <tr>
- <td><strong>lLeft,lTop,lRight,lBottom <br>
- </strong></td>
- <td>The coordinates of the collision rectangle for the
- sprite.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>No return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use <strong>SpriteDefineCollisionRect </strong>to create
- more precise collision determinations between sprites. For
- example, you may have a sprite which is 50 pixels high by 50
- pixels wide, but much of this area is transparent background. You
- wouldn't want a collision detected on this background area, so
- you can use this method to make a diminished rectangle on the
- sprite's surface.</p>
-
- <p><strong>Example<br>
- </strong><font size="2" face="Courier New">ASprite1.hWnd =
- Form1.hWnd<br>
- ASprite1.DrawInit 640, 480, 8, 0<br>
- ASprite1.SpriteLoad "example.bmp", 2, 11<br>
- </font><font color="#008000" size="2" face="Courier New">'Define
- a sprite which is 60 pixels wide by 50 pixels high.<br>
- </font><font size="2" face="Courier New">ASprite1.SpriteDefine 0,
- 1, 1, 0, 0, 60, 50, 72, 9, 1, 1<br>
- </font><font color="#008000" size="2" face="Courier New">'Set the
- collision rectangle to (20,2,38,42). If this was not done,</font><font
- size="2" face="Courier New"><br>
- </font><font color="#008000" size="2" face="Courier New">'then a
- collision would be detected within (0,0,60,50).</font><font
- size="2" face="Courier New"><br>
- ASprite1.SpriteDefineCollisionRect 0, 20, 2, 38, 42<br>
- </font></p>
-
- <hr>
-
- <p><a name="SpriteGetDirection Method"><font color="#0000FF"
- size="4"><strong>SpriteGetDirection Method</strong></font></a></p>
-
- <p>Gets the last direction sprite was moved in with a call to <a
- href="#SpriteMove Method">SpriteMove</a>.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- lDirection = ASprite.<strong>SpriteGetDirection(long lSpriteNum) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum <br>
- </strong></td>
- <td>The number of the sprite you want the last moved
- direction for.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td width="400">The last direction sprite was moved in:<table
- border="0">
- <tr>
- <td>1 </td>
- <td>Sprite was last moved right.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Sprite was last moved down and right.</td>
- </tr>
- <tr>
- <td>3</td>
- <td>Sprite was last moved down.</td>
- </tr>
- <tr>
- <td>4</td>
- <td>Sprite was last moved down and left.</td>
- </tr>
- <tr>
- <td>5</td>
- <td>Sprite was last moved left.</td>
- </tr>
- <tr>
- <td>6</td>
- <td>Sprite was last moved up and left.</td>
- </tr>
- <tr>
- <td>7</td>
- <td>Sprite was last moved up.</td>
- </tr>
- <tr>
- <td>8</td>
- <td>Sprite was last moved up and right.</td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use SpriteGetDirection to get the last direction the
- sprite was moved in with a call to <a href="#SpriteMove Method">SpriteMove</a>.
- This is useful for movement algorithms of sprites.</p>
-
- <hr>
-
- <p><a name="SpriteGetFrame Method"><font color="#0000FF" size="4"><strong>SpriteGetFrame
- Method</strong></font></a></p>
-
- <p>Gets a sprite's current animation frame.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteGetFrame(long lSpriteNum) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you are getting the current
- animation frame number for.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>returns the number of the current animation frame.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Sprites can have multiple frames to provide animation
- capabilities. Use SpriteDefine to set up animation frames for a
- sprite.</p>
-
- <hr>
-
- <p><a name="SpriteGetXPosition, SpriteGetYPosition Methods"><font
- color="#0000FF" size="4"><strong>SpriteGetXPosition,
- SpriteGetYPosition Methods</strong></font></a></p>
-
- <p>Gets the X,Y coordinates of a sprite.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteGetXPosition(long lSpriteNum) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you are getting X,Y
- coordinates for.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>returns the X or Y screen coordinate of a sprite.</td>
- </tr>
- </table>
-
- <hr>
-
- <p><a name="SpriteSetFrame Method"><font color="#0000FF" size="4"><strong>SpriteSetFrame
- Method</strong></font></a></p>
-
- <p>Sets the current animation frame for a sprite.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteSetFrame(long lSpriteNum, short lFrameNum) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you are setting the
- animation frame for.<br>
- </td>
- </tr>
- <tr>
- <td><strong>lFrameNum <br>
- </strong></td>
- <td>The number of the animation frame you wish to go to.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>No return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use <strong>SpriteSetNextFrame </strong>and<strong>
- SpriteSetPrevFrame </strong>to automatically go to the next or
- previous animation frames for a sprite.<font size="2"
- face="Courier New"><br>
- </font></p>
-
- <hr>
-
- <p><a name="SpriteGetActive Method"><font color="#0000FF"
- size="4"><strong>SpriteGetActive Method</strong></font></a></p>
-
- <p>Gets the active state for a sprite.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteGetActive(long lSpriteNum) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you want the active state
- of.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">TRUE </td>
- <td>The sprite is active</td>
- </tr>
- <tr>
- <td>FALSE </td>
- <td>The sprite is inactive</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Setting the active state of a sprite is useful for
- destroying sprites (e.g. a spaceship blows up an asteroid). If a
- sprite is Inactive, it is not displayed when SpriteDisplay is
- called.</p>
-
- <hr>
-
- <p><a name="SpriteSetActive Method"><font color="#0000FF"
- size="4"><strong>SpriteSetActive Method</strong></font></a></p>
-
- <p>Sets the active state for a sprite.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteSetActive(long lSpriteNum, BOOL bActive) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you want to set the active
- state of.<br>
- </td>
- </tr>
- <tr>
- <td><strong>bActive</strong></td>
- <td>TRUE for setting sprite active, FALSE for setting
- inactive</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>No return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Setting the active state of a sprite is useful for
- destroying sprites (e.g. a spaceship blows up an asteroid). If a
- sprite is Inactive, it is not displayed when SpriteDisplay is
- called.</p>
-
- <hr>
-
- <p><a name="SpriteSetNextFrame, SpriteSetPrevFrame Methods"><font
- color="#0000FF" size="4"><strong>SpriteSetNextFrame,
- SpriteSetPrevFrame Methods</strong></font></a></p>
-
- <p>Increments or decrements the current animation frame number
- for a sprite.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteSetNextFrame(long lSpriteNum) </strong><br>
- ASprite.<strong>SpriteSetPrevFrame(long lSpriteNum) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSpriteNum<br>
- </strong></td>
- <td>The number of the sprite you want to set the
- animation frame for.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>No return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use these methods to easily increment the animation
- frame for a sprite. When the animation hits the last frame, it
- will automatically go back to the first frame (or vice-versa for
- SpriteSetPrevFrame).</p>
-
- <hr>
-
- <p><a name="SpriteSetPosition Method"><font color="#0000FF"
- size="4"><strong>SpriteSetPosition Method</strong></font></a></p>
-
- <p><strong>Remarks<br>
- </strong>This method is duplicated by the <a
- href="#SpriteMove Method">SpriteMove</a> method.</p>
-
- <p> </p>
-
- <hr>
-
- <p><a name="SpriteTestCollision Method"><font color="#0000FF"
- size="4"><strong>SpriteTestCollision Method</strong></font></a></p>
-
- <p>Determines whether two sprites collide.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SpriteTestCollision(long lSprite1, long lSprite2)
- </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSprite1 <br>
- </strong></td>
- <td>The number of the first sprite in the collision test.<br>
- </td>
- </tr>
- <tr>
- <td><strong>lSprite2</strong></td>
- <td>The number of the seconds sprite in the collision
- test.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">TRUE </td>
- <td>The sprites collide.</td>
- </tr>
- <tr>
- <td>FALSE </td>
- <td>The sprites do not collide.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Two sprites collide if their frames occupy the same
- space on the screen. However, you can make this frame area more
- precise by using <a href="#SpriteDefineCollisionRect Method"><strong>SpriteDefineCollisionRect</strong></a><strong>.</strong></p>
-
- <hr>
-
- <p><a name="TextSetAttributes Method"><font color="#0000FF"
- size="4"><strong>TextSetAttributes Method</strong></font></a></p>
-
- <p>Sets the attributes for text displayed on the back buffer.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>TextSetAttributes(long lWidth, long lHeight, <br>
- LPCTSTR lpctstrFace, long lFontSize, <br>
- double dForeColor, double dBackColor) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lWidth <br>
- </strong></td>
- <td>The width, in pixels, of the text window.<br>
- </td>
- </tr>
- <tr>
- <td><strong>lHeight</strong></td>
- <td>The height, in pixels, of the text window.</td>
- </tr>
- <tr>
- <td><strong>lpctstrFace</strong></td>
- <td>The font name to use, e.g. "Arial"</td>
- </tr>
- <tr>
- <td><strong>lFontSize</strong></td>
- <td>The font size to use, in points.</td>
- </tr>
- <tr>
- <td><strong>dForeColor </strong></td>
- <td>The forecolor of the text to display.</td>
- </tr>
- <tr>
- <td><strong>dBackColor <br>
- </strong></td>
- <td>The backcolor of the text to display. To make the
- background transparent, you should use RGB(0,0,0).</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>no return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>You can think of displaying text as making a window onto
- the back buffer. You should re-use these windows whenever
- possible, to save resources.<br>
- <br>
- <strong>Example<br>
- </strong><font size="2" face="Courier New">ASprite1.hWnd =
- Form1.hWnd<br>
- ASprite1.DrawInit 640, 480, 8, 0<br>
- </font><font color="#008000" size="2" face="Courier New">'Define
- a text window which is 320 pixels wide by 30 pixels high.<br>
- 'it will use Arial 16 point font colored white, and the
- background<br>
- 'will be transparent.<br>
- </font><font size="2" face="Courier New">ASprite1.TextSetAttributes
- 320, 30, "Arial", 16, _<br>
- RGB(255, 255, 255), RGB(0, 0, 0)<br>
- ASprite1.DrawFloodFill 0<br>
- ASprite1.TextDisplay "This text will be at the upper left
- corner", 1, 1<br>
- ASprite1.TextDisplay "You should re-use your text
- windows!", 1, 200<br>
- ASprite1.DrawFlipBackBuffer<br>
- <br>
- </font></p>
-
- <hr>
-
- <p><a name="TextDisplay Method"><font color="#0000FF" size="4"><strong>TextDisplay
- Method</strong></font></a></p>
-
- <p>Displays a text window to the back buffer.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>TextDisplay(string lpctstrString, long lX, long
- lY) </strong><br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lpctstrString <br>
- </strong></td>
- <td>The text string you wish to display.<br>
- </td>
- </tr>
- <tr>
- <td><strong>lX</strong></td>
- <td>The X coordinate you wish to place the text window
- at.</td>
- </tr>
- <tr>
- <td><strong>lY</strong></td>
- <td>The Y coordinate you wish to place the text window
- at.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>No return value.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>See the <a href="#TextSetAttributes Method"><strong>TextSetAttributes</strong></a><strong>
- </strong>for information and an example.</p>
-
- <hr>
-
- <p><a name="SoundInit Method"><font color="#0000FF" size="4"><strong>SoundInit
- Method</strong></font></a></p>
-
- <p>Initializes DirectSound sound services.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundInit()</strong><br>
- </p>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0</td>
- <td>Success.</td>
- </tr>
- <tr>
- <td>1</td>
- <td>DSOUND.DLL not found; DirectSound not installed.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Could not create DirectSound object.</td>
- </tr>
- <tr>
- <td>3</td>
- <td>Could not get exclusive access.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>You must call SoundInit prior to any other Sound
- methods.</p>
-
- <hr>
-
- <p><a name="SoundDisable Method"><font color="#0000FF" size="4"><strong>SoundDisable
- Method</strong></font></a></p>
-
- <p>Disables DirectSound sound services and frees any associated
- resources.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundDisable()</strong><br>
- </p>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>You should always call SoundDisable after completing all
- sound processing. This releases resources which SoundInit
- collected.<br>
- </p>
-
- <hr>
-
- <p><a name="SoundLoad Method"><font color="#0000FF" size="4"><strong>SoundLoad
- Method</strong></font></a></p>
-
- <p>Loads a WAV file into memory for playback using the SoundPlay
- method.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundLoad(long lSoundNum, string lpctstrFileName)
- </strong><br>
- <br>
- </p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSoundNum <br>
- </strong></td>
- <td>The sound number to assign. You should start at 0 and
- increment for each sound you load.<br>
- </td>
- </tr>
- <tr>
- <td><strong>lpctstrFileName</strong></td>
- <td>The filename of the WAV file you wish to load.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success.</td>
- </tr>
- <tr>
- <td>1</td>
- <td>Could not load WAV file.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>You should always call SoundDisable after completing all
- sound processing. This releases resources which SoundInit
- collected.</p>
-
- <hr>
-
- <p><a name="SoundPlay Method"><font color="#0000FF" size="4"><strong>SoundPlay
- Method</strong></font></a></p>
-
- <p>Plays a sound previously loaded with the SoundLoad method.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundPlay(long lSoundNum) </strong></p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSoundNum <br>
- </strong></td>
- <td>The number of the sound you want to play.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- <tr>
- <td>1</td>
- <td>Sound not loaded.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Error while playing.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use the SoundPlay method to play a sound in a buffered
- manner. Buffered sounds are mixed together to provide better
- sound. For example, you can buffer the sound of a gun blast
- followed by an explosion, and both sounds will continue to play
- for a realistic effect.<br>
- <br>
- <strong>Example<br>
- </strong><font color="#008000" size="2" face="Courier New">'Initialize
- sound services, load a wave file, and play it in the buffer.<br>
- 'note that gun.wav must exist in the current working directory.<br>
- </font><font size="2" face="Courier New">ASprite1.hWnd =
- Form1.hWnd<br>
- ASprite1.SoundInit<br>
- ASprite1.SoundLoad 0, "gun.wav"<br>
- ...<br>
- ASprite1.SoundPlay 0<br>
- ...<br>
- ASprite1.SoundDisable<br>
- </font></p>
-
- <hr>
-
- <p><a name="SoundPlayLoop Method"><font color="#0000FF" size="4"><strong>SoundPlayLoop
- Method</strong></font></a></p>
-
- <p>Starts playing a sound in a looping manner. When the sound
- reaches its end, it will automatically begin replaying at its
- beginning. The sound must have been previously loaded with the
- SoundLoad method.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundPlayLoop(long lSoundNum) </strong></p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSoundNum <br>
- </strong></td>
- <td>The number of the sound you want to play.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- <tr>
- <td>1</td>
- <td>Sound not loaded.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Error while playing.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use the SoundStopLoop method to STOP a sound started
- with the SoundPlayLoop method. These functions are useful for
- "background" noises that are repetitive, such as a
- helicopter whoop or cheers from a crowd.</p>
-
- <hr>
-
- <p><a name="SoundStopLoop Method"><font color="#0000FF" size="4"><strong>SoundStopLoop
- Method</strong></font></a></p>
-
- <p>Stops playing a sound which was started looping with
- SoundPlayLoop. </p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundStopLoop(long lSoundNum) </strong></p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lSoundNum <br>
- </strong></td>
- <td>The number of the sound you want to stop looping.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Success</td>
- </tr>
- <tr>
- <td>1</td>
- <td>Sound not loaded.</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Error while playing.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use the SoundStopLoop method to STOP a sound started
- with the SoundPlayLoop method. </p>
-
- <hr>
-
- <p><a name="SoundPlayFile Method"><font color="#0000FF" size="4"><strong>SoundPlayFile
- Method</strong></font></a></p>
-
- <p>Plays a WAV file from disk, without using DirectSound to
- provide buffering.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundPlayFile(string sFileName) </strong></p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>sFileName <br>
- </strong></td>
- <td>the filename of the WAV file you want to play.<br>
- </td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%"> </td>
- <td>no return value</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use the SoundPlayFile method to play a sound from a WAV
- file without using the overhead of DirectSound. SoundPlayFile
- utilizes the older, unbuffered Windows multimedia command. This
- means you cannot "mix" sounds together like you can by
- using <a href="#SoundInit Method">SoundInit</a>, <a
- href="#SoundLoad Method">SoundLoad</a>, and <a
- href="#SoundPlay Method">SoundPlay</a> which do use the newer
- DirectSound API to buffer the sounds.</p>
-
- <hr>
-
- <p><a name="SoundSetVolume Method"><font color="#0000FF" size="4"><strong>SoundSetVolume
- Method</strong></font></a></p>
-
- <p>Sets the volume for playing back sounds with the SoundPlay
- method.<br>
- <br>
- <strong>Syntax</strong><br>
- ASprite.<strong>SoundSetVolume(long lVolume)</strong></p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>lVolume <br>
- </strong></td>
- <td>New volume requested for this sound buffer. Values
- range <br>
- from 0 (no volume adjustment) to -10,000 (-100 dB, <br>
- essentially silent). Amplification is NOT supported.</td>
- </tr>
- </table>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0</td>
- <td>Success</td>
- </tr>
- <tr>
- <td>1</td>
- <td>lVolume is out of range.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Note that a value of Zero for lVolume will play the
- sound at it's normal level, and a negative value will play the
- sound at lower than normal level. Amplification is NOT supported.<br>
- </p>
-
- <p><strong>Example</strong><br>
- <font color="#008000" size="2" face="Courier New">'Decrease the
- volume by 100</font><font size="2" face="Courier New"><br>
- ASprite1.SoundSetVolume (ASprite1.SoundGetVolume() - 100)<br>
- </font><font color="#008000" size="2" face="Courier New">'Any
- subsequent sounds played will be affected!</font><font size="2"
- face="Courier New"><br>
- ASprite1.SoundPlay 1</font></p>
-
- <hr>
-
- <p><a name="SoundGetVolume Method"><font color="#0000FF" size="4"><strong>SoundGetVolume
- Method</strong></font></a></p>
-
- <p>Returns the current volume for playing back sounds with the
- SoundPlay method.<br>
- <br>
- <strong>Syntax</strong><br>
- lSoundLevel = ASprite1.<strong>SoundGetVolume()</strong></p>
-
- <p><strong>Parameters</strong></p>
-
- <table border="0">
- <tr>
- <td><strong>none.</strong></td>
- <td> </td>
- </tr>
- </table>
-
- <p><strong>Return Values<br>
- </strong>Returns the current sound level for playing back sounds.
- Values range from 0 (no volume adjustment) to -10,000 (-100 dB,
- essentially silent). </p>
-
- <p><strong>Remarks<br>
- </strong>Use the SoundGetVolume function in conjunction with
- SoundSetVolume to control the level at which a wav file is played
- back.<br>
- </p>
-
- <p><strong>Example</strong><br>
- <font color="#008000" size="2" face="Courier New">'Decrease the
- volume by 100</font><font size="2" face="Courier New"><br>
- ASprite1.SoundSetVolume (ASprite1.SoundGetVolume() - 100)<br>
- </font><font color="#008000" size="2" face="Courier New">'Any
- subsequent sounds played will be affected!</font><font size="2"
- face="Courier New"><br>
- ASprite1.SoundPlay 1</font></p>
-
- <hr>
-
- <p><a name="TimerGetTickCount Method"><font color="#0000FF"
- size="4"><strong>TimerGetTickCount Method</strong></font></a></p>
-
- <p>Returns the number of milliseconds which have passed since
- Windows was started.</p>
-
- <p><br>
- <strong>Syntax</strong><br>
- lTickCount = ASprite.<strong>TimerGetTickCount</strong></p>
-
- <p><strong>Return Values</strong></p>
-
- <table border="0">
- <tr>
- <td width="10%">0 </td>
- <td>Returns the number of milliseconds which have passed
- since Windows was started.</td>
- </tr>
- </table>
-
- <p><strong>Remarks<br>
- </strong>Use the <strong>TimerGetTickCount</strong> method to
- emulate a clean timer. Some development tools such as Visual
- Basic provide a timer which is not adequate (e.g. too
- "choppy") for multimedia programming. By using this
- method, you can ensure your game's frame rate is smooth and
- consistent.<br>
- <br>
- </p>
- </body>
- </html>
-