本文整理汇总了C++中CList::Flush方法的典型用法代码示例。如果您正苦于以下问题:C++ CList::Flush方法的具体用法?C++ CList::Flush怎么用?C++ CList::Flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CList
的用法示例。
在下文中一共展示了CList::Flush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IOReadList
void CScreenIO::IOReadList(bool isWrite)
{
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if (pw == nullptr) return;
CList* pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
if (pl == nullptr) return;
pl->Flush();
m_saveList.clear();
for(const SavedScene& save : m_main->GetPlayerProfile()->GetSavedSceneList())
{
pl->SetItemName(m_saveList.size(), save.name);
m_saveList.push_back(save.path);
}
// invalid index
if ( isWrite )
{
std::string nameStr;
GetResource(RES_TEXT, RT_IO_NEW, nameStr);
pl->SetItemName(m_saveList.size(), nameStr);
}
pl->SetSelect(m_saveList.size());
pl->ShowSelect(false); // shows the selected columns
for (unsigned int i = 0; i < m_saveList.size(); i++)
{
m_engine->DeleteTexture(m_saveList.at(i) + "/screen.png");
}
}
示例2: ReadNameList
void CScreenPlayerSelect::ReadNameList()
{
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if (pw == nullptr) return;
CList* pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
if (pl == nullptr) return;
pl->Flush();
auto players = CPlayerProfile::GetPlayerList();
for (int i = 0; i < static_cast<int>(players.size()); ++i)
{
pl->SetItemName(i, players.at(i));
}
}
示例3: UpdateSceneList
void CScreenLevelList::UpdateSceneList(int chap, int &sel)
{
CWindow* pw;
CList* pl;
std::string fileName;
char line[500] = {0};
int j;
bool bPassed;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LIST));
if ( pl == nullptr ) return;
pl->Flush();
bool readAll = true;
for ( j=0 ; j<MAXSCENE ; j++ )
{
CLevelParser levelParser(m_category, chap+1, j+1);
if (!levelParser.Exists())
{
readAll = true;
break;
}
else
{
if (!readAll)
break;
}
try
{
levelParser.Load();
sprintf(line, "%d: %s", j+1, levelParser.Get("Title")->GetParam("text")->AsString().c_str());
}
catch (CLevelParserException& e)
{
sprintf(line, "%s", (std::string("[ERROR]: ")+e.what()).c_str());
}
bPassed = m_main->GetPlayerProfile()->GetLevelPassed(m_category, chap+1, j+1);
pl->SetItemName(j, line);
pl->SetCheck(j, bPassed);
pl->SetEnable(j, true);
if ( m_category == LevelCategory::Missions && !m_main->GetShowAll() && !bPassed )
{
readAll = false;
}
}
if (readAll)
{
m_maxList = j;
}
else
{
m_maxList = j+1; // this is not the last!
}
if ( sel > j-1 ) sel = j-1;
pl->SetSelect(sel);
pl->ShowSelect(false); // shows the selected columns
}
示例4: UpdateSceneChap
void CScreenLevelList::UpdateSceneChap(int &chap)
{
CWindow* pw;
CList* pl;
std::string fileName;
char line[500] = {0};
bool bPassed;
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
if ( pw == nullptr ) return;
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_CHAP));
if ( pl == nullptr ) return;
pl->Flush();
int j;
if ( m_category == LevelCategory::CustomLevels )
{
UpdateCustomLevelList();
for ( j=0 ; j < static_cast<int>(m_customLevelList.size()) ; j++ )
{
try
{
CLevelParser levelParser("custom", j+1, 0);
levelParser.Load();
pl->SetItemName(j, levelParser.Get("Title")->GetParam("text")->AsString());
pl->SetEnable(j, true);
}
catch (CLevelParserException& e)
{
pl->SetItemName(j, std::string("[ERROR]: ")+e.what());
pl->SetEnable(j, false);
}
}
}
else
{
for ( j=0 ; j<MAXSCENE ; j++ )
{
CLevelParser levelParser(m_category, j+1, 0);
if (!levelParser.Exists())
break;
try
{
levelParser.Load();
sprintf(line, "%d: %s", j+1, levelParser.Get("Title")->GetParam("text")->AsString().c_str());
}
catch (CLevelParserException& e)
{
sprintf(line, "%s", (std::string("[ERROR]: ")+e.what()).c_str());
}
bPassed = m_main->GetPlayerProfile()->GetLevelPassed(m_category, j+1, 0);
pl->SetItemName(j, line);
pl->SetCheck(j, bPassed);
pl->SetEnable(j, true);
if ( m_category == LevelCategory::Missions && !m_main->GetShowAll() && !bPassed )
{
j ++;
break;
}
if ( m_category == LevelCategory::FreeGame && j == m_accessChap )
{
j ++;
break;
}
}
}
if ( chap > j-1 ) chap = j-1;
pl->SetSelect(chap);
pl->ShowSelect(false); // shows the selected columns
}