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

C++ FTPoint函数代码示例

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

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



在下文中一共展示了FTPoint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: fontSize

void                        OpenGLUI::_putTexts(IGame const &game)
{
	int const		fontSize(_winSize.first / 19);
	double const	padding(static_cast<double>(_winSize.first) / 19.);
	double const	timeWidth(static_cast<double>(_winSize.first) / 19. * 8.);
	double const	pausePadding(
		(static_cast<double>(_winSize.first) -
		 static_cast<double>(_winSize.first) / 19. * 4.) / 2.);

	this->_font.FaceSize(fontSize);
	this->_font.Render(
		(std::string("Score: ") += std::to_string(game.getScore())).c_str(),
		-1, FTPoint(padding, padding));
	this->_font.Render(
		(std::string("Played: ")
		 += std::to_string(game.getPlayTime() / 60)
		 += std::string(":")
		 += std::string(game.getPlayTime() % 60 > 9 ? "" : "0")
		 += std::to_string(game.getPlayTime() % 60)).c_str(),
		-1, FTPoint(static_cast<double>(_winSize.first) - timeWidth - padding,
					padding));
	if (game.getSnake().isDie())
	{
		this->_font.Render(
			std::string("Death!!").c_str(), -1,
			FTPoint(pausePadding, static_cast<double>(_winSize.second) / 2.));		
	}
	else if (game.isPaused())
	{
		this->_font.Render(
			std::string("Paused").c_str(), -1,
			FTPoint(pausePadding, static_cast<double>(_winSize.second) / 2.));
	}
	return ;
}
开发者ID:Julow,项目名称:Nibbler,代码行数:35,代码来源:draw_texts.cpp


示例2: locker

	void Font::print(float x, float y, float z, const String& text)
	{
		if (text.empty())
			return;
		MutexLocker locker(pMutex);
		if (!font)
			return;

		glScalef(1.0f, -1.0f, 1.0f);
		for(int k = 0 ; k < (bBold ? 3 : 1) ; ++k)
		{
#ifdef __FTGL__lower__
			font->Render( text.c_str(), -1,
				FTPoint(x, -(y + 0.5f * (-font->Descender() + font->Ascender())), z),
				FTPoint(), FTGL::RENDER_ALL);
#else
			glPushMatrix();
			glTranslatef( x, -(y + 0.5f * (-font->Descender() + font->Ascender())), z );
# ifndef TA3D_PLATFORM_DARWIN
			WString wstr(text);
			font->Render(wstr.cw_str());
# else
			font->Render(text.c_str());
# endif
			glPopMatrix();
#endif
		}
		glScalef(1.0f, -1.0f, 1.0f);
	}
开发者ID:joaocc,项目名称:ta3d-git,代码行数:29,代码来源:font.cpp


示例3: FTPoint

FTPoint FTFace::KernAdvance(unsigned int index1, unsigned int index2)
{
    FTGL_DOUBLE x, y;

    if(!hasKerningTable || !index1 || !index2)
    {
        return FTPoint(0.0, 0.0);
    }

    if(kerningCache && index1 < FTFace::MAX_PRECOMPUTED
        && index2 < FTFace::MAX_PRECOMPUTED)
    {
        x = kerningCache[2 * (index2 * FTFace::MAX_PRECOMPUTED + index1)];
        y = kerningCache[2 * (index2 * FTFace::MAX_PRECOMPUTED + index1) + 1];
        return FTPoint(x, y);
    }

    FT_Vector kernAdvance;
    kernAdvance.x = kernAdvance.y = 0;

    err = FT_Get_Kerning(*ftFace, index1, index2, ft_kerning_unfitted,
                         &kernAdvance);
    if(err)
    {
        return FTPoint(0.0f, 0.0f);
    }

    x = static_cast<float>(kernAdvance.x) / 64.0f;
    y = static_cast<float>(kernAdvance.y) / 64.0f;

    return FTPoint(x, y);
}
开发者ID:CombustibleLemonade,项目名称:AI,代码行数:32,代码来源:FTFace.cpp


示例4: glPushMatrix

// 描画
// text  表示文字列
// pos   表示位置
// color 表示色
void Font::draw(const std::string& text, const Vec2f& pos, const Color& color) {
  color.setToGl();

  // OpenGLの行列スタックを利用
  glPushMatrix();
  font_->Render(text.c_str(), -1, FTPoint(pos.x(), pos.y()), FTPoint());
  glPopMatrix();
}
开发者ID:tek-nishi,项目名称:FFT-Sample,代码行数:12,代码来源:font.cpp


示例5: tex

FTGlyph::FTGlyph(FileStream & stream, char * data,
                 int x_offset, int y_offset,
                 int tex_width, int tex_height)
: tex(0)
{
    charcode = stream.read_uint32();
    float x1, y1, x2, y2;
    x1 = stream.read_float();
    y1 = stream.read_float();
    x2 = stream.read_float();
    y2 = stream.read_float();
    bBox = FTBBox(x1, y1, x2, y2);
    float advance_x, advance_y;
    advance_x = stream.read_float();
    advance_y = stream.read_float();
    advance = FTPoint(advance_x, advance_y);
    float corner_x, corner_y;
    corner_x = stream.read_float();
    corner_y = stream.read_float();
    corner = FTPoint(corner_x, corner_y);
    width = stream.read_int32();
    height = stream.read_int32();

    char * glyph = new char[width*height];
    stream.read(glyph, width * height);

    if (width && height) {
        if (y_offset + height > tex_height) {
            // copy subimage
            height = tex_height - y_offset;
        }
        if (height >= 0) {
            for (int y = 0; y < height; ++y) {
                for (int x = 0; x < width; ++x) {
                    char c = glyph[y * width + x];
                    data[(y + y_offset) * tex_width + x + x_offset] = c;
                }
            }
        }
    }

#ifdef USE_OUTLINE
    uv[0].X(float(x_offset - 1) / float(tex_width));
    uv[0].Y(float(y_offset - 1) / float(tex_height));
    uv[1].X(float(x_offset + width + 1) / float(tex_width));
    uv[1].Y(float(y_offset + height + 1) / float(tex_height));
#else
    uv[0].X(float(x_offset) / float(tex_width));
    uv[0].Y(float(y_offset) / float(tex_height));
    uv[1].X(float(x_offset + width) / float(tex_width));
    uv[1].Y(float(y_offset + height) / float(tex_height));
#endif

    delete[] glyph;
}
开发者ID:joaormatos,项目名称:anaconda,代码行数:55,代码来源:font.cpp


示例6: glGetFloatv

void FTExtrudeGlyphImpl::RenderSide()
{
    int contourFlag = vectoriser->ContourFlag();
    //LOG_INFO("RenderSide %d", contourFlag);
    GLfloat colors[4];
    for(size_t c = 0; c < vectoriser->ContourCount(); ++c)
    {
        const FTContour* contour = vectoriser->Contour(c);
        size_t n = contour->PointCount();

        if(n < 2)
        {
            continue;
        }

        glGetFloatv(GL_CURRENT_COLOR, colors);
        ftglBegin(GL_QUADS);
        ftglColor4f(colors[0]/2, colors[1]/2, colors[2]/2, colors[3]/2);
            for(size_t j = 0; j < n; j++ )
            {
                size_t cur = j % n;
                size_t next = (j + 1) % n;
                
                FTPoint frontPt = contour->FrontPoint(cur);
                FTPoint frontPt1 = contour->FrontPoint(next);
                FTPoint backPt = contour->BackPoint(cur);
                FTPoint backPt1 = contour->BackPoint(next);

                FTPoint normal = FTPoint(0.f, 0.f, 1.f) ^ (frontPt - frontPt1);
                if(normal != FTPoint(0.0f, 0.0f, 0.0f))
                {
                    const FTGL_DOUBLE* pD = static_cast<const FTGL_DOUBLE*>(normal.Normalise());
                    glNormal3f( pD[0], pD[1], pD[2]);
                }

                ftglTexCoord2f(frontPt.Xf() / hscale, frontPt.Yf() / vscale);

                if(contourFlag & ft_outline_reverse_fill)
                {
                    ftglVertex3f(backPt.Xf() / 64.0f, backPt.Yf() / 64.0f, 0.0f);
                    ftglVertex3f(frontPt.Xf() / 64.0f, frontPt.Yf() / 64.0f, -depth);
                    ftglVertex3f(frontPt1.Xf() / 64.0f, frontPt1.Yf() / 64.0f, -depth);
                    ftglVertex3f(backPt1.Xf() / 64.0f, backPt1.Yf() / 64.0f, 0.0f);
                }
                else
                {
                    ftglVertex3f(backPt.Xf() / 64.0f, backPt.Yf() / 64.0f, -depth);
                    ftglVertex3f(frontPt.Xf() / 64.0f, frontPt.Yf() / 64.0f, 0.0f);
                    ftglVertex3f(frontPt1.Xf() / 64.0f, frontPt1.Yf() / 64.0f, 0.f);
                    ftglVertex3f(backPt1.Xf() / 64.0f, backPt1.Yf() / 64.0f, -depth);
                }
            }
        ftglEnd();
    }
}
开发者ID:JackFan-Z,项目名称:ftgles,代码行数:55,代码来源:FTExtrudeGlyph.cpp


示例7: textLife

void HudManager::renderPos(int X, int Y)
{
  QString x,y;
  x.setNum(X);
  y.setNum(Y);
  FTGLPixmapFont textLife("/home/dragmaf/Sviluppo/build-GraficaProgetto-Desktop-Debug/data/font/SuperMario256.ttf");
  textLife.FaceSize(30);
  textLife.Render("X",-1,FTPoint(70, height/2, 0));
  textLife.Render(x.toStdString().c_str(),-1,FTPoint(120, height/2, 0));
  textLife.Render("Y",-1,FTPoint(70, height/2-40, 0));
  textLife.Render(y.toStdString().c_str(),-1,FTPoint(120, height/2-40, 0));



}
开发者ID:Dragmaf93,项目名称:MarioMaze3d,代码行数:15,代码来源:hudmanager.cpp


示例8: glEnable

void HudManager::renderLose()
{
  glEnable(GL_LIGHT1);

  FTGLPixmapFont lose("/home/dragmaf/Sviluppo/build-GraficaProgetto-Desktop-Debug/data/font/SuperMario256.ttf");
  lose.FaceSize(72);
  lose.Render("HAI PERSO",-1,FTPoint(width/2-200, height-190, 0));
  lose.FaceSize(30);
  lose.Render("Premi R per ricominciare a giocare.",-1,FTPoint(width/2-300, height/2-200, 0));
  lose.Render("Premi ESC per chiudere.",-1,FTPoint(width/2-300, height/2-250, 0));

  drawImage(textureLose,width/2-300,height/2-150,600,300);
  glDisable(GL_LIGHT1);

}
开发者ID:Dragmaf93,项目名称:MarioMaze3d,代码行数:15,代码来源:hudmanager.cpp


示例9: testGetPoint

        void testGetPoint()
        {
            FTTesselation tesselation(1);

            CPPUNIT_ASSERT(tesselation.PointCount() == 0);

            tesselation.AddPoint(10, 3, 0.7);
            tesselation.AddPoint(-53, 2000, 23);
            tesselation.AddPoint(77, -2.4, 765);
            tesselation.AddPoint(117.5,  0.02, -99);

            CPPUNIT_ASSERT(tesselation.PointCount() == 4);
            CPPUNIT_ASSERT(tesselation.Point(2) == FTPoint(77, -2.4, 765));
            CPPUNIT_ASSERT(tesselation.Point(20) != FTPoint(77, -2.4, 765));
        }
开发者ID:BSVino,项目名称:ftgl-gl3,代码行数:15,代码来源:FTTesselation-Test.cpp


示例10: throw

void Font::renderText(const wchar_t* wText, float x, float y, float width, float height) throw(invalid_argument, runtime_error) {

    ASSERT(
        (wText != 0),
        invalid_argument("wText")
    );

    std::lock_guard<std::mutex> guard(synchroMutex_);

    if(font_ == 0) {
        return;
    }

    size_t textLen = wcslen(wText);

    if(width >= 0.0f) {

        Font::FONT_RECT rect = measureText(wText);

        if(rect.width > width) {

            float pixPerChar     = rect.width / textLen;

            float excess         = rect.width - width;

            size_t charsForErase = static_cast<size_t>(lround(excess / pixPerChar));

            textLen -= charsForErase;

        }

    }

    glPushMatrix();
    glPushAttrib(GL_COLOR_BUFFER_BIT);

    glColor3fv(color_.c_array());

    font_->Render(wText,
                    textLen,
                    FTPoint(static_cast<FTGL_FLOAT>(x), static_cast<FTGL_FLOAT>(y)),
                    FTPoint(),
                    FTGL::RENDER_ALL);

    glPopAttrib();
    glPopMatrix();

}
开发者ID:ElijahVlasov,项目名称:EGF,代码行数:48,代码来源:Font.cpp


示例11: FTPoint

void GUI::RenderPolyCount(){
	
	//TODO: clean this up
	stringstream ss1;
	ss1 << "Quads: " << "10";
	m_text->Render(ss1.str().c_str(), -1, FTPoint(m_width-200, m_height-115, 0));
	
	stringstream ss2;
	ss2 << "Tri: " << "20";
	m_text->Render(ss2.str().c_str(), -1, FTPoint(m_width-200, m_height-130, 0));

	stringstream ss3;
	ss3 << "Vertices: " << "10";
	m_text->Render(ss3.str().c_str(), -1, FTPoint(m_width-200, m_height-145, 0));

}
开发者ID:SigtunaX,项目名称:procedural,代码行数:16,代码来源:GUI.cpp


示例12: WrapTextI

FTBBox FTSimpleLayout::BBox(const wchar_t *string, const int len)
{
    FTBBox tmp;
    int lines;
    WrapTextI(string, len, FTPoint(), &tmp, lines);
    return tmp;
}
开发者ID:joaormatos,项目名称:anaconda,代码行数:7,代码来源:font.cpp


示例13: FTPoint

ofRectangle ofxFTGLFont::getStringBoundingBox(const wstring& s, float x, float y){
    if(loaded){
    	FTBBox bbox = font->BBox((wchar_t*)s.c_str(), -1, FTPoint(), trackingPoint);
	    return ofRectangle(x + bbox.Lower().Xf(), y + bbox.Lower().Yf(), bbox.Upper().Xf(), bbox.Upper().Yf());
    }
	return ofRectangle();
}
开发者ID:prisonerjohn,项目名称:ofxFTGL,代码行数:7,代码来源:ofxFTGLFont.cpp


示例14: ss

void Font::render(const vec3& pos, const std::string& text) const {
    if (simpleLayout_) {
        float delta = 0;

        std::string line;
        std::stringstream ss(text);
        std::getline(ss, line);
        FTPoint point(static_cast<double>(pos.x),
                      static_cast<double>(pos.y),
                      static_cast<double>(pos.z));
        FTBBox box = font_->BBox(line.c_str(), -1, point);
        delta -= box.Upper().Yf() - box.Lower().Yf(); // height of first line

        Bounds bounds = getBounds(pos, text);
        float height = bounds.getURB().y - bounds.getLLF().y;
        switch(vAlign_) {
            case Font::Top:
                delta += height;
                break;
            case Font::Middle:
                delta += height * 0.5f;
                break;
            case Font::Bottom:
                break;
        }
        vec3 dpos = vec3(pos.x, pos.y + delta, pos.z);
        glPushMatrix();
        glRasterPos3f(dpos.x, dpos.y, dpos.z);
        glTranslatef(dpos.x, dpos.y, dpos.z);
        simpleLayout_->Render(text.c_str(), -1, FTPoint(dpos.x, dpos.y, dpos.z));
        glPopMatrix();
    }
}
开发者ID:151706061,项目名称:Voreen,代码行数:33,代码来源:font.cpp


示例15: while

void FTFont::BBox( const wchar_t* string,
                   float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)
{
    FTBBox totalBBox;

    if((NULL != string) && ('\0' != *string))
    {
        const wchar_t* c = string;
        float advance = 0;

        if(CheckGlyph( *c))
        {
            totalBBox = glyphList->BBox( *c);
            advance = glyphList->Advance( *c, *(c + 1));
        }
        
        while( *++c)
        {
            if(CheckGlyph( *c))
            {
                FTBBox tempBBox = glyphList->BBox( *c);
                tempBBox.Move( FTPoint( advance, 0.0f, 0.0f));
                totalBBox += tempBBox;
                advance += glyphList->Advance( *c, *(c + 1));
            }
        }
    }

    llx = totalBBox.lowerX;
    lly = totalBBox.lowerY;
    llz = totalBBox.lowerZ;
    urx = totalBBox.upperX;
    ury = totalBBox.upperY;
    urz = totalBBox.upperZ;
}
开发者ID:Gi133,项目名称:NetworkingCoursework,代码行数:35,代码来源:FTFont.cpp


示例16: CheckGlyph

void FTFont::BBox( const char* string,
                   float& llx, float& lly, float& llz, float& urx, float& ury, float& urz)
{
    FTBBox totalBBox;

    if((NULL != string) && ('\0' != *string))
    {
        const unsigned char* c = (unsigned char*)string;

        CheckGlyph( *c);

        totalBBox = glyphList->BBox( *c);
        float advance = glyphList->Advance( *c, *(c + 1));
        ++c;
            
        while( *c)
        {
            CheckGlyph( *c);
            FTBBox tempBBox = glyphList->BBox( *c);
            tempBBox.Move( FTPoint( advance, 0.0f, 0.0f));
            totalBBox += tempBBox;
            advance += glyphList->Advance( *c, *(c + 1));
            ++c;
        }
    }

    llx = totalBBox.lowerX;
    lly = totalBBox.lowerY;
    llz = totalBBox.lowerZ;
    urx = totalBBox.upperX;
    ury = totalBBox.upperY;
    urz = totalBBox.upperZ;
}
开发者ID:CJFocke,项目名称:vsxu,代码行数:33,代码来源:FTFont.cpp


示例17: TAssert

void CRenderingContext::RenderText(const tstring& sText, unsigned iLength, FTFont* pFont)
{
	TAssert(m_pShader);
	if (!m_pShader)
		return;

	CRenderContext& oContext = GetContext();

	if (iLength == -1)
		iLength = sText.length();

	TAssert(m_pShader->m_iPositionAttribute >= 0);
	TAssert(m_pShader->m_aiTexCoordAttributes[0] >= 0);

	if (!oContext.m_bProjectionUpdated)
		SetUniform("mProjection", oContext.m_mProjection);

	if (!oContext.m_bViewUpdated)
		SetUniform("mView", oContext.m_mView);

	// Take the position out and let FTGL do it. It looks sharper that way.
	Matrix4x4 mTransformations = oContext.m_mTransformations;
	Vector vecPosition = mTransformations.GetTranslation();
	mTransformations.SetTranslation(Vector());
	SetUniform("mGlobal", mTransformations);

	oContext.m_bProjectionUpdated = oContext.m_bViewUpdated = oContext.m_bTransformUpdated = true;

	ftglSetAttributeLocations(m_pShader->m_iPositionAttribute, m_pShader->m_aiTexCoordAttributes[0]);

	pFont->Render(sText.c_str(), iLength, FTPoint(vecPosition.x, vecPosition.y, vecPosition.z));
}
开发者ID:BSVino,项目名称:CodenameInfinite,代码行数:32,代码来源:renderingcontext.cpp


示例18: FTPoint

ofRectangle ofxFTGLFont::getStringBoundingBox(wstring s, float x, float y){
    if(loaded){
    	FTBBox bbox = font->BBox((wchar_t*)s.c_str(), -1, FTPoint(), trackingPoint);
        return ofRectangle(x, y-getAscender(), abs(bbox.Lower().Xf()-bbox.Upper().Xf()), abs(bbox.Upper().Yf()-bbox.Lower().Yf()));
    }
	return ofRectangle();
}
开发者ID:alangrizek,项目名称:ofxFTGL,代码行数:7,代码来源:ofxFTGLFont.cpp


示例19: err

FTGlyph::FTGlyph (FT_GlyphSlot glyph)
	:   err(0) {
	if (glyph) {
		bBox = FTBBox (glyph);
		advance = FTPoint (glyph->advance.x / 64.0f, glyph->advance.y / 64.0f, 0.0f);
	}
}
开发者ID:pseuudonym404,项目名称:tuxracer-touch,代码行数:7,代码来源:ft_font.cpp


示例20: return

int DKFont::GetWidth(DKString text)
{
	if(texture_font != NULL){
		return (int)texture_font->Advance(text.c_str(),-1,FTPoint());
	}
	return 0;
}
开发者ID:trigg4htre,项目名称:dklib,代码行数:7,代码来源:DKFont.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ FTRACE函数代码示例发布时间:2022-05-30
下一篇:
C++ FTPException函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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