Exemplo n.º 1
0
void CStatBox::Draw(CSurface* display,int x,int y)
{
    CSurface* line;
    int drawy = y;
    for(int i = 0; i<lines->size(); i++)
    {
        line = lines->at(i);
        if(line != NULL)
        {
            line->Draw(display,x,drawy);
            drawy += line->GetHeight() + STATBOX_LINE_PADDING;
        }
    }
}
Exemplo n.º 2
0
int CStatBox::CalcHeight()
{
    //find sum of line heights, plus padding
    int height = 0;
    CSurface* line;
    for(int i = 0; i<lines->size(); i++)
    {
        line = lines->at(i);

        if(line != NULL)
        {
            height += line->GetHeight();
        }
    }
    height += (lines->size() - 1) * STATBOX_LINE_PADDING;
    return height;
}
Exemplo n.º 3
0
bool CTgaWriter::Write(const std::string& fileName, CSurface& surface)
{

	m_FileName=fileName;
	//file = IGenericFile::Open(fileName.c_str(), IGenericFile::OPEN_READ | IGenericFile::OPEN_BINARY | IGenericFile::OPEN_STANDALONE, false, true);
	m_File.open(fileName.c_str(),std::ios::out|std::ios::binary);
	if(!m_File)return false;

	memset(&m_Header,0,sizeof(m_Header));
	

	m_Header.Width=surface.GetWidth();
	m_Header.Height=surface.GetHeight();
	m_Header.Bits=surface.GetDepth()<<3;

	if(surface.GetFormat()==CSurface::EFormat_A8R8G8B8 || surface.GetFormat()==CSurface::EFormat_R8G8B8 || surface.GetFormat()==CSurface::EFormat_X8R8G8B8){
		m_Header.ImageType=2;
	}else if(surface.GetFormat()==CSurface::EFormat_S8){
		m_Header.ImageType=3;
	}


	// Write header
	m_Header.Write(m_File);
	if(!m_File)return false;

	// Write data
	m_File.write((char*)surface.GetDataPointer(),surface.GetSize());

	// Close and bail out
	if(!m_File)return false;
	m_File.close();
	return true;


}