#include "CFrame.h"
#include "CGraphicSystem.h"
#include <stdio.h>

//----------------------------------------------------------------//
//	Constructor/Deconstructor
//----------------------------------------------------------------//

CFrame::CFrame()
{
	m_Image=NULL;
	m_Displacement.x=0;
	m_Displacement.y=0;

}

CFrame::~CFrame()
{

}

void CFrame::Init(STRINGC line)
{
	/*Example line:
	frame1.bmp 25 5 5 		
	*/

	

	//this is kind of a cheesy way of doing this. oh well.
	
	STRINGC fileName;
	int x,y,delay;
	fileName.CopyUpTo(line, ' ');			

	STRINGC numbers = line.RightStr(line.Len() - line.CountUntil(' ') -1);	
	sscanf(numbers.GetString(),"%i %i %i",&delay,&x,&y);

	m_Image = g_GraphicSystem.LoadCImage(fileName);
	m_Displacement.x = x;
	m_Displacement.y = y;	
	m_Delay = delay;
	
}