本文整理汇总了C++中Paragraph::updateLines方法的典型用法代码示例。如果您正苦于以下问题:C++ Paragraph::updateLines方法的具体用法?C++ Paragraph::updateLines怎么用?C++ Paragraph::updateLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paragraph
的用法示例。
在下文中一共展示了Paragraph::updateLines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void LLConsole::draw()
{
LLGLSUIDefault gls_ui;
{
LLMutexLock lock(&mQueueMutex);
for(paragraph_t::iterator paragraph_it = mNewParagraphs.begin(); paragraph_it != mNewParagraphs.end(); paragraph_it++)
{
Paragraph* paragraph = *paragraph_it;
mParagraphs.push_back(paragraph);
paragraph->updateLines((F32)getRect().getWidth(), mFont);
}
mNewParagraphs.clear();
}
if (mParagraphs.empty()) //No text to draw.
{
return;
}
// skip lines added more than mLinePersistTime ago
F32 cur_time = mTimer.getElapsedTimeF32();
F32 skip_time = cur_time - mLinePersistTime;
F32 fade_time = cur_time - mFadeTime;
static LLCachedControl<S32> max_lines(gSavedSettings, "ConsoleMaxLines");
U32 num_lines = 0;
paragraph_t::reverse_iterator paragraph_it;
paragraph_it = mParagraphs.rbegin();
U32 paragraph_num=mParagraphs.size();
while (!mParagraphs.empty() && paragraph_it != mParagraphs.rend())
{
num_lines += (*paragraph_it)->mLines.size();
if(num_lines > max_lines
|| ( (mLinePersistTime > (F32)0.f) && ((*paragraph_it)->mAddTime - skip_time)/(mLinePersistTime - mFadeTime) <= (F32)0.f))
{ //All lines above here are done. Lose them.
for (U32 i=0;i<paragraph_num;i++)
{
if (!mParagraphs.empty())
{
Paragraph* paragraph = mParagraphs.front();
mParagraphs.pop_front();
delete paragraph;
}
}
break;
}
paragraph_num--;
paragraph_it++;
}
if (mParagraphs.empty())
{
return;
}
// draw remaining lines
F32 y_pos = 0.f;
LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
static LLCachedControl<F32> console_background_opacity(gSavedSettings, "ConsoleBackgroundOpacity");
F32 console_opacity = llclamp((F32)console_background_opacity, 0.f, 1.f);
static LLCachedControl<LLColor4U> console_background(gColors, "ConsoleBackground");
LLColor4 color = LLColor4(console_background);
color.mV[VALPHA] *= console_opacity;
F32 line_height = mFont->getLineHeight();
S32 message_spacing = 0;
//080813 Spatters: This section makes a single huge black box behind all the text.
S32 bkg_height=8;
S32 bkg_width=0;
// VWR-8999
// ChatSpacing: 0 -- chat lines are close together, as they were in the 1.20 viewer.
// 4 -- chat lines are farther apart as they are in SnowGlobe 1.4.
static LLCachedControl<S32> chat_spacing(gSavedSettings, "ChatSpacing");
// Perform clamping.
S32 const clamped_chat_spacing = llclamp((S32)chat_spacing, -16, 128);
if (chat_spacing != clamped_chat_spacing)
{
gSavedSettings.setS32("ChatSpacing", clamped_chat_spacing);
}
// Adjust spacing.
message_spacing += chat_spacing;
bkg_height -= chat_spacing;
for(paragraph_it = mParagraphs.rbegin(); paragraph_it != mParagraphs.rend(); paragraph_it++)
{
S32 target_height = llfloor( (*paragraph_it)->mLines.size() * line_height + message_spacing);
S32 target_width = llfloor( (*paragraph_it)->mMaxWidth + CONSOLE_GUTTER_RIGHT);
bkg_height+= target_height;
if (target_width > bkg_width)
{
//.........这里部分代码省略.........