Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

SfxpCoord Class Reference
[Fixed-Point math routines]

Class used to handle fixed-point x/y coordinates. More...

#include <Fxp.h>

List of all members.

Public Member Functions

 SfxpCoord (FxpFloat xin, FxpFloat yin)
 Floating point constructor.

 SfxpCoord (int xin=0, int yin=0)
 Integer constructor.

bool operator== (SfxpCoord &coord)
 Comparison operator.

bool operator!= (SfxpCoord &coord)
 Comparison operator.

SfxpCoord operator+ (SfxpCoord coord)
 Vector addition operator.

SfxpCoord operator- (SfxpCoord coord)
 Vector subtraction operator.

SfxpCoord operator+= (SfxpCoord coord)
 Adds passed vector to stored vector.

SfxpCoord FxpScalar (Sfxp val)
 Multiplies the vector by a signed fixed point scalar value.

Afxp Trajectory ()
 Returns the angle it's pointing at. Valid for all angles.

SfxpCoord IntScalar (int val)
 Multiplies the vector by a signed fixed-point integer value.

bool MajorDigitsEqual (SfxpCoord coord) const
 Returns true if the truncated integer portions match.

int X () const
 Returns the truncated integer portion of the X coordinate.

int Y () const
 Returns the truncated integer portion of the Y coordinate.

int Xfxp () const
 Returns the raw fixed-point X coordinate.

int Yfxp () const
 Returns the raw fixed-point Y coordinate.

FxpFloat Xfloat ()
 Returns the X coordinate, converted to floating point.

FxpFloat Yfloat ()
 Returns the Y coordinate, converted to floating point.

SfxpCoord SetFloat (FxpFloat xin, FxpFloat yin)
 Sets X and Y coordinates, converting from floating point.

SfxpCoord SetFxp (Sfxp xin, Sfxp yin)
 Sets X and Y coordinates from raw fixed point values.

SfxpCoord SetInt (Sint32 xin, Sint32 yin)
 Initializes coordinates, converting from integer values.

int Nonzero ()
 Returns zero if the vector is zero in magnitude.

void Vector (Sfxp magnitude, Afxp angle)
 Initializes coordinates to the specified angle and magnitude.

Sfxp Magnitude ()
 Returns the magnitude of the vector. Not 100% fixed-point yet.


Detailed Description

Fixed-point coordinates are the foundation of Spritelib. This is a very simple class that can do a LOT of things. You can add and subtract them like vectors, turn a direction/velocity vector into an X/Y velocity vector and vice versa, multiply by scalars, convert to and from floating point, and more. This class will probably go over time just because there are so many things you CAN do with vectors.

Definition at line 141 of file Fxp.h.


The documentation for this class was generated from the following file:
Generated on Sat Oct 11 13:19:34 2003 for Spritelib by doxygen 1.3.4