What are sprites? How sprites are used to create an animation?

A Sprite is a bitmap that is displayed on the screen that is often moving around (like a cartoon character). Animated sprites are a sequence of bitmaps that when rendered with a delay between each frame gives an animation. In the example application "Sprite.Zip" we have just read the cursorposition and drawn a rotating MousePtr Sprite their!

A typical Sprite Structure :-

typedef struct SPRITE
{  
  LPDIRECTDRAWSURFACE7 Surf;
  int nFrames;
  int iCurFrame;
  int MaxFrameDelay,int CurFrameDelay;
  int Width, Height;
}SPRITE;


This SPRITE struct specifies that we need a DirectDrawSurface to hold the Bitmap (Containing the sequence of frames drawn one after another), Number of frames, The Current Frame, The MaximumDelay of a Frame, the Current Frame Delay, and the width and height of the SpriteBitmap

We have to set the Sprite by "SetSprite" functioncall with the necessary structre intialization elements, Draw the Sprite by DrawSprite function call that selects the current frame and draws it(The Frame Drawn will Depend on the time elapsed since the App started)

FAQ Menu

 
Printer friendly version of the FAQ-DIRECTX-What-Are-Sprites page


Sponsored links

SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
3 Months Free - ASP.NET Web Hosting
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!
PureCM Software Configuration Management
Version control and integrated issue tracking - powerful and easy to use. Get your FREE trial now!
Virtual File System SDK
Create your own file systems in Windows and .NET applications
CSTSOFT Instrumentation .NET & ActiveX Components
A collection of 13 instrumentation .NET/ActiveX/VCL components including Gauge,Knob,LED,Trend etc.

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.