本文整理汇总了C++中TextObject::setY方法的典型用法代码示例。如果您正苦于以下问题:C++ TextObject::setY方法的具体用法?C++ TextObject::setY怎么用?C++ TextObject::setY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextObject
的用法示例。
在下文中一共展示了TextObject::setY方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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++;
}
}
}
示例2: sayLine
void Actor::sayLine(const char *msgId, bool background) {
assert(msgId);
char id[50];
Common::String msg = LuaBase::instance()->parseMsgText(msgId, id);
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);
}
//.........这里部分代码省略.........
示例3: draw
void Actor::draw() {
for (Common::List<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
Costume *c = *i;
c->setupTextures();
}
if (!g_driver->isHardwareAccelerated() && g_grim->getFlagRefreshShadowMask()) {
for (int l = 0; l < MAX_SHADOWS; l++) {
if (!_shadowArray[l].active)
continue;
g_driver->setShadow(&_shadowArray[l]);
g_driver->drawShadowPlanes();
g_driver->setShadow(NULL);
}
}
// FIXME: if isAttached(), factor in the joint & actor rotation as well.
Math::Vector3d absPos = getWorldPos();
if (!_costumeStack.empty()) {
g_grim->getCurrSet()->setupLights(absPos);
Costume *costume = _costumeStack.back();
for (int l = 0; l < MAX_SHADOWS; l++) {
if (!shouldDrawShadow(l))
continue;
g_driver->setShadow(&_shadowArray[l]);
g_driver->setShadowMode();
if (g_driver->isHardwareAccelerated())
g_driver->drawShadowPlanes();
g_driver->startActorDraw(absPos, _scale, _yaw, _pitch, _roll, _inOverworld, _alphaMode != AlphaOff ? _globalAlpha : 1.f);
costume->draw();
g_driver->finishActorDraw();
g_driver->clearShadowMode();
g_driver->setShadow(NULL);
}
bool isShadowCostume = costume->getFilename().equals("fx/dumbshadow.cos");
if (!isShadowCostume || _shadowActive) {
// normal draw actor
g_driver->startActorDraw(absPos, _scale, _yaw, _pitch, _roll, _inOverworld, _alphaMode != AlphaOff ? _globalAlpha : 1.f);
costume->draw();
g_driver->finishActorDraw();
}
}
if (_mustPlaceText) {
int x1, y1, x2, y2;
x1 = y1 = 1000;
x2 = y2 = -1000;
if (!_costumeStack.empty()) {
g_driver->startActorDraw(absPos, _scale, _yaw, _pitch, _roll, _inOverworld, 1.f);
_costumeStack.back()->getBoundingBox(&x1, &y1, &x2, &y2);
g_driver->finishActorDraw();
}
TextObject *textObject = TextObject::getPool().getObject(_sayLineText);
if (textObject) {
if (x1 == 1000 || x2 == -1000 || y2 == -1000) {
textObject->setX(640 / 2);
textObject->setY(463);
} else {
textObject->setX((x1 + x2) / 2);
textObject->setY(y1);
}
textObject->reset();
}
_mustPlaceText = false;
}
}