本文整理汇总了C++中FontPtr::drawText方法的典型用法代码示例。如果您正苦于以下问题:C++ FontPtr::drawText方法的具体用法?C++ FontPtr::drawText怎么用?C++ FontPtr::drawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FontPtr
的用法示例。
在下文中一共展示了FontPtr::drawText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void MarkupBase::render(const Rect& finalRect, const Rect& finalClip)
{
size_t len = m_text.length();
std::vector<PTextLine>::const_iterator i = m_textlines.begin();
std::vector<PTextLine>::const_iterator end = m_textlines.end();
while(i != end)
{
const TextLine* line = (*i).get();
size_t offset = line->start;
Rect rl(line->area);
std::vector<PText>::const_iterator c = line->children.begin();
std::vector<PText>::const_iterator stop = line->children.end();
while(c != stop)
{
const Text* chunk = (*c).get();
if(chunk->len > 0 && chunk->len <= len)
{
FontPtr f = chunk->font;
Color col = chunk->selected ? chunk->selcol : chunk->col;
std::string buf = m_text.substr(chunk->start + offset, chunk->len);
Rect rc(chunk->area);
rc.offset(rl.getPosition());
rc.offset(finalRect.getPosition());
f->drawText(buf, rc, 1.0f, finalClip, LeftAligned, col, 1.f, 1.f);
}
++c;
}
++i;
}
Renderer& r = m_system.getRenderer();
std::vector<PImg>::const_iterator cimg = m_images.begin();
std::vector<PImg>::const_iterator cimgend = m_images.end();
while(cimg != cimgend)
{
const Img* img = (*cimg).get();
Rect rc(img->area);
rc.offset(finalRect.getPosition());
if (img->img)
{
r.draw(*img->img, rc, 1.f, finalClip, m_backColor, Stretch, Stretch);
}
++cimg;
}
}