本文整理汇总了C++中Text::centerTextX方法的典型用法代码示例。如果您正苦于以下问题:C++ Text::centerTextX方法的具体用法?C++ Text::centerTextX怎么用?C++ Text::centerTextX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Text
的用法示例。
在下文中一共展示了Text::centerTextX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void ChoiceText::render(Screen *screen) {
GameData *gameData = GameData::getInstance();
float posy;
posy = pos.y;
int start, end;
if(texts.size() > 2) {
start = currentChoice - 1;
end = currentChoice + 1;
if(start < 0) {
start++;
end++;
}
if(end > (int)texts.size() - 1) {
start--;
end--;
}
} else if(texts.size() == 2) {
start = 0;
end = 1;
} else {
start = 0;
end = 0;
}
for(std::vector<Text*>::iterator it = texts.begin() + start; it != texts.begin() + end + 1; ++it) {
Text* text = *it;
text->pos.y = posy;
text->centerTextX();
text->render(screen);
posy += 20;
}
Text *currentText = texts.at(mouseCurrentChoice);
Rectangle rectSelection = Rectangle(currentText->pos.x - 3,
currentText->pos.y - 3,
currentText->rect.w + 6,
currentText->rect.h + 6);
Sprite::drawRoundRectNoScrolling(rectSelection, 255, 255, 255, selectorAlpha, 100, screen);
if(texts.size() > 2) {
Vector2 posSetaRef;
posSetaRef.x = gameData->resWidth/2;
if(currentChoice > 1) {
posSetaRef.y = pos.y - 3;
Sprite::drawTriangleNoScrolling(Vector2(posSetaRef.x - 2, posSetaRef.y),
Vector2(posSetaRef.x + 2, posSetaRef.y), Vector2(posSetaRef.x, posSetaRef.y - 2),
255, 255, 255, selectorAlpha, screen);
}
if(currentChoice < (int)texts.size() - 2) {
posSetaRef.y = pos.y + 63;
Sprite::drawTriangleNoScrolling(Vector2(posSetaRef.x - 2, posSetaRef.y),
Vector2(posSetaRef.x + 2, posSetaRef.y), Vector2(posSetaRef.x, posSetaRef.y + 2),
255, 255, 255, selectorAlpha, screen);
}
}
}