本文整理汇总了C++中Dialog::AddPausePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Dialog::AddPausePosition方法的具体用法?C++ Dialog::AddPausePosition怎么用?C++ Dialog::AddPausePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dialog
的用法示例。
在下文中一共展示了Dialog::AddPausePosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Dialog
Dialog * Dialog::CreateForString(const string &dialogText, const string &filePath, int timeBeforeDialogInitial, int delayBeforeContinuing, bool isInterrogation, bool isPassive, bool isConfrontation, bool canNavigateBack, bool canNavigateForward, bool presentEvidenceAutomatically, bool canStopPresentingEvidence)
{
Dialog *pDialog = new Dialog(filePath, timeBeforeDialogInitial, delayBeforeContinuing, isInterrogation, isPassive, isConfrontation, canNavigateBack, canNavigateForward, presentEvidenceAutomatically, canStopPresentingEvidence);
double allowedWidth = textAreaRect.GetWidth() - desiredPadding * 2;
string fullString = "";
deque<string> wordList = split(dialogText, ' ');
while (!wordList.empty())
{
string curstring = "";
double curTextWidth = 0;
bool lineDone = false;
bool addSpace = false;
if (fullString.length() > 0)
{
fullString += "\n";
}
while (!lineDone)
{
string stringToTest = (addSpace ? " " : "") + wordList.front();
double curStringWidth = pDialogFont->GetWidth(pDialog->StripEvents(stringToTest));
// If we've got a single word that takes up more than the entire length of the screen,
// then we need to split it up.
if (curTextWidth == 0 && curStringWidth > allowedWidth)
{
string testString = "";
string lastTestString = "";
curStringWidth = 0;
while (curStringWidth <= allowedWidth)
{
if (stringToTest[0] == '{')
{
testString += stringToTest[0];
stringToTest = stringToTest.substr(1);
while (stringToTest[0] != '}')
{
testString += stringToTest[0];
stringToTest = stringToTest.substr(1);
}
testString += stringToTest[0];
stringToTest = stringToTest.substr(1);
}
lastTestString = testString;
testString += stringToTest[0];
double testCurStringWidth = pDialogFont->GetWidth(pDialog->StripEvents(testString));
if (testCurStringWidth > allowedWidth)
{
break;
}
curStringWidth = testCurStringWidth;
stringToTest = stringToTest.substr(1);
}
wordList.insert(wordList.begin() + 1, stringToTest);
stringToTest = lastTestString;
}
if (curTextWidth + curStringWidth <= allowedWidth)
{
string stringToPrependOnNext;
stringToTest = pDialog->ParseEvents(fullString.length() + curstring.length(), stringToTest, &stringToPrependOnNext);
curstring += stringToTest;
curTextWidth += curStringWidth;
wordList.pop_front();
addSpace = true;
if (wordList.empty())
{
lineDone = true;
}
else
{
wordList[0] = stringToPrependOnNext + wordList.front();
}
}
else
{
lineDone = true;
}
}
fullString += curstring;
}
pDialog->SetText(fullString);
if (delayBeforeContinuing >= 0)
{
pDialog->AddPausePosition(fullString.length(), delayBeforeContinuing);
}
//.........这里部分代码省略.........