#include "EntSplash.h"
#include "GameLogic.h"


EntSplash::EntSplash()
{
    SetType(C_TYPE_UNKNOWN);
     m_sprite = NULL;
    Init();
    SetSort(2100);
    m_SlotKeyDown = CL_Keyboard::sig_key_down().connect( this, &EntSplash::OnKeyDown);
   
}


void EntSplash::OnKeyDown(const CL_InputEvent &key)
{
 
    GetGameLogic->GetMessageDispatcher()->SendMsg(C_MESSAGE_INIT_NEW_GAME, 0, NULL);
    SetDeleteFlag(true) ;
}


EntSplash::~EntSplash()
{
    SAFE_DELETE(m_sprite);
}

bool EntSplash::Init()
{
    //setup stuff
    m_sprite = new CL_Surface("media/title.jpg");
    return true; //success
}


void EntSplash::OnMessage(Message &msg)
{
   
    Entity::OnMessage(msg);
}


void EntSplash::Render()
{
    m_sprite->set_alpha(m_alpha);
    m_sprite->draw(m_vPosition.x, m_vPosition.y);
}


void EntSplash::Update(float step)
{
    Entity::Update(step);
    
}
