本文整理汇总了C++中CListBox::ListBox方法的典型用法代码示例。如果您正苦于以下问题:C++ CListBox::ListBox方法的具体用法?C++ CListBox::ListBox怎么用?C++ CListBox::ListBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CListBox
的用法示例。
在下文中一共展示了CListBox::ListBox方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlayMenuSong
static void PlayMenuSong (void)
{
int h, i;
CStack<char*> m (MAX_NUM_SONGS + 2);
CFile cf;
char szSongTitles [2][14] = {"- Descent 2 -", "- Descent 1 -"};
CListBox lb;
m.Push (szSongTitles [0]);
for (i = 0; i < songManager.TotalCount (); i++) {
if (cf.Open (reinterpret_cast<char*> (songManager.SongData (i).filename), gameFolders.szDataDir, "rb", i >= songManager.Count (0))) {
cf.Close ();
if (i == songManager.Count (0))
m.Push (szSongTitles [1]);
m.Push (songManager.SongData (i).filename);
}
}
for (;;) {
h = lb.ListBox (TXT_SELECT_SONG, m);
if (h < 0)
return;
if (!strstr (m [h], ".hmp"))
continue;
for (i = 0; i < songManager.TotalCount (); i++)
if (songManager.SongData (i).filename == m [h]) {
songManager.Play (i, 0);
return;
}
}
}
示例2: PlayMenuMovie
static void PlayMenuMovie (void)
{
int h, i, j;
CStack<char*> m;
char* ps;
CListBox lb;
i = movieManager.m_nLibs;
for (h = j = 0; j < i; j++)
if (j != 2) //skip robot movies
h += movieManager.m_libs [j].m_nMovies;
if (!h)
return;
if (!m.Create (h))
return;
for (i = j = 0; i < h; i++)
if ((ps = movieManager.Cycle (i == 0, 0))) {
if (j && !strcmp (ps, m [0]))
break;
m.Push (ps);
}
i = lb.ListBox (TXT_SELECT_MOVIE, m);
if (i > -1) {
SDL_ShowCursor (0);
if (strstr (m [i], "intro"))
subTitles.Init ("intro.tex");
else if (strstr (m [i], ENDMOVIE))
subTitles.Init (ENDMOVIE ".tex");
movieManager.Play (m [i], 1, 1, gameOpts->movies.bResize);
subTitles.Close ();
SDL_ShowCursor (1);
}
songManager.PlayCurrent (1);
}
示例3: SelectAndLoadMission
int SelectAndLoadMission (int bMulti, int *bAnarchyOnly)
{
int i, j, nMissions, nDefaultMission, nNewMission = -1;
CStack<char*> msnNames (MAX_MISSIONS);
CListBox lb;
static const char *menuTitles [4];
menuTitles [0] = TXT_NEW_GAME;
menuTitles [1] = TXT_NEW_D1GAME;
menuTitles [2] = TXT_NEW_D2GAME;
menuTitles [3] = TXT_NEW_GAME;
if (bAnarchyOnly)
*bAnarchyOnly = 0;
do {
msnNames.Reset ();
nMissions = BuildMissionList (1, nNewMission);
if (nMissions < 1)
return -1;
nDefaultMission = 0;
for (i = 0; i < nMissions; i++) {
msnNames.Push (gameData.missions.list [i].szMissionName);
j = MsnHasGameVer (msnNames [i]) ? 4 : 0;
if (!stricmp (msnNames [i] + j, gameConfig.szLastMission))
nDefaultMission = i;
}
gameStates.app.nExtGameStatus = bMulti ? GAMESTAT_START_MULTIPLAYER_MISSION : GAMESTAT_SELECT_MISSION;
gameOpts->app.nVersionFilter = NMCLAMP (gameOpts->app.nVersionFilter, 1, 3);
nNewMission = lb.ListBox (bMulti ? TXT_MULTI_MISSION : menuTitles [gameOpts->app.nVersionFilter], msnNames, nDefaultMission);
GameFlushInputs ();
if (nNewMission == -1)
return -1; //abort!
} while (!gameData.missions.list [nNewMission].nDescentVersion);
strcpy (gameConfig.szLastMission, msnNames [nNewMission]);
if (!LoadMission (nNewMission)) {
MsgBox (NULL, NULL, 1, TXT_OK, TXT_MISSION_ERROR);
return -1;
}
gameStates.app.bD1Mission = (gameData.missions.list [nNewMission].nDescentVersion == 1);
gameData.missions.nLastMission = nNewMission;
if (bAnarchyOnly)
*bAnarchyOnly = gameData.missions.list [nNewMission].bAnarchyOnly;
return nNewMission;
}
示例4: LegacyNewGameMenu
void LegacyNewGameMenu (void)
{
int nNewLevel, nHighestPlayerLevel;
int nMissions;
CStack<char*> m (MAX_MISSIONS);
int i, choice = 0, nFolder = -1, nDefaultMission = 0;
CListBox lb;
static int nMission = -1;
static const char *menuTitles [4];
menuTitles [0] = TXT_NEW_GAME;
menuTitles [1] = TXT_NEW_D1GAME;
menuTitles [2] = TXT_NEW_D2GAME;
menuTitles [3] = TXT_NEW_GAME;
gameStates.app.bD1Mission = 0;
gameStates.app.bD1Data = 0;
SetDataVersion (-1);
if ((nMission < 0) || gameOpts->app.bSinglePlayer)
gameFolders.szMsnSubDir [0] = '\0';
hogFileManager.UseMission ("");
do {
nMissions = BuildMissionList (0, nFolder);
if (nMissions < 1)
return;
for (i = 0; i < nMissions; i++) {
m.Push (gameData.missions.list [i].szMissionName);
if (!stricmp (m [i], gameConfig.szLastMission))
nDefaultMission = i;
}
nMission = lb.ListBox (menuTitles [gameOpts->app.nVersionFilter], m, nDefaultMission);
GameFlushInputs ();
if (nMission == -1)
return; //abort!
nFolder = nMission;
}
while (!gameData.missions.list [nMission].nDescentVersion);
strcpy (gameConfig.szLastMission, m [nMission]);
if (!LoadMission (nMission)) {
MsgBox (NULL, NULL, 1, TXT_OK, TXT_ERROR_MSNFILE);
return;
}
gameStates.app.bD1Mission = (gameData.missions.list [nMission].nDescentVersion == 1);
gameData.missions.nLastMission = nMission;
nNewLevel = 1;
PrintLog (" getting highest level allowed to play\n");
nHighestPlayerLevel = GetHighestLevel ();
if (nHighestPlayerLevel > gameData.missions.nLastLevel)
nHighestPlayerLevel = gameData.missions.nLastLevel;
if (nHighestPlayerLevel > 1) {
CMenu m (2);
char szInfo [80];
char szNumber [10];
try_again:
sprintf (szInfo, "%s %d", TXT_START_ANY_LEVEL, nHighestPlayerLevel);
m.AddText (szInfo, 0);
strcpy (szNumber, "1");
m.AddInput (szNumber, 10, "");
choice = m.Menu (NULL, TXT_SELECT_START_LEV);
if ((choice == -1) || !m [1].m_text [0])
return;
nNewLevel = atoi (m [1].m_text);
if ((nNewLevel <= 0) || (nNewLevel > nHighestPlayerLevel)) {
m [0].SetText (const_cast<char*> (TXT_ENTER_TO_CONT));
MsgBox (NULL, NULL, 1, TXT_OK, TXT_INVALID_LEVEL);
goto try_again;
}
}
SavePlayerProfile ();
if (!DifficultyMenu ())
return;
paletteManager.DisableEffect ();
if (!StartNewGame (nNewLevel))
SetFunctionMode (FMODE_MENU);
}