本文整理汇总了C++中TextRenderer类的典型用法代码示例。如果您正苦于以下问题:C++ TextRenderer类的具体用法?C++ TextRenderer怎么用?C++ TextRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RedrawTextRenderer
static void RedrawTextRenderer(TextRenderer& txt_rndr, RectListRgn& r_lst, bool delayed)
{
delayed ?
txt_rndr.DrawForRegionDelayed(r_lst)
:
txt_rndr.DrawForRegion(r_lst);
}
示例2: UpdateScore
void UpdateScore(const unsigned int updated, TextRenderer &textRenderer,
std::vector<std::string> &strVec)
{
textRenderer.RemoveText(*(strVec.begin() + 1));
(*(strVec.begin() + 1)) = std::to_string(updated);
textRenderer.AddTextVerticalAlign(strVec, TextRenderer::Alignment::Right,
TextRenderer::Alignment::Top, 20);
}
示例3: RedrawText
void RedrawText(TextRenderer& txt_rndr, bool delayed)
{
RectListRgn r_lst;
r_lst.push_back(txt_rndr.CalcCursorPlc());
r_lst.push_back(txt_rndr.CalcTextPlc());
//txt_rndr.DrawForRegion(r_lst);
RedrawTextRenderer(txt_rndr, r_lst, delayed);
}
示例4: copySelectionOrAllToClipboard
void PediaMainForm::copySelectionOrAllToClipboard()
{
TextRenderer* renderer = &infoRenderer_;
if (showArticle == displayMode_)
renderer = &articleRenderer_;
if (renderer->empty())
return;
String text;
renderer->copySelectionOrAll();
}
示例5: UpdateLives
bool UpdateLives(unsigned int &lives, TextRenderer &textRenderer,
std::vector<std::string> &strVec)
{
textRenderer.RemoveText(*(strVec.begin() + 1));
(*(strVec.begin() + 1)) = std::to_string(lives);
textRenderer.AddTextHorizontalAlign(strVec, TextRenderer::Alignment::Right,
TextRenderer::Alignment::Bottom, 20);
if(lives == 0)
return true;
return false;
}
示例6: TextRenderer
//---------------------------------------------------------------------------
void Choice::addItem(const std::string& item)
{
choiceList.push_back(item);
TextRenderer *t = new TextRenderer(item.c_str());
choice_renders.push_back(t);
int borderSpace = 12 * 2; // was border size
rect.setSize(std::max( (t->getWidth() + borderSpace), rect.getWidth()),
TextRenderingSystem::line_height() );
}
示例7: QueryPerformanceCounter
void TestComponent::FixedUpdate()
{
//m_transform.m_position += float2(time::GetDeltaTime(), time::GetDeltaTime()) * 100.0f;
LARGE_INTEGER li = m_lastUpdate;
QueryPerformanceCounter(&m_lastUpdate);
float fups = 1.0f / ((float)(m_lastUpdate.QuadPart - li.QuadPart) / (float)(m_ticksPS.QuadPart));
TextRenderer* t = (TextRenderer*)m_gameObject.GetComponent(TEXT_RENDERER);
//m_transform.position = float2(10.f, 10.0f);
char str[64];
sprintf_s(str, "FUPS: %f ####", fups);
t->SetString(str);
}
示例8: SetTimer
void PendingCursor::SetTimer(TextRenderer& txt_rndr)
{
Data& dat = (Data&)txt_rndr;
BoolFnr fnr = bb::bind(&PendingCursor::OnTimeout, this, &txt_rndr);
dat.timer.Connect( fnr, int(CURSOR_PEND_PART*txt_rndr.CursBlinkTime()) );
}
示例9: yei_tareSensors
void PrioVR::renderCalibrationCountdown() {
#ifdef HAVE_PRIOVR
const int COUNTDOWN_SECONDS = 3;
int secondsRemaining = COUNTDOWN_SECONDS - _calibrationCountdownStarted.secsTo(QDateTime::currentDateTime());
if (secondsRemaining == 0) {
yei_tareSensors(_skeletalDevice);
Application::getInstance()->disconnect(this);
return;
}
static TextRenderer textRenderer(MONO_FONT_FAMILY, 18, QFont::Bold, false, TextRenderer::OUTLINE_EFFECT, 2);
QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "...";
textRenderer.draw((Application::getInstance()->getGLWidget()->width() - textRenderer.computeWidth(text.constData())) / 2,
Application::getInstance()->getGLWidget()->height() / 2,
text);
#endif
}
示例10: InitGUI
//--------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------
void InitGUI()
{
// Initialize dialogs
g_SettingsDlg.Init(&g_DialogResourceManager);
g_HUD.Init(&g_DialogResourceManager);
g_HUD.SetCallback(OnGUIEvent);
g_TextRenderer.Init(&g_DialogResourceManager);
int iY = 10;
g_HUD.AddButton (IDC_TOGGLEFULLSCREEN, L"Toggle full screen" , 35, iY, 160, 22);
g_HUD.AddButton (IDC_TOGGLEREF, L"Toggle REF (F3)" , 35, iY += 24, 160, 22, VK_F3);
g_HUD.AddButton (IDC_CHANGEDEVICE, L"Change device (F2)" , 35, iY += 24, 160, 22, VK_F2);
iY += 20;
g_HUD.AddCheckBox(IDC_DEINTERLEAVE, L"Deinterleaved Texturing", 35, iY += 28, 125, 22, g_UseDeinterleavedTexturing);
g_HUD.AddCheckBox(IDC_RANDOMIZE, L"Randomize Samples", 35, iY += 28, 125, 22, g_RandomizeSamples);
g_HUD.AddCheckBox(IDC_BLUR_AO, L"Blur AO", 35, iY += 28, 125, 22, g_BlurAO);
iY += 24;
CDXUTComboBox *pComboBox;
g_HUD.AddComboBox(IDC_CHANGESCENE, 35, iY += 24, 160, 22, 'M', false, &pComboBox);
for (int i = 0; i < ARRAYSIZE(g_MeshDesc); i++)
{
pComboBox->AddItem(g_MeshDesc[i].Name, NULL);
}
iY += 24;
WCHAR sz[100];
int dy = 20;
StringCchPrintf(sz, 100, UI_RADIUS_MULT L"%0.2f", g_AOParams.Radius);
g_HUD.AddStatic(IDC_RADIUS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_RADIUS_SLIDER, 50, iY += dy, 100, 22, 0, 100, int(g_AOParams.Radius / MAX_RADIUS_MULT * 100));
StringCchPrintf(sz, 100, UI_AO_BIAS L"%g", g_AOParams.Bias);
g_HUD.AddStatic(IDC_BIAS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_BIAS_SLIDER, 50, iY += dy, 100, 22, 0, 500, int(g_AOParams.Bias * 1000));
StringCchPrintf(sz, 100, UI_POW_EXPONENT L"%0.2f", g_AOParams.PowerExponent);
g_HUD.AddStatic(IDC_EXPONENT_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_EXPONENT_SLIDER, 50, iY += dy, 100, 22, 0, 400, (int)(100.0f*g_AOParams.PowerExponent));
StringCchPrintf(sz, 100, UI_BLUR_SHARPNESS L"%0.2f", g_AOParams.Blur.Sharpness);
g_HUD.AddStatic(IDC_BLUR_SHARPNESS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_BLUR_SHARPNESS_SLIDER, 50, iY += dy, 100, 22, 0, 1600, (int)(100.0f*g_AOParams.Blur.Sharpness));
UINT ButtonGroup = 0;
iY += 24;
g_HUD.AddRadioButton( IDC_1xMSAA, ButtonGroup, L"1X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_1X) );
g_HUD.AddRadioButton( IDC_2xMSAA, ButtonGroup, L"2X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_2X) );
g_HUD.AddRadioButton( IDC_4xMSAA, ButtonGroup, L"4X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_4X) );
g_HUD.AddRadioButton( IDC_8xMSAA, ButtonGroup, L"8X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_8X) );
++ButtonGroup;
iY += 24;
g_HUD.AddRadioButton( IDC_PER_PIXEL_AO, ButtonGroup, L"PER_PIXEL_AO", 35, iY += 24, 125, 22, (g_AOParams.Output.MSAAMode == GFSDK_SSAO_PER_PIXEL_AO) );
g_HUD.AddRadioButton( IDC_PER_SAMPLE_AO, ButtonGroup, L"PER_SAMPLE_AO", 35, iY += 24, 125, 22, (g_AOParams.Output.MSAAMode == GFSDK_SSAO_PER_SAMPLE_AO) );
}
示例11: getBackgroundColor
void TextOverlay::render(RenderArgs* args) {
if (!_visible) {
return; // do nothing if we're not visible
}
const float MAX_COLOR = 255.0f;
xColor backgroundColor = getBackgroundColor();
glColor4f(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR,
getBackgroundAlpha());
int left = _bounds.left();
int right = _bounds.right() + 1;
int top = _bounds.top();
int bottom = _bounds.bottom() + 1;
glm::vec2 topLeft(left, top);
glm::vec2 bottomRight(right, bottom);
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight);
// Same font properties as textSize()
TextRenderer* textRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY, _fontSize, DEFAULT_FONT_WEIGHT);
const int leftAdjust = -1; // required to make text render relative to left edge of bounds
const int topAdjust = -2; // required to make text render relative to top edge of bounds
int x = _bounds.left() + _leftMargin + leftAdjust;
int y = _bounds.top() + _topMargin + topAdjust;
glColor3f(_color.red / MAX_COLOR, _color.green / MAX_COLOR, _color.blue / MAX_COLOR);
float alpha = getAlpha();
QStringList lines = _text.split("\n");
int lineOffset = 0;
foreach(QString thisLine, lines) {
if (lineOffset == 0) {
lineOffset = textRenderer->calculateHeight(qPrintable(thisLine));
}
lineOffset += textRenderer->draw(x, y + lineOffset, qPrintable(thisLine), alpha);
const int lineGap = 2;
lineOffset += lineGap;
}
}
示例12: _maketextures
void NumberLabel::_maketextures()
{
if(_num_objects==0) {
cout << "make tex" << endl;
_textures = new Texture[NUMBERLABEL_NUM_TEX];
const char chars[] = NUMBERLABEL_CHARS;
TextRenderer render;
for( int i=0; i<NUMBERLABEL_NUM_TEX; ++i ) {
stringstream s;
s << chars[i];
render.Text2Texture( _textures[i], s.str());
}
}
_num_objects++;
}
示例13: glViewport
/*static*/ status_t Overlay::drawInfoPage(
const sp<IGraphicBufferProducer>& outputSurface) {
status_t err;
EglWindow window;
err = window.createWindow(outputSurface);
if (err != NO_ERROR) {
return err;
}
window.makeCurrent();
int width = window.getWidth();
int height = window.getHeight();
glViewport(0, 0, width, height);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
// Shaders for rendering.
Program texProgram;
err = texProgram.setup(Program::PROGRAM_TEXTURE_2D);
if (err != NO_ERROR) {
return err;
}
TextRenderer textRenderer;
err = textRenderer.loadIntoTexture();
if (err != NO_ERROR) {
return err;
}
textRenderer.setScreenSize(width, height);
doDrawInfoPage(window, texProgram, textRenderer);
// Destroy the surface. This causes a disconnect.
texProgram.release();
window.release();
return NO_ERROR;
}
示例14: OnD3D11FrameRender
//--------------------------------------------------------------------------------------
// Callback function that renders the frame. This function sets up the rendering
// matrices and renders the scene and UI.
//--------------------------------------------------------------------------------------
void CALLBACK OnD3D11FrameRender(ID3D11Device* pd3dDevice, ID3D11DeviceContext* pd3dImmediateContext,
double fTime, float fElapsedTime, void* pUserContext)
{
// If the settings dialog is being shown, then render it instead of rendering the app's scene
if (g_SettingsDlg.IsActive())
{
g_SettingsDlg.OnRender(fElapsedTime);
return;
}
// Reallocate the render targets and depth buffer if the MSAA mode has been changed in the GUI.
if (g_RenderTargetsDirty)
{
g_RenderTargetsDirty = false;
ResizeScreenSizedBuffers(pd3dDevice);
}
SceneMesh *pMesh = g_Scenes[g_CurrentSceneId].pMesh;
g_AOParams.UseDeinterleavedTexturing = g_UseDeinterleavedTexturing;
g_AOParams.RandomizeSamples = g_RandomizeSamples;
g_AOParams.Blur.Enable = g_BlurAO;
ID3D11RenderTargetView* pBackBufferRTV = DXUTGetD3D11RenderTargetView(); // does not addref
if (pMesh)
{
RenderAOFromMesh(pd3dDevice,
pd3dImmediateContext,
pBackBufferRTV,
pMesh);
}
//--------------------------------------------------------------------------------------
// Render the GUI
//--------------------------------------------------------------------------------------
if (g_DrawUI)
{
g_HUD.OnRender(fElapsedTime);
g_TextRenderer.OnRender(fElapsedTime);
}
}
示例15: QuickMenuButtonRenderer
explicit QuickMenuButtonRenderer(const DialogLook &_look,
const TCHAR *_caption)
:look(_look), caption(_caption) {
text_renderer.SetCenter();
text_renderer.SetVCenter();
text_renderer.SetControl();
}