CHAR* PFFS::gets ( CHAR* buff, /* Pointer to the string buffer to read */ WORD len /* Size of string buffer */ ) { return pf_gets(buff, len); }
void TCredits::Init(TWindowStyle& style) { TWindow::Init(style); mCreditsTime = style.GetInt("time"); mCreditsIntroPause = style.GetInt("intropause"); mColumnGap = style.GetInt("columngap"); mColumnWidth = style.GetInt("columnwidth"); ASSERT(mColumnWidth); ASSERT(mColumnGap); ASSERT(mCreditsTime); mFont = style.GetString( "font",""); mFontSize = (int)style.GetNumber( "fontsize", 16 ); mFontColor = style.GetColor( "fontcolor", white); TColor headerColor = style.GetColor( "headercolor", white); mHeaderColorHex.format("%02x%02x%02x%02x", (int)(headerColor.r * 255), (int)(headerColor.g * 255), (int)(headerColor.b * 255), (int)(headerColor.a * 255)); mCreditsFile = style.GetString("file",""); TFile* fp = pf_open(mCreditsFile.c_str(), kReadText); str col1="\n"; str col2="\n"; str col3="\n"; const int kSize= 1024; char buffer[kSize]; while (pf_gets(fp, buffer, kSize)) { buffer[strlen(buffer)-1]=0; char* sep = strchr(buffer, '|'); if (sep) { *sep= 0; sep++; col1 += CreditLine(buffer, mHeaderColorHex); col2 += CreditLine(sep, mHeaderColorHex); col3 += str("\n"); } else { col1 += str("\n"); col2 += str("\n"); col3 += CreditLine(buffer, mHeaderColorHex); } } pf_close(fp); int space = GetWindowHeight(); for (uint32_t i=0; i<space / mFontSize; i++) { col1 += "\n"; col2 += "\n"; col3 += "\n"; } mText1 = TTextGraphic::Create(col1+col1, mColumnWidth, space, TText::kHAlignCenter, mFont.c_str(), mFontSize, mFontColor); mText2 = TTextGraphic::Create(col2+col2, mColumnWidth, space, TText::kHAlignCenter, mFont.c_str(), mFontSize, mFontColor); mText3 = TTextGraphic::Create(col3+col3, mColumnWidth*2+mColumnGap, space, TText::kHAlignCenter, mFont.c_str(), mFontSize, mFontColor); TRect bounds; mText1->GetTextBounds(&bounds); mHeight = bounds.mY2/2; mStart = 0; StartWindowAnimation(16); }