Add project files.

This commit is contained in:
2018-06-25 21:48:45 -04:00
parent b04a25689b
commit 3c1b7d28e8
425 changed files with 35333 additions and 0 deletions
@@ -0,0 +1,158 @@
#include "cAnimatedSprite.hpp"
using VideoEngine::cAnimatedSprite;
cAnimatedSprite::cAnimatedSprite( const unsigned long int x /*= 0*/, const unsigned long int y /*= 0*/,
const unsigned long int fps /*= 16*/ )
: m_nextTime(0), m_RATE(0)
{
setFPS(fps);
setIncrement(x, y);
}
cAnimatedSprite::cAnimatedSprite( const cAnimatedSprite& copy )
: m_nextTime(0), m_RATE(0)
{
setFPS(copy.getFPS());
setIncrement(copy.getXIncrement(), copy.getYIncrement());
}
cAnimatedSprite::~cAnimatedSprite()
{
}
///Functions
void cAnimatedSprite::UptoDown()
{
//if (TimeLeft() == 0)
//{
signed long int x = 0;
signed long int y = 0;
getStartImageArea(x, y);
y += m_yIncrement;
if (y >= signed(getImage()->getHeight()))
y = 1;
setStartImageArea(x, y);
//}
Draw();
}
void cAnimatedSprite::DowntoUp()
{
//if (TimeLeft() == 0)
//{
signed long int x = 0;
signed long int y = 0;
getStartImageArea(x, y);
y -= m_yIncrement;
if (y < 1)
y = getImage()->getHeight() - m_yIncrement;
setStartImageArea(x, y);
//}
Draw();
}
void cAnimatedSprite::LefttoRight()
{
signed long int x = 0;
signed long int y = 0;
getStartImageArea(x, y);
if (x >= signed(getImage()->getWidth()))
setStartImageArea(1,y);
if (TimeLeft() == 0)
{
x = 0;
y = 0;
getStartImageArea(x, y);
x += m_xIncrement;
if (x >= signed(getImage()->getWidth()))
x = 1;
setStartImageArea(x, y);
}
Draw();
}
void cAnimatedSprite::RighttoLeft()
{
if (TimeLeft() == 0)
{
signed long int x = 0;
signed long int y = 0;
getStartImageArea(x, y);
x -= m_xIncrement;
if (x <= 1)
x = getImage()->getWidth() - m_xIncrement;
setStartImageArea(x, y);
}
Draw();
}
///Sets
void cAnimatedSprite::setXIncrement( const unsigned long int x )
{
m_xIncrement = x;
}
void cAnimatedSprite::setYIncrement( const unsigned long int y )
{
m_yIncrement = y;
}
void cAnimatedSprite::setIncrement( const unsigned long int y, const unsigned long int x )
{
m_xIncrement = x;
m_yIncrement = y;
}
void cAnimatedSprite::setFPS( const unsigned long int fps /*= 16*/ )
{
m_fps = fps;
m_RATE = (1000 / m_fps);
m_nextTime = ((unsigned long int)SDL_GetTicks()) + m_RATE;
}
///Gets
const unsigned long int cAnimatedSprite::getXIncrement() const
{
return m_xIncrement;
}
const unsigned long int cAnimatedSprite::getYIncrement() const
{
return m_yIncrement;
}
void cAnimatedSprite::getIncrement( unsigned long int& x, unsigned long int& y ) const
{
x = m_xIncrement;
y = m_yIncrement;
}
const unsigned long int cAnimatedSprite::getFPS() const
{
return m_fps;
}
const unsigned long int cAnimatedSprite::TimeLeft()
{
unsigned long int now = (unsigned long int)SDL_GetTicks();
if(m_nextTime <= now)
{
AddTimeandRate();
return 0;
}
else
return 1;
}
void cAnimatedSprite::AddTimeandRate()
{
m_nextTime += m_RATE;
}
@@ -0,0 +1,16 @@
#include "cPlayer.hpp"
using Equipment::cPlayer;
cPlayer::cPlayer( const cString name )
: m_name(name)
{}
cPlayer::~cPlayer()
{}
///Functions
void cPlayer::Score( const unsigned long int score /*= 1*/ )
{
m_score += score;
}
@@ -0,0 +1,50 @@
#ifndef _CLAYOUT_HPP_
#define _CLAYOUT_HPP_
/*** SDL Header Files ***/
#include <SDL.h>
/*** Custom Header Files ***/
#include "cWindow.hpp"
#include "GUIHelpers/GUIUtility.hpp"
#include "GUIHelpers/Enums.hpp"
/*** DLL Header File ***/
#include "dllExport.h"
/*** Custom Header Files ***/
#include "../UtilityEngine/cString.hpp"
using UtilityEngine::cString;
namespace GUIEngine {
class EXPORT_FROM_MYDLL cLayout : public cWindow
{
public:
static const cString sNAME; /*= "layout";*/
static const GUIHelpers::eOrientation sORIENTATION; /*= GUIHelpers::eOrientation::VERTICAL;*/
cLayout( cWindow* parent = nullptr, const signed int id = -1, const GUIHelpers::eOrientation& orientation = sORIENTATION, const GUIHelpers::eAlign& align = sALIGN,
const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE,
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual ~cLayout();
///Functions
virtual void Create( cWindow* parent, const signed int id, const GUIHelpers::eOrientation& orientation = sORIENTATION, const GUIHelpers::eAlign& align = sALIGN,
const GUIHelpers::eLayout& layout = sLAYOUT, const GUIHelpers::Position& pos = sPOSITION, const GUIHelpers::Size& size = sSIZE,
const GUIHelpers::Padding& padding = sPADDING, const cString& name = sNAME );
virtual void Display();
///Set
///Get
virtual const GUIHelpers::eType getType() const;
private:
GUIHelpers::eOrientation m_orientation;
};/// END CLASS DEFINITION cLayout
}/// END NAMESPACE DEFINITION GUIEngine
#endif/// END IFNDEF _CLAYOUT_HPP_
@@ -0,0 +1,82 @@
#include "iVector2.hpp"
/*** Custom Header File ***/
#include "../Vector/Vector2.hpp"
using MathEngine::iVector2;
using MathEngine::Vector2;
iVector2::iVector2( const int X /*= 0*/, const int Y /*= 0*/ )
: x(X), y(Y)
{}
iVector2::iVector2( const Vector2& copy )
{
x = int(copy.x);
y = int(copy.y);
}
iVector2::iVector2( const SDL_Rect& copy )
{
x = int(copy.x);
y = int(copy.y);
}
iVector2& iVector2::operator = ( const Vector2& copy )
{
x = int(copy.x);
y = int(copy.y);
return *this;
}
iVector2& iVector2::operator = ( const SDL_Rect& copy )
{
x = int(copy.x);
y = int(copy.y);
return *this;
}
bool iVector2::operator == ( const iVector2& other ) const
{
bool rtn = false;
if (x == other.x)
if (y == other.y)
rtn = true;
return rtn;
}
bool iVector2::operator == ( const SDL_Rect& other ) const
{
bool rtn = false;
if (x == other.x)
if (y == other.y)
rtn = true;
return rtn;
}
iVector2& iVector2::operator += ( const iVector2& other )
{
x += int(other.x);
y += int(other.y);
return *this;
}
iVector2& iVector2::operator += ( const SDL_Rect& other )
{
x += int(other.x);
y += int(other.y);
return *this;
}
iVector2 operator + (const iVector2& lhs, const iVector2& rhs)
{
iVector2 rs = lhs;
rs += rhs;
return rs;
}