Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
GameHeaders/FixGraf.h
#pragma once |
typedef struct { |
Fixed h; |
Fixed v; |
} fixPt; |
typedef struct { |
Fixed top; |
Fixed left; |
Fixed bottom; |
Fixed right; |
} fixRect; |
// fixed point math stuff (thanks Myles & GX) |
#define ff(x) (((long)(x)<<16)) |
#define FixToInt(x) ((int)((x)>>16)) |
#define FixToDbl(x) ldexp((double)(x),-16) |
#define DblToFix(x) ((long)ldexp((x),16)) |
#define RndFixToInt(x) ((int)((x)+FIX_HALF>>16)) |
#define FixRound(x) FixToi(x) |
#define Frac2Fix(x) ((x)>>14) |
#define Fix2Frac(x) ((x)<<14) |
#define FracToDbl(x) ldexp((double)(x),-30) |
#define DblToFrac(x) ((long)ldexp((x),30)) |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-01-14