本文整理汇总了C++中TextWidget::getObjId方法的典型用法代码示例。如果您正苦于以下问题:C++ TextWidget::getObjId方法的具体用法?C++ TextWidget::getObjId怎么用?C++ TextWidget::getObjId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextWidget
的用法示例。
在下文中一共展示了TextWidget::getObjId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitGump
void BarkGump::InitGump(Gump* newparent, bool take_focus)
{
// OK, this is a bit of a hack, but it's how it has to be
int fontnum;
if (owner == 1) fontnum = 6;
else if (owner > 256) fontnum = 8;
else switch (owner%3) {
case 1:
fontnum = 5;
break;
case 2:
fontnum = 7;
break;
default:
fontnum = 0;
break;
}
// This is a hack. We init the gump twice...
ItemRelativeGump::InitGump(newparent, take_focus);
// Create the TextWidget
TextWidget *widget = new TextWidget(0,0,barked,true,fontnum,194,55);
widget->InitGump(this);
textwidget = widget->getObjId();
// see if we need to play speech
AudioProcess *ap = AudioProcess::get_instance();
speechlength = 0;
if (speechshapenum && ap) {
if (ap->playSpeech(barked, speechshapenum, owner)) {
speechlength = ap->getSpeechLength(barked, speechshapenum) / 33;
if (speechlength == 0) speechlength = 1;
// We're playing speech, so need to sync the text with the speech.
// First we count the total height of all text blocks.
Pentagram::Rect d;
widget->GetDims(d);
totaltextheight = d.h;
while (widget->setupNextText()) {
widget->GetDims(d);
totaltextheight += d.h;
}
widget->rewind();
}
}
// This is just a hack
Pentagram::Rect d;
widget->GetDims(d);
if (speechlength && totaltextheight) {
counter = (d.h * speechlength) / totaltextheight;
} else {
counter = d.h * textdelay;
}
dims.h = d.h;
dims.w = d.w;
// Wait with ItemRelativeGump initialization until we calculated our size.
ItemRelativeGump::InitGump(newparent, take_focus);
}