Source/Sprite.h

//¥ ------------------------------------------------------------------------------------------  ¥
//¥
//¥ Copyright © 1996 Apple Computer, Inc., All Rights Reserved
//¥
//¥
//¥     You may incorporate this sample code into your applications without
//¥     restriction, though the sample code has been provided "AS IS" and the
//¥     responsibility for its operation is 100% yours.  However, what you are
//¥     not permitted to do is to redistribute the source as "DSC Sample Code"
//¥     after having made changes. If you're going to re-distribute the source,
//¥     we require that you make it clear in the source that the code was
//¥     descended from Apple Sample Code, but that you've made changes.
//¥
//¥     Authors:
//¥         Chris De Salvo
//¥
//¥ ------------------------------------------------------------------------------------------  ¥
 
#ifndef __SPRITES__
#define __SPRITES__
 
//¥ ------------------------------  Includes
 
#include <QDOffscreen.h>
 
//¥ ------------------------------  Public Definitions
//¥ ------------------------------  Public Types
 
typedef struct Frame
{
    UInt16  height, width;
    SInt16  hotX, hotY;
    UInt8   *image;
} Frame, *FramePtr;
 
typedef struct Sprite
{
    UInt16      numFrames;
    FramePtr    *frames;
} Sprite, *SpritePtr;
 
//¥ ------------------------------  Public Variables
//¥ ------------------------------  Public Functions
 
#ifdef __cplusplus
extern "C" {
#endif
 
extern SpritePtr SpriteLoad(SInt16 resNum);
extern Rect SpriteDraw(SpritePtr theSprite, UInt32 frameNum, CGrafPtr dest, SInt32 x, SInt32 y);
extern void SpriteDispose(SpritePtr *theSprite);
extern UInt16 SpriteHeight(SpritePtr whichSprite, UInt16 whichFrame);
extern UInt16 SpriteWidth(SpritePtr whichSprite, UInt16 whichFrame);
extern Boolean IntersectRects(const RectPtr a, const RectPtr b);
 
#ifdef __cplusplus
}
#endif
 
#endif