Documentation for C++/SDL 2.0 Tile Engine
Making a simple tile based engine
|
A math utility function namespace. More...
Enumerations | |
enum | { UP, DOWN, LEFT, RIGHT } |
Describes a direction. |
Functions | |
float | Distance (const Vector2f &a, const Vector2f &b) |
float | Clamp (const float x, const float min, const float max) |
float | Magnitude (const Vector2f &v) |
Vector2f | Normalize (const Vector2f &v) |
Vector2f | Lerp (const Vector2f &start, const Vector2f &end, float percent) |
int | RectNearRect (const Rectf &a, const Rectf &b, int tolerance=0) |
bool | CheckCollision (const Rectf &a, const Rectf &b) |
bool | CheckCollision (const Vector2f &p, const Rectf &r) |
Vector2f | ToSceneSpace (const Camera *cam, const Vector2f &v) |
Rectf | ToSceneSpace (const Camera *cam, const Rectf &r) |
Vector2f | FromSceneSpace (const Camera *cam, const Vector2f &v) |
Rectf | FromSceneSpace (const Camera *cam, const Rectf &r) |
A math utility function namespace.
A math utility function namespace
float Math::Clamp | ( | const float | x, |
const float | min, | ||
const float | max | ||
) |
Clamp the value x between the range min and max
x | The value to clamp |
min | The minimum value x can be |
max | The max value x can be |
Takes two vectors (points) and returns the distance between them
a | First point |
b | Second point |
float Math::Magnitude | ( | const Vector2f & | v | ) |
Check if two rectangles are near each other and return the side of a that's near b TODO: Implement an early out for this function if the rect's are too far
a | The first Rect |
b | The Rect to see if a is near |
tolerance | The max distance the Rect's can be from each other, default is 0 |