home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-01-06 | 3.8 KB | 139 lines | [TEXT/CWIE] |
- ///--------------------------------------------------------------------------------------
- // SWCommonHeaders.h
- //
- // Portions are copyright: c 1991-94 Tony Myles, All rights reserved worldwide.
- //
- // Description: common macros, constants, and stuff, used throughout SpriteWorld
- ///--------------------------------------------------------------------------------------
-
- #ifndef __RETRACE__
- #include <Retrace.h>
- #endif
-
- #ifndef __SWCOMMON__
- #define __SWCOMMON__
-
- ///--------------------------------------------------------------------------------------
- // VBL-related stuff
- ///--------------------------------------------------------------------------------------
-
- typedef struct VBLTaskRec VBLTaskRec;
- typedef VBLTaskRec *VBLTaskRecPtr, **VBLTaskRecHdl;
-
- struct VBLTaskRec
- {
- VBLTask myVBLTask;
- volatile Boolean hasVBLFired;
- };
-
-
- ///--------------------------------------------------------------------------------------
- // sprite world definitions
- ///--------------------------------------------------------------------------------------
-
- typedef struct SpriteWorldRec SpriteWorldRec;
- typedef SpriteWorldRec *SpriteWorldPtr, **SpriteWorldHdl;
-
-
- ///--------------------------------------------------------------------------------------
- // SW_ASSERT
- ///--------------------------------------------------------------------------------------
-
- #define SW_ASSERT_ON 1 // Change this to 0 to turn assertions off. use 1/0, not true/false.
-
- #define kAssertAlertID 128 // The resource ID of the Alert dialog box used for assertions.
-
- #if (SW_ASSERT_ON == 1)
- #define SW_ASSERT( condition ) \
- if ( !(condition) ) \
- SWAssertFail( __FILE__, __LINE__ ); // Defined in SpriteWorldUtils.c
- #else
- #define SW_ASSERT(f) NULL
- #endif
-
-
- ///--------------------------------------------------------------------------------------
- // sprite world macros
- ///--------------------------------------------------------------------------------------
-
- #if defined(powerc) || defined(__powerc)
- #define SW_PPC 1
- #else
- #define SW_PPC 0
- #endif
-
- #define SW_MIN(a, b) ((a) < (b) ? (a) : (b))
- #define SW_MAX(a, b) ((a) > (b) ? (a) : (b))
-
- #define SW_RECT_WIDTH(theRect) (theRect.right - theRect.left)
- #define SW_RECT_HEIGHT(theRect) (theRect.bottom - theRect.top)
-
- #define SW_SET_RECT(theRect, myleft, mytop, myright, mybottom) \
- theRect.left = myleft; \
- theRect.top = mytop; \
- theRect.right = myright; \
- theRect.bottom = mybottom;
-
- #define SW_RECT_IS_IN_RECT(rectA, rectB) \
- ( (rectA.top < rectB.bottom) && \
- (rectA.bottom > rectB.top) && \
- (rectA.left < rectB.right) && \
- (rectA.right > rectB.left) )
-
- // Clips rectA with rectB
- #define SW_CLIP_RECT(rectA, rectB) \
- if (rectA.top < rectB.top) \
- rectA.top = rectB.top; \
- if (rectA.bottom > rectB.bottom) \
- rectA.bottom = rectB.bottom; \
- if (rectA.left < rectB.left) \
- rectA.left = rectB.left; \
- if (rectA.right > rectB.right) \
- rectA.right = rectB.right;
-
-
- // Generally MacHeaders provides these macros. If you're not using MacHeaders
- // for some strange reason, uncomment these lines:
- /*
- #define topLeft(theRect) (*(Point*)&theRect.top)
- #define botRight(theRect) (*(Point*)&theRect.bottom)
- */
-
- // set to 'pascal' so the library will be callable from pascal
- #define SW_FUNC pascal
-
- #define kBitsPerByte 8
-
- #if __MWERKS__
-
- #define SW_ASM_FUNC asm
- #define SW_ASM_BEGIN machine 68020
- #define SW_ASM_END rts
-
- #elif THINK_C
-
- #define SW_ASM_FUNC
- #define SW_ASM_BEGIN asm 68020{
- #define SW_ASM_END }
-
- #endif
-
-
- ///--------------------------------------------------------------------------------------
- // compiled sprite definitions
- ///--------------------------------------------------------------------------------------
-
- typedef short PixelCode, *PixelCodePtr, **PixelCodeHdl;
-
- typedef void (*BlitFuncPtr)(
- long srcStride,
- long destStride,
- Ptr srcBaseAddr,
- Ptr destBaseAddr);
-
- #endif /*__SWCOMMON__*/
-
-
-
-
-