Add project files.
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#ifndef _CTIMING_HPP_
|
||||
#define _CTIMING_HPP_
|
||||
|
||||
/*** SDL Header Files ***/
|
||||
#include <SDL.h>
|
||||
|
||||
/*** DLL Header File ***/
|
||||
#include <dllExport.h>
|
||||
|
||||
#define MAXIMUM_FRAME_RATE 120
|
||||
#define MINIMUM_FRAME_RATE 15
|
||||
#define UPDATE_INTERVAL (1.0 / MAXIMUM_FRAME_RATE)
|
||||
#define MAX_CYCLES_PER_FRAME (MAXIMUM_FRAME_RATE / MINIMUM_FRAME_RATE)
|
||||
|
||||
namespace TimingEngine {
|
||||
/* Singleton */
|
||||
class EXPORT_FROM_MYDLL cTiming
|
||||
{
|
||||
private:
|
||||
cTiming( const unsigned long int ftp = 30 );
|
||||
~cTiming();
|
||||
|
||||
public:
|
||||
cTiming& operator=( const cTiming& copy );
|
||||
|
||||
///Functions
|
||||
static cTiming& Inst();
|
||||
static void Delete();
|
||||
|
||||
const bool Initialize() const;
|
||||
/* Sets up timing */
|
||||
void Setup();
|
||||
void CleanUp();
|
||||
/* Sleeps if need */
|
||||
void Time();
|
||||
|
||||
///Sets
|
||||
void setFTP( const unsigned long int ftp = 30 );
|
||||
///Gets
|
||||
const unsigned long int getFTP() const;
|
||||
/* Gets return true if Timer was initialized */
|
||||
const bool IsInit() const;
|
||||
|
||||
const float getFrameTime() const;
|
||||
|
||||
|
||||
private:
|
||||
const unsigned long int TimeLeft();
|
||||
void AddTimeandRate();
|
||||
|
||||
const float FrameTime();
|
||||
|
||||
private:
|
||||
///Variables
|
||||
unsigned long int m_nextTime;// = 0
|
||||
|
||||
unsigned long int m_rate;// = (1000 / m_ftp)
|
||||
|
||||
unsigned long int m_ftp;// = 30
|
||||
|
||||
static cTiming* sp_inst;// = nullptr
|
||||
|
||||
unsigned long int m_start;// = 0
|
||||
float m_lastTime;// = 0.0
|
||||
float m_frameTime;// = 0.0
|
||||
};/// END CLASS DEFINITION cTiming
|
||||
}/// END NAMESPACE DEFINITION TimingEngine
|
||||
#endif/// END IFNDEF _CTIMING_HPP_
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "Vector2.hpp"
|
||||
|
||||
/*** Custom Header File ***/
|
||||
#include "../iVector/iVector2.hpp"
|
||||
|
||||
using MathEngine::Vector2;
|
||||
using MathEngine::iVector2;
|
||||
|
||||
Vector2::Vector2( const float X /*= 0.0f*/, const float Y /*= 0.0f*/ )
|
||||
: x(X), y(Y)
|
||||
{};
|
||||
|
||||
Vector2::Vector2( const SDL_Rect& copy )
|
||||
{
|
||||
x = float(copy.x);
|
||||
y = float(copy.y);
|
||||
}
|
||||
|
||||
Vector2& Vector2::operator=( const SDL_Rect& copy )
|
||||
{
|
||||
x = float(copy.x);
|
||||
y = float(copy.y);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector2::Vector2( const iVector2& copy )
|
||||
{
|
||||
x = float(copy.x);
|
||||
y = float(copy.y);
|
||||
}
|
||||
|
||||
Vector2& Vector2::operator=( const iVector2& copy )
|
||||
{
|
||||
x = float(copy.x);
|
||||
y = float(copy.y);
|
||||
|
||||
return *this;
|
||||
}
|
||||
Reference in New Issue
Block a user