Classes | Typedefs | Enumerations | Functions | Variables

C:/Development/LoM/client/src/Utility/Common.h File Reference

#include "SDL/SDL.h"
#include "Logger.h"
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cctype>
#include <vector>

Classes

struct  Color4ub
 Four component Color structure. More...
struct  Vec2f
 Contains two values. More...
struct  Recti
 Basic 2D rectangle. More...
class  IdManager
 Generates basic GUIDs for use in controls. More...
class  Timer
 Convenience class to return high-resolution timer values. More...

Typedefs

typedef unsigned int Uint
 An Unsigned Integer value.
typedef unsigned char Uchar
 An Unsigned Character value.
typedef std::pair< Uint, UintAbsCoordinate
 A pair of absolute value coordinates.
typedef std::vector< std::string > StringList
 A list of strings.

Enumerations

enum  EntityType { ITEM, MONSTER, PLAYER, NPC }
 

An Unsigned Integer value.

More...

Functions

bool isPointInRect (int pointX, int pointY, int rectX, int rectY, int rectW, int rectH)
bool isRectInRect (int aX, int aY, int aX2, int aY2, int bX, int bY, int bX2, int bY2)
bool isRectInRect (Recti a, Recti b)
std::string toLowercase (const std::string &str)
std::string toUppercase (const std::string &str)
void system_launch (const std::string cmd)
int clamp (int x, int a, int b)
float clamp (float x, float a, float b)
float degToRad (float degree)
float radToDeg (float rad)
float angleFromPoints (float x, float y, float x2, float y2)
Vec2f getDirectionVector (float angle)
template<typename T >
bool from_string (T &t, const std::string &s, std::ios_base &(*f)(std::ios_base &))

Variables

const float PI
const float PI_2
const float DEG2RAD
const float RAD2DEG

Typedef Documentation

A pair of absolute value coordinates.

Todo:
This is a fantastic tweak that I'd like to take advantage of elsewhere in the code base along with a plain coordinate pair.

A list of strings.

An Unsigned Character value.

Typically used for color definitions as values can only be between 0 - 255.

An Unsigned Integer value.


Enumeration Type Documentation

enum EntityType

An Unsigned Integer value.

Enumerator:
ITEM 
MONSTER 
PLAYER 
NPC 

Function Documentation

float angleFromPoints ( float  x,
float  y,
float  x2,
float  y2 
)

Gets the angle of a line in degrees given two points.

int clamp ( int  x,
int  a,
int  b 
)

Clamps an int value to a specified range.

Parameters:
x Value to clamp.
a Minimum value to clamp to.
b Maximum value to clamp to.
float clamp ( float  x,
float  a,
float  b 
)

Clamps an float value to a specified range.

Parameters:
x Value to clamp.
a Minimum value to clamp to.
b Maximum value to clamp to.
float degToRad ( float  degree  ) 

Gets an angle in radians from degrees.

template<typename T >
bool from_string ( T &  t,
const std::string &  s,
std::ios_base &(*)(std::ios_base &)  f 
)
Vec2f getDirectionVector ( float  angle  ) 

Gets a directional vector from an angle in degrees.

bool isPointInRect ( int  pointX,
int  pointY,
int  rectX,
int  rectY,
int  rectW,
int  rectH 
)
bool isRectInRect ( int  aX,
int  aY,
int  aX2,
int  aY2,
int  bX,
int  bY,
int  bX2,
int  bY2 
)
bool isRectInRect ( Recti  a,
Recti  b 
)
float radToDeg ( float  rad  ) 

Gets an angle in degrees from radians.

void system_launch ( const std::string  cmd  ) 
std::string toLowercase ( const std::string &  str  ) 
std::string toUppercase ( const std::string &  str  ) 

Variable Documentation

const float DEG2RAD
const float PI
const float PI_2
const float RAD2DEG
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines