本文整理汇总了C++中TextObject::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ TextObject::setText方法的具体用法?C++ TextObject::setText怎么用?C++ TextObject::setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextObject
的用法示例。
在下文中一共展示了TextObject::setText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gettextobject
/* Make changes to a text object based on the parameters passed
* in the table in the LUA parameter 2.
*/
void Lua_V1::ChangeTextObject() {
const char *line;
lua_Object textObj = lua_getparam(1);
int paramId = 2;
if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
TextObject *textObject = gettextobject(textObj);
for (;;) {
lua_Object paramObj = lua_getparam(paramId++);
if (!paramObj)
break;
if (!lua_isstring(paramObj)) {
if (!lua_istable(paramObj))
break;
setTextObjectParams(textObject, paramObj);
textObject->reposition();
textObject->destroy();
} else {
line = lua_getstring(paramObj);
textObject->setText(line);
lua_getstring(paramObj);
}
lua_pushnumber(textObject->getBitmapWidth());
lua_pushnumber(textObject->getBitmapHeight());
}
}
}
示例2: handleFrame
void BinkPlayer::handleFrame() {
MoviePlayer::handleFrame();
if (!_showSubtitles || _subtitleIndex == _subtitles.end())
return;
unsigned int startFrame, endFrame, curFrame;
startFrame = _subtitleIndex->_startFrame;
endFrame = _subtitleIndex->_endFrame;
curFrame = _videoDecoder->getCurFrame();
if (startFrame <= curFrame && curFrame <= endFrame) {
if (!_subtitleIndex->active) {
TextObject *textObject = new TextObject();
textObject->setDefaults(&g_grim->_sayLineDefaults);
Color c(255, 255, 255);
textObject->setFGColor(c);
textObject->setIsSpeech();
if (g_grim->getMode() == GrimEngine::SmushMode) {
// TODO: How to center exactly and put the text exactly
// at the bottom even if there are multiple lines?
textObject->setX(640 / 2);
textObject->setY(40);
}
textObject->setText(g_localizer->localize(_subtitleIndex->_textId.c_str()));
g_grim->setMovieSubtitle(textObject);
_subtitleIndex->active = true;
}
} else if (endFrame < curFrame) {
if (_subtitleIndex->active) {
g_grim->setMovieSubtitle(NULL);
_subtitleIndex->active = false;
_subtitleIndex++;
}
}
}
示例3: TextObject
void Lua_V1::BlastText() {
lua_Object textObj = lua_getparam(1);
if (!lua_isstring(textObj)) {
return;
}
const char *line = lua_getstring(textObj);
if (!line || line[0] == 0)
return;
TextObject *textObject = new TextObject(true);
textObject->setDefaults(&g_grim->_blastTextDefaults);
lua_Object tableObj = lua_getparam(2);
if (lua_istable(tableObj))
setTextObjectParams(textObject, tableObj);
textObject->setText(line);
textObject->draw();
delete textObject;
}
示例4: TextObject
void Lua_V1::MakeTextObject() {
lua_Object textObj = lua_getparam(1);
if (!lua_isstring(textObj)) {
return;
}
TextObject *textObject = new TextObject(false);
const char *line = lua_getstring(textObj);
Common::String text = line;
textObject->setDefaults(&g_grim->_blastTextDefaults);
lua_Object tableObj = lua_getparam(2);
if (lua_istable(tableObj))
setTextObjectParams(textObject, tableObj);
textObject->setText(text.c_str());
lua_pushusertag(textObject->getId(), MKTAG('T', 'E', 'X', 'T'));
if (!(g_grim->getGameFlags() & ADGF_DEMO)) {
lua_pushnumber(textObject->getBitmapWidth());
lua_pushnumber(textObject->getBitmapHeight());
}
}
示例5: sayLine
//.........这里部分代码省略.........
if (msgId[0] == 0) {
error("Actor::sayLine: No message ID for text");
return;
}
// During Fullscreen movies SayLine is usually called for text display only.
// The movie with Charlie screaming after Manny put the sheet on him instead
// uses sayLine for the voice too.
// However, normal SMUSH movies may call SayLine, for example:
// When Domino yells at Manny (a SMUSH movie) he does it with
// a SayLine request rather than as part of the movie!
Common::String soundName = id;
if (g_grim->getGameType() == GType_GRIM) {
soundName += ".wav";
} else if (g_grim->getGameType() == GType_MONKEY4 && g_grim->getGamePlatform() == Common::kPlatformPS2) {
soundName += ".scx";
} else {
soundName += ".wVC";
}
if (_talkSoundName == soundName)
return;
if (_talking || msg.empty())
shutUp();
_talkSoundName = soundName;
if (g_grim->getSpeechMode() != GrimEngine::TextOnly) {
_talkDelay = 500;
if (g_sound->startVoice(_talkSoundName.c_str()) && g_grim->getCurrSet()) {
g_grim->getCurrSet()->setSoundPosition(_talkSoundName.c_str(), _pos);
}
}
// If the actor is clearly not visible then don't try to play the lip sync
if (_visible && (!g_movie->isPlaying() || g_grim->getMode() == GrimEngine::NormalMode)) {
Common::String soundLip = id;
soundLip += ".lip";
if (!_talkChore[0].isPlaying()) {
// _talkChore[0] is *_stop_talk
_talkChore[0].setLastFrame();
}
// Sometimes actors speak offscreen before they, including their
// talk chores are initialized.
// For example, when reading the work order (a LIP file exists for no reason).
// Also, some lip sync files have no entries
// In these cases, revert to using the mumble chore.
if (g_grim->getSpeechMode() != GrimEngine::TextOnly)
_lipSync = g_resourceloader->getLipSync(soundLip);
// If there's no lip sync file then load the mumble chore if it exists
// (the mumble chore doesn't exist with the cat races announcer)
if (!_lipSync)
_mumbleChore.playLooping();
_talkAnim = -1;
}
_talking = true;
g_grim->addTalkingActor(this);
_backgroundTalk = background;
if (background)
_isTalkingBackground = true;
if (_sayLineText && g_grim->getMode() != GrimEngine::SmushMode) {
delete TextObject::getPool().getObject(_sayLineText);
_sayLineText = 0;
}
if (!msg.empty()) {
GrimEngine::SpeechMode m = g_grim->getSpeechMode();
if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly)
return;
TextObject *textObject = new TextObject(false, true);
textObject->setDefaults(&g_grim->_sayLineDefaults);
textObject->setFGColor(_talkColor);
if (m == GrimEngine::TextOnly || g_grim->getMode() == GrimEngine::SmushMode) {
textObject->setDuration(500 + msg.size() * 15 * (11 - g_grim->getTextSpeed()));
}
if (g_grim->getMode() == GrimEngine::SmushMode) {
textObject->setX(640 / 2);
textObject->setY(456);
g_grim->setMovieSubtitle(textObject);
} else {
if (_visible && isInSet(g_grim->getCurrSet()->getName())) {
_mustPlaceText = true;
} else {
_mustPlaceText = false;
textObject->setX(640 / 2);
textObject->setY(463);
}
}
textObject->setText(msgId);
if (g_grim->getMode() != GrimEngine::SmushMode)
_sayLineText = textObject->getId();
}
}