Tim's Libraries/Scaling.h

/*
    File:       Scaling.h
 
    Contains:   Scaling implements a standard 2D canvas to draw a set of TGraphics and tiles into.
                It also provides a set of globals that allow the sprite's location to be relative
                to a specific camera location.
 
    Written by: Timothy Carroll 
 
    Copyright:  Copyright © 1996-1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source 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 source
                code, but that you've made changes.
 
    Change History (most recent first):
                7/2/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
                8/15/96     Timothy Carroll Initial Release
                
 
*/
 
#ifndef _SCALING_
#define _SCALING_
 
#include <QuickDraw.h>
 
// We define all the world coordinate scaling information here, and also define functions
// for choosing the drawing buffer and clipping to it.  The drawing buffer will be used by
// TGraphic and TTile objects and any other class of offscreen blitters we make in the future.
 
 
// WorldRect32 is a rectangle in 16.16 fixed point coordinates.  FixedPoint coordinates are
// used for all coordinates in the game.  Anything in world coordinates should be converted
// to screen coordinates before being drawn.
// This structure defines a rectangle in 16.16 fixed point coordinates -- these are used as
// the world coordinates for the game, they must be translated into screen coordinates
// before drawing can take place.
 
struct WorldRect32
{
    SInt32 top;
    SInt32 left;
    SInt32 bottom;
    SInt32 right;
};
 
// For the most part, we define a number of globals that can be read freely, but 
// the functions should be called whenever one of these globals needs to be updated.
// This is because more than one global might need to be set, and the functions do the
// right thing.
 
 
 
extern SInt32           gWorldCoordX;
extern SInt32           gWorldCoordY;
extern Rect             gClipRect;
extern SInt32           gClipCenterX;
extern SInt32           gClipCenterY;
 
extern PixMapHandle     gDestPixMap;
extern PixMapHandle     gBackPixMap;
extern unsigned char    *gDestBaseAddr;
extern unsigned char    *gBackBaseAddr;
extern UInt32           gRowBytes;
    
extern void SetDestinationBuffer(PixMapHandle inDestPixMap, PixMapHandle inBackPixMap);
extern void SetBufferClip(Rect *inClipRect);
extern void SetWorldOrigin (SInt32 x, SInt32 y);
 
#endif // _SCALING_