/*
File Name: GeneralPurposeFunctions.h
Created By: Andy Odle
Date: Sep 18, 2009
*/

#ifndef General_Purpose_Functions
#define General_Purpose_Functions

// Needed includes.
#include <sstream>
#include <stdlib.h>
#include "sys/time.h"

using namespace std;

#include "./source/PlatformSpecific/inc/Sprite.h"

/* -----Functions----- */

// Function created by Adam Pierce http://www.doctort.org/adam/ (Axcessed Feb 18, 2010 
//
// Output:
//          Returns the number of ticks sense the computer has been started.
unsigned GetTickCount();

// Function created by radu http://radu.wordpress.com/ (Axcessed September 17th, 2009) 
// http://www.doctort.org/adam/
// Input:
//         Anything that will convert to a string.http://www.doctort.org/adam/nerd-notes/linux-equivalent-of-the-windows-gettickcount-function.html
// 
// Output:
//         Input converted to a sting.
template <class T> 
inline string tostring(const T& convertToString_p)
{
    stringstream tempString_l;
    
    if(convertToString_p)
    {        
        tempString_l << convertToString_p;
        return tempString_l.str();
    }
    
    return tempString_l.str();
}

// Did sprite2 collide with sprite1.
unsigned int SpriteHasCollided(Sprite *spriteA_p, Sprite *spriteB_p);

void *operator new(size_t size_p);
void operator delete(void *whatToDelete_p);

#endif
