本文整理汇总了C++中TextRenderer::drawWrappedString方法的典型用法代码示例。如果您正苦于以下问题:C++ TextRenderer::drawWrappedString方法的具体用法?C++ TextRenderer::drawWrappedString怎么用?C++ TextRenderer::drawWrappedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextRenderer
的用法示例。
在下文中一共展示了TextRenderer::drawWrappedString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: header
/*static*/ void Overlay::doDrawInfoPage(const EglWindow& window,
const Program& texProgram, TextRenderer& textRenderer) {
const nsecs_t holdTime = 250000000LL;
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
int width = window.getWidth();
int height = window.getHeight();
// Draw a thin border around the screen. Some players, e.g. browser
// plugins, make it hard to see where the edges are when the device
// is using a black background, so this gives the viewer a frame of
// reference.
//
// This is a clumsy way to do it, but we're only doing it for one frame,
// and it's easier than actually drawing lines.
const int lineWidth = 4;
glEnable(GL_SCISSOR_TEST);
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
glScissor(0, 0, width, lineWidth);
glClear(GL_COLOR_BUFFER_BIT);
glScissor(0, height - lineWidth, width, lineWidth);
glClear(GL_COLOR_BUFFER_BIT);
glScissor(0, 0, lineWidth, height);
glClear(GL_COLOR_BUFFER_BIT);
glScissor(width - lineWidth, 0, lineWidth, height);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
//glEnable(GL_BLEND);
//glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
textRenderer.setProportionalScale(30);
float xpos = 0;
float ypos = 0;
ypos = textRenderer.drawWrappedString(texProgram, xpos, ypos,
String8::format("Android screenrecord v%d.%d",
kVersionMajor, kVersionMinor));
// Show date/time
time_t now = time(0);
struct tm tm;
localtime_r(&now, &tm);
char timeBuf[64];
strftime(timeBuf, sizeof(timeBuf), "%a, %d %b %Y %T %z", &tm);
String8 header("Started ");
header += timeBuf;
ypos = textRenderer.drawWrappedString(texProgram, xpos, ypos, header);
ypos += 8 * textRenderer.getScale(); // slight padding
// Show selected system property values
for (int i = 0; i < NELEM(kPropertyNames); i++) {
char valueBuf[PROPERTY_VALUE_MAX];
property_get(kPropertyNames[i], valueBuf, "");
if (valueBuf[0] == '\0') {
continue;
}
String8 str(String8::format("%s: [%s]", kPropertyNames[i], valueBuf));
ypos = textRenderer.drawWrappedString(texProgram, xpos, ypos, str);
}
ypos += 8 * textRenderer.getScale(); // slight padding
// Show GL info
String8 glStr("OpenGL: ");
glStr += (char*) glGetString(GL_VENDOR);
glStr += " / ";
glStr += (char*) glGetString(GL_RENDERER);
glStr += ", ";
glStr += (char*) glGetString(GL_VERSION);
ypos = textRenderer.drawWrappedString(texProgram, xpos, ypos, glStr);
//glDisable(GL_BLEND);
// Set a presentation time slightly in the past. This will cause the
// player to hold the frame on screen.
window.presentationTime(systemTime(CLOCK_MONOTONIC) - holdTime);
window.swapBuffers();
}