• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TextRenderer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TextRenderer的典型用法代码示例。如果您正苦于以下问题:C++ TextRenderer类的具体用法?C++ TextRenderer怎么用?C++ TextRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TextRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:cargabsj175,项目名称:bombono-dvd,代码行数:7,代码来源:text.cpp


示例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);
}
开发者ID:Gooeybots,项目名称:Hackman,代码行数:9,代码来源:playgame.cpp


示例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);
}
开发者ID:cargabsj175,项目名称:bombono-dvd,代码行数:10,代码来源:text.cpp


示例4: copySelectionOrAllToClipboard

void PediaMainForm::copySelectionOrAllToClipboard()
{
    TextRenderer* renderer = &infoRenderer_;
    if (showArticle == displayMode_)
        renderer = &articleRenderer_;
     
    if (renderer->empty())
        return;
    String text;
    renderer->copySelectionOrAll();
}
开发者ID:kjk,项目名称:ipedia-palm,代码行数:11,代码来源:MainForm.cpp


示例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;
}
开发者ID:Gooeybots,项目名称:Hackman,代码行数:11,代码来源:playgame.cpp


示例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() );
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:13,代码来源:Choice.cpp


示例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);
}
开发者ID:Lijmer,项目名称:Custom_Template,代码行数:14,代码来源:TestComponent.cpp


示例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()) );
}
开发者ID:cargabsj175,项目名称:bombono-dvd,代码行数:7,代码来源:text.cpp


示例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  
}
开发者ID:Barnold1953,项目名称:hifi,代码行数:16,代码来源:PrioVR.cpp


示例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) );
}
开发者ID:151706061,项目名称:D3DSamples,代码行数:60,代码来源:DeinterleavedTexturing.cpp


示例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;
    }
}
开发者ID:ey6es,项目名称:hifi,代码行数:41,代码来源:TextOverlay.cpp


示例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++;

}
开发者ID:A2-Collaboration,项目名称:PiGLET,代码行数:21,代码来源:NumberLabel.cpp


示例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;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_frameworks_av,代码行数:38,代码来源:Overlay.cpp


示例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);
    }
}
开发者ID:151706061,项目名称:D3DSamples,代码行数:46,代码来源:DeinterleavedTexturing.cpp


示例15: draw

void UIPainter::draw(const TextRenderer& text, bool forceCopy)
{
	if (clip) {
		auto targetClip = clip.get() - text.getPosition();
		if (text.getClip()) {
			targetClip = text.getClip().get().intersection(targetClip);
		}
		
		auto onScreen = Rect4f(Vector2f(), text.getExtents()).intersection(targetClip);
		if (onScreen.getWidth() > 0.1f && onScreen.getHeight() > 0.1f) {
			painter.addCopy(text.clone().setClip(clip.get() - text.getPosition()), mask, layer, getCurrentPriority());
		}
	} else {
		if (forceCopy) {
			painter.addCopy(text, mask, layer, getCurrentPriority());
		} else {
			painter.add(text, mask, layer, getCurrentPriority());
		}
	}
}
开发者ID:DanMillward,项目名称:halley,代码行数:20,代码来源:ui_painter.cpp


示例16: pangocontext

Paragraph::Paragraph(TextRenderer& tr):PageObjectBase(tr.renderContext())
	,m_flags(0xf)
	,m_font(pango_font_description_new())
	,m_layout(pango_layout_new( pangocontext( tr.handle() ) ) )
	{style(s_para_default).style(s_text_default);}
开发者ID:milasudril,项目名称:glinde,代码行数:5,代码来源:paragraph.cpp


示例17: glPushMatrix

void Text3DOverlay::render(RenderArgs* args) {
    if (!_visible) {
        return; // do nothing if we're not visible
    }

    glPushMatrix(); {
        glTranslatef(_position.x, _position.y, _position.z);
        glm::quat rotation;
        
        if (_isFacingAvatar) {
            // rotate about vertical to face the camera
            rotation = Application::getInstance()->getCamera()->getRotation();
        } else {
            rotation = getRotation();
        }
        
        glm::vec3 axis = glm::axis(rotation);
        glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);

        const float MAX_COLOR = 255.0f;
        xColor backgroundColor = getBackgroundColor();
        glm::vec4 quadColor(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR,
            getBackgroundAlpha());

        glm::vec2 dimensions = getDimensions();
        glm::vec2 halfDimensions = dimensions * 0.5f;
        
        const float SLIGHTLY_BEHIND = -0.005f;

        glm::vec3 topLeft(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND);
        glm::vec3 bottomRight(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND);
        DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, quadColor);
        
        // Same font properties as textSize()
        TextRenderer* textRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY, FIXED_FONT_POINT_SIZE);
        float maxHeight = (float)textRenderer->computeExtent("Xy").y * LINE_SCALE_RATIO;
        
        float scaleFactor =  (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight; 

        glTranslatef(-(halfDimensions.x - _leftMargin), halfDimensions.y - _topMargin, 0.0f);

        glm::vec2 clipMinimum(0.0f, 0.0f);
        glm::vec2 clipDimensions((dimensions.x - (_leftMargin + _rightMargin)) / scaleFactor, 
                                 (dimensions.y - (_topMargin + _bottomMargin)) / scaleFactor);

        glScalef(scaleFactor, -scaleFactor, scaleFactor);
        enableClipPlane(GL_CLIP_PLANE0, -1.0f, 0.0f, 0.0f, clipMinimum.x + clipDimensions.x);
        enableClipPlane(GL_CLIP_PLANE1, 1.0f, 0.0f, 0.0f, -clipMinimum.x);
        enableClipPlane(GL_CLIP_PLANE2, 0.0f, -1.0f, 0.0f, clipMinimum.y + clipDimensions.y);
        enableClipPlane(GL_CLIP_PLANE3, 0.0f, 1.0f, 0.0f, -clipMinimum.y);
    
        glm::vec4 textColor = { _color.red / MAX_COLOR, _color.green / MAX_COLOR, _color.blue / MAX_COLOR, getAlpha() };
        textRenderer->draw(0, 0, _text, textColor);

        glDisable(GL_CLIP_PLANE0);
        glDisable(GL_CLIP_PLANE1);
        glDisable(GL_CLIP_PLANE2);
        glDisable(GL_CLIP_PLANE3);
        
    } glPopMatrix();
    
}
开发者ID:bakarih,项目名称:hifi,代码行数:62,代码来源:Text3DOverlay.cpp


示例18: TextRangeSet

/// execute the given selection command
/// @param controller the controller to execute the selection for
void SelectionCommand::execute( TextEditorController* controller )
{
    // save the selection state
    TextDocument* document = controller->textDocument();
    TextRangeSet* currentSelection = dynamic_cast<TextRangeSet*>( controller->textSelection() );
    TextRangeSet* sel = new TextRangeSet(*currentSelection);  // start with the current selection

    bool resetAnchors = !keepSelection_;

    // handle the select operation
    switch( unit_ ) {
        // character movement
        case MoveCaretByCharacter:
            sel->moveCarets(amount_);
            break;

        // This results in clearing the selection if a selection is present or it results in a movement of the caret.
        // When clearing a selection the caret is placed next to the selection (which side depends on the direction)
        case MoveCaretsOrDeselect:
            if( keepSelection_ ) {
                sel->moveCarets(amount_);
            } else {
                sel->moveCaretsOrDeselect(amount_);
            }
            break;

        case MoveCaretByWord:
            sel->moveCaretsByCharGroup(amount_, document->config()->whitespaceWithoutNewline(), document->config()->charGroups() );
            break;

        case MoveCaretByLine:
            TextSelection::moveCaretsByLine( controller, sel, amount_ );
            break;

        case MoveCaretToLineBoundary:
            sel->moveCaretsToLineBoundary( amount_, document->config()->whitespaceWithoutNewline() );
            break;

        case MoveCaretToDocumentBegin:
            sel->toSingleRange();
            sel->range(0).setCaret(0);
            break;

        case MoveCaretToDocumentEnd:
            sel->toSingleRange();
            sel->range(0).setCaret( controller->textDocument()->length() );
            break;

        case MoveCaretByPage:
        {
            // make sure the first line of the window is scrolled
            TextRenderer* renderer   = controller->textRenderer();
            TextEditorWidget* widget = controller->widget();
            int firstVisibleLine = renderer->firstVisibleLine();
            int linesPerPage     = renderer->viewHeightInLines();

            sel->beginChanges();
            TextSelection::moveCaretsByPage( controller, sel, amount_ );
            if( !keepSelection_ ) {
                sel->resetAnchors();    // we must reset anchors here because de process-changes will merge carets
            }
            sel->endChanges();

            firstVisibleLine += linesPerPage * amount_;
            widget->scrollTopToLine( firstVisibleLine );

            break;
        }
        case MoveCaretToExactOffset:
            sel->toSingleRange();
            sel->range(0).setCaret(amount_);
            break;

        case SelectAll:
            sel->toSingleRange();
            sel->setRange(0, document->buffer()->length() );
            resetAnchors = false;   // do not reset the anchors
            break;

        case SelectWord:
            sel->expandToWords(document->config()->whitespaces(), document->config()->charGroups());
            resetAnchors = false;   // do not reset the anchors
            break;

        case SelectWordAt:
            sel->selectWordAt( amount_, document->config()->whitespaces(), document->config()->charGroups() );
            resetAnchors = false;
            break;

        case ToggleWordSelectionAt:
            sel->toggleWordSelectionAt( amount_, document->config()->whitespaces(), document->config()->charGroups() );
            resetAnchors = false;
            break;

        case SelectFullLine:
            sel->expandToFullLines( amount_);
            resetAnchors = false;
            break;
//.........这里部分代码省略.........
开发者ID:letmefly,项目名称:edbee-lib,代码行数:101,代码来源:selectioncommand.cpp


示例19: getText

//auto getText = [&]()
void getText(TextRenderer &textObj, PerfMon &perfMon, WindowStates &ws)
{
    auto fbWidth = ws.fbWidth;
    auto fbHeight = ws.fbHeight;
    auto winWidth = ws.winWidth;
    auto winHeight = ws.winHeight;
    
    stringstream textOut;
    textOut << "Frame: " << std::fixed << std::setprecision(1)
    << 1000.0/perfMon.fps.average()
    << "ms max: " << 1000.0/perfMon.fps.min()
    << "ms min: " << 1000.0/perfMon.fps.max() << "ms";
    textObj.pushBackDebug(textOut);
    textOut << "cpu time: " << std::fixed << std::setprecision(2)
    << perfMon.renderTimes.average() << "ms max: " << perfMon.renderTimes.max()
    << "ms min: " << perfMon.renderTimes.min();
    textObj.pushBackDebug(textOut);
    textOut << "gpu time: " << std::fixed << std::setprecision(2)
    << perfMon.gpuRenderTimes.average() << "ms max: " << perfMon.gpuRenderTimes.max()
    << "ms min: " << perfMon.gpuRenderTimes.min();
    //        << std::accumulate(gpuTimes.begin(), gpuTimes.end(), 0) << "ms";
    textObj.pushBackDebug(textOut);
    textOut << "win " << winWidth << " x " << winHeight
    << " fb size " << fbWidth << " x " << fbHeight;
    textObj.pushBackDebug(textOut);
    
    
    //the following code should go into UserInput and GameLogic, not out here

    textOut << "shadow pass: 1   " << ((renderStage & stage1) ? "On" : " ");
    textObj.pushBackDebug(textOut);
    textOut << "forward pass: 2  " << ((renderStage & stage2) ? "On" : " ");
    textObj.pushBackDebug(textOut);
    textOut << "highpass: 3           " << ((renderStage & stage3) ? "On" : " ");
    textObj.pushBackDebug(textOut);
    textOut << "blur1 pass: 4         " << ((renderStage & stage4) ? "On" : " ");
    textObj.pushBackDebug(textOut);
    textOut << "blur2 pass: 5         " << ((renderStage & stage5) ? "On" : " ");
    textObj.pushBackDebug(textOut);
    textOut << "composite pass: 6 " << ((renderStage & stage6) ? "On" : " ");
    textObj.pushBackDebug(textOut);
    textOut << "fxaa pass: 7            " << ((renderStage & stage7) ? "On" : " ");
    textObj.pushBackDebug(textOut);
}
开发者ID:orbitalVelocity,项目名称:OrbitalVector,代码行数:45,代码来源:main.cpp


示例20: glPushMatrix

void Text3DOverlay::render(RenderArgs* args) {
    if (!_visible) {
        return; // do nothing if we're not visible
    }

    glPushMatrix(); {
        glTranslatef(_position.x, _position.y, _position.z);
        glm::quat rotation;
        
        if (_isFacingAvatar) {
            // rotate about vertical to face the camera
            rotation = Application::getInstance()->getCamera()->getRotation();
        } else {
            rotation = getRotation();
        }
        
        glm::vec3 axis = glm::axis(rotation);
        glRotatef(glm::degrees(glm::angle(rotation)), axis.x, axis.y, axis.z);

        const float MAX_COLOR = 255.0f;
        xColor backgroundColor = getBackgroundColor();
        glColor4f(backgroundColor.red / MAX_COLOR, backgroundColor.green / MAX_COLOR, backgroundColor.blue / MAX_COLOR, 
            getBackgroundAlpha());

        glm::vec2 dimensions = getDimensions();
        glm::vec2 halfDimensions = dimensions * 0.5f;
        
        const float SLIGHTLY_BEHIND = -0.005f;

        glBegin(GL_QUADS);
            glVertex3f(-halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND);
            glVertex3f(halfDimensions.x, -halfDimensions.y, SLIGHTLY_BEHIND);
            glVertex3f(halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND);
            glVertex3f(-halfDimensions.x, halfDimensions.y, SLIGHTLY_BEHIND);
        glEnd();
        
        const int FIXED_FONT_SCALING_RATIO = FIXED_FONT_POINT_SIZE * 40.0f; // this is a ratio determined through experimentation
        
        // Same font properties as textWidth()
        TextRenderer* textRenderer = TextRenderer::getInstance(SANS_FONT_FAMILY, FIXED_FONT_POINT_SIZE);
        float maxHeight = (float)textRenderer->calculateHeight("Xy") * LINE_SCALE_RATIO;
        
        float scaleFactor =  (maxHeight / FIXED_FONT_SCALING_RATIO) * _lineHeight; 

        glTranslatef(-(halfDimensions.x - _leftMargin), halfDimensions.y - _topMargin, 0.0f);

        glm::vec2 clipMinimum(0.0f, 0.0f);
        glm::vec2 clipDimensions((dimensions.x - (_leftMargin + _rightMargin)) / scaleFactor, 
                                 (dimensions.y - (_topMargin + _bottomMargin)) / scaleFactor);

        glScalef(scaleFactor, -scaleFactor, 1.0);
        enableClipPlane(GL_CLIP_PLANE0, -1.0f, 0.0f, 0.0f, clipMinimum.x + clipDimensions.x);
        enableClipPlane(GL_CLIP_PLANE1, 1.0f, 0.0f, 0.0f, -clipMinimum.x);
        enableClipPlane(GL_CLIP_PLANE2, 0.0f, -1.0f, 0.0f, clipMinimum.y + clipDimensions.y);
        enableClipPlane(GL_CLIP_PLANE3, 0.0f, 1.0f, 0.0f, -clipMinimum.y);
    
        glColor3f(_color.red / MAX_COLOR, _color.green / MAX_COLOR, _color.blue / MAX_COLOR);
        float alpha = getAlpha();
        QStringList lines = _text.split("\n");
        int lineOffset = maxHeight;
        foreach(QString thisLine, lines) {
            textRenderer->draw(0, lineOffset, qPrintable(thisLine), alpha);
            lineOffset += maxHeight;
        }

        glDisable(GL_CLIP_PLANE0);
        glDisable(GL_CLIP_PLANE1);
        glDisable(GL_CLIP_PLANE2);
        glDisable(GL_CLIP_PLANE3);
        
    } glPopMatrix();
开发者ID:RyanDowne,项目名称:hifi,代码行数:71,代码来源:Text3DOverlay.cpp



注:本文中的TextRenderer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TextResourceDecoder类代码示例发布时间:2022-05-31
下一篇:
C++ TextReader类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap