void CCredit::FormatStrings() { float x = (float)m_Pos.x * g_pInterfaceResMgr->GetXRatio(); float y = (float)m_Pos.y * g_pInterfaceResMgr->GetYRatio(); FPStringArray::iterator iter = m_Strings.begin(); while (iter != m_Strings.end()) { CUIFormattedPolyString* pStr = *iter; uint8 nSize = (uint8)(16.0f * g_pInterfaceResMgr->GetXRatio()); if (m_bBig) nSize = (uint8)(24.0f * g_pInterfaceResMgr->GetYRatio()); pStr->SetCharScreenHeight(nSize); pStr->SetColor(argbWhite); pStr->SetAlignmentH(m_hAlign); pStr->SetPosition(x,y); y += (float)pStr->GetHeight(); iter++; } float offset = y - ((float)m_Pos.y * g_pInterfaceResMgr->GetYRatio()); switch (m_ePosition) { case CP_CENTER: offset /= 2.0f; break; case CP_UR: case CP_UL: offset = 0.0f; break; } if (offset > 0.0f) { FPStringArray::iterator iter = m_Strings.begin(); while (iter != m_Strings.end()) { CUIFormattedPolyString* pStr = *iter; float x,y; pStr->GetPosition(&x,&y); y -= offset; pStr->SetPosition(x,y); iter++; } } }
// Build the screen LTBOOL CScreenFailure::Build() { CreateTitle(NULL); if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"FailStringRect")) { stringRect = g_pLayoutMgr->GetScreenCustomRect(SCREEN_ID_FAILURE,"FailStringRect"); } if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"FailStringSize")) { stringSize = (uint8)g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_FAILURE,"FailStringSize"); } if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"HelpStringPos")) { helpPos = g_pLayoutMgr->GetScreenCustomPoint(SCREEN_ID_FAILURE,"HelpStringPos"); } if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"HelpStringSize")) { helpSize = (uint8)g_pLayoutMgr->GetScreenCustomInt(SCREEN_ID_FAILURE,"HelpStringSize"); } LTIntPt stringPos; stringPos.x = (stringRect.left + stringRect.right) / 2; stringPos.y = stringRect.top; m_pString = AddTextItem("failed",NULL,NULL,stringPos,LTTRUE); if (m_pString) { m_pString->SetFont(NULL,stringSize); m_pString->SetFixedWidth(stringRect.right - stringRect.left); CUIFormattedPolyString *pStr = m_pString->GetString(); if (pStr) { pStr->SetAlignmentH(CUI_HALIGN_CENTER); } } if (g_pLayoutMgr->HasCustomValue(SCREEN_ID_FAILURE,"Delay")) { g_fDelay = g_pLayoutMgr->GetScreenCustomFloat(SCREEN_ID_FAILURE,"Delay"); } CLTGUITextCtrl *pString = AddTextItem(IDS_HELP_FAILURE,NULL,NULL,helpPos,LTTRUE); if (pString) { pString->SetFont(NULL,helpSize); } // Make sure to call the base class if (! CBaseScreen::Build()) return LTFALSE; UseBack(LTFALSE); return LTTRUE; }