#include "player.h"

CPlayer::CPlayer()
{
    m_XVel = m_YVel = 0;
}

CPlayer::~CPlayer()
{
}

void CPlayer::Update( int deltaT )
{
    float newDest = m_X + m_XVel * ((deltaT)/1000.f);
    if (newDest > 0 && newDest < (640 - m_Sprite->m_DestRect.w))
        m_X = newDest;

    newDest = m_Y + m_YVel * ((deltaT)/1000.f);
    if (newDest > 0 && newDest < (480 - m_Sprite->m_DestRect.h))
        m_Y = newDest;

    m_Sprite->m_X = m_X;
    m_Sprite->m_Y = m_Y;
    m_Sprite->Update( deltaT );
}

void CPlayer::Draw( SDL_Surface* screen )
{
    m_Sprite->Draw( screen );
}
