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

C++ TextObject类代码示例

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

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



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

示例1: entity_SetFont

//	.SetFont(ent, "face"<nil>, size<nil>, style<nil>) - Set displayed text of a text object entity
//		Any non-defined parameter will use user defaults
int entity_SetFont(lua_State* ls)
{
	luaCountArgs(ls, 1);

	int args = lua_gettop(ls);
	int size = 0, style = 0;
	string face;

	TextObject* o = (TextObject*)_getReferencedEntity(ls);
	if (!o || o->mType != ENTITY_TEXT)
	{
		return luaError(ls, "Entity.SetFont", "Invalid Entity type");
	}

	if (args > 1 && lua_isstring(ls, 2))
		face = lua_tostring(ls, 2);

	if (args > 2 && lua_isnumber(ls, 3))
		size = (int)lua_tonumber(ls, 3);

	if (args > 3 && lua_isnumber(ls, 4))
		style = (int)lua_tonumber(ls, 4);

	o->SetFont(face, size, style);
	return 0;
}
开发者ID:McManning,项目名称:fro_client,代码行数:28,代码来源:EntityLib.cpp


示例2: makeIdFromPointer

void GrimEngine::saveTextObjects(SaveGame *state) {
	PointerId ptr;

	state->beginSection('TEXT');

	state->writeLESint32(sayLineDefaults.disabled);
	state->writeByte(sayLineDefaults.fgColor.red());
	state->writeByte(sayLineDefaults.fgColor.green());
	state->writeByte(sayLineDefaults.fgColor.blue());
	ptr = makeIdFromPointer(sayLineDefaults.font);
	state->writeLEUint32(ptr.low);
	state->writeLEUint32(ptr.hi);
	state->writeLESint32(sayLineDefaults.height);
	state->writeLESint32(sayLineDefaults.justify);
	state->writeLESint32(sayLineDefaults.width);
	state->writeLESint32(sayLineDefaults.x);
	state->writeLESint32(sayLineDefaults.y);

	state->writeLESint32(_textObjects.size());
	for (TextListType::iterator i = _textObjects.begin(); i != _textObjects.end(); ++i) {
		TextObject *t = *i;
		ptr = makeIdFromPointer(t);
		state->writeLEUint32(ptr.low);
		state->writeLEUint32(ptr.hi);
		t->saveState(state);
	}

	state->endSection();
}
开发者ID:jvprat,项目名称:residual,代码行数:29,代码来源:grim.cpp


示例3: entity_SetText

//	.SetText(ent, "text", r, g, b, maxWidth<0>) - Set displayed text of a text object entity
int entity_SetText(lua_State* ls)
{
	luaCountArgs(ls, 2);

	int args = lua_gettop(ls);
	int width = 0;
	color c;
	string text;

	TextObject* o = (TextObject*)_getReferencedEntity(ls);
	if (!o || o->mType != ENTITY_TEXT)
	{
		return luaError(ls, "Entity.SetText", "Invalid Entity type");
	}

	text = lua_tostring(ls, 2);
	c.r = (int)lua_tonumber(ls, 3);
	c.g = (int)lua_tonumber(ls, 4);
	c.b = (int)lua_tonumber(ls, 5);

	if (args > 5)
		width = (int)lua_tonumber(ls, 6);

	o->SetText(text, c, width);
	return 0;
}
开发者ID:McManning,项目名称:fro_client,代码行数:27,代码来源:EntityLib.cpp


示例4:

bool Gwen::Utility::Strings::Wildcard( const TextObject& strWildcard, const TextObject& strHaystack )
{
	const UnicodeString& W = strWildcard.GetUnicode();
	const UnicodeString& H = strHaystack.GetUnicode();

	if ( strWildcard == "*" ) return true;

	int iPos = W.find( L"*", 0 );
	if ( iPos == UnicodeString::npos ) return strWildcard == strHaystack;

	// First half matches
	if ( iPos > 0 && W.substr( 0, iPos ) != H.substr( 0, iPos ) )
		return false;

	// Second half matches
	if ( iPos != W.length()-1 )
	{
		UnicodeString strEnd = W.substr( iPos+1, W.length() );

		if ( strEnd != H.substr( H.length() - strEnd.length(), H.length() ) )
			return false;
	}

	return true;
}
开发者ID:charliesome,项目名称:battlecars,代码行数:25,代码来源:Utility.cpp


示例5: report

Task::ReportResult GTest_CheckStringExists::report() {
    TextObject *obj = getContext<TextObject>(this, objContextName);
    if (obj == NULL) {
        stateInfo.setError(QString("invalid object context"));
        return ReportResult_Finished;
    }

    QString stringToFind = QRegExp::escape(stringToCheck);
    if (wholeLine) {
        stringToFind = "^(.*\\n)?" + QRegExp::escape(stringToCheck) + "(\\n.*)?$";
    }

    const QString text = obj->getText();
    int index = text.indexOf(QRegExp(stringToFind));

    if (mustExist) {
        if (-1 == index) {
            stateInfo.setError(QString("String doesn't exist: '%1'").arg(stringToCheck));
        }
    } else {
        if (-1 != index) {
            stateInfo.setError(QString("String unexpectedly exists: '%1' at position %2").arg(stringToCheck).arg(index));
        }
    }

    return ReportResult_Finished;
}
开发者ID:m-angelov,项目名称:ugene,代码行数:27,代码来源:TextObjectTests.cpp


示例6: setBulletObject

void LetterHunter::shootCheck(wchar_t key)
{
	if (currentTextObject_)
	{
		BaseLetter* letterOjbect = currentTextObject_->getFirstActiveLetterObject();
		if (key == letterOjbect->getLetter())
		{
			// Set the bullet object based on the letter object.
			setBulletObject(letterOjbect);

			// Play sound for the bullet
			soundManager_->onShoot();
		}
		else
		{
			// Warn user where is the target text object is, may be need some highlight mechnism.
		}
	}

	else
	{
		TextObject* targetTextObject = findTarget(key);
		if(targetTextObject)
		{
			currentTextObject_ = targetTextObject;
			BaseLetter* letterOjbect = targetTextObject->getFirstActiveLetterObject();
			setBulletObject(letterOjbect);
			soundManager_->onShoot();
		}
	}
}
开发者ID:BillyKim,项目名称:directxcode,代码行数:31,代码来源:LetterHunter.cpp


示例7: lua_getparam

/* Make changes to a text object based on the parameters passed
 * in the table in the LUA parameter 2.
 */
void Lua_V1::ChangeTextObject() {
	const char *line;
	lua_Object textObj = lua_getparam(1);
	int paramId = 2;
	if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
		TextObject *textObject = gettextobject(textObj);
		for (;;) {
			lua_Object paramObj = lua_getparam(paramId++);
			if (!paramObj)
				break;
			if (!lua_isstring(paramObj)) {
				if (!lua_istable(paramObj))
					break;
				setTextObjectParams(textObject, paramObj);
				textObject->destroy();
			} else {
				line = lua_getstring(paramObj);
				textObject->setText(line);
				lua_getstring(paramObj);

			}

			lua_pushnumber(textObject->getBitmapWidth());
			lua_pushnumber(textObject->getBitmapHeight());
		}
	}
}
开发者ID:Grimfan33,项目名称:residual,代码行数:30,代码来源:lua_v1_text.cpp


示例8: lua_getparam

void Lua_V1::GetTextObjectDimensions() {
	lua_Object textObj = lua_getparam(1);

	if (lua_isuserdata(textObj) && lua_tag(textObj) == MKTAG('T', 'E', 'X', 'T')) {
		TextObject *textObject = gettextobject(textObj);
		lua_pushnumber(textObject->getBitmapWidth());
		lua_pushnumber(textObject->getBitmapHeight());
	}
}
开发者ID:salty-horse,项目名称:residualvm,代码行数:9,代码来源:lua_v1_text.cpp


示例9:

void violet::HUD::addMessage(std::string message) {
	std::cout << message << std::endl;

	TextObject* msg = m_videoManager->SmallText->getObject(message, 0, 0,
			TextManager::LEFT, TextManager::MIDDLE);

	// Here scale is the variable for control over animation sequence
	msg->Scale = m_videoManager->getVideoMode().Width + msg->getWidth();

	m_messages.push_back(msg);
}
开发者ID:bla-rs,项目名称:Experimental,代码行数:11,代码来源:HUD.cpp


示例10:

void violet::TextManager::draw(const std::string& textBuf, float x, float y,
		TextHAlignFlag halign, TextVAlignFlag valign) {
	if (textBuf.size() == 0)
		return;

	TextObject *textObject = TextManager::getObject(textBuf, x, y, halign,
			valign);

	textObject->draw(true, textObject->X, textObject->Y);
	delete textObject;
}
开发者ID:chronweigle,项目名称:violetland,代码行数:11,代码来源:TextManager.cpp


示例11: RuntimeObject

RuntimeTextObject::RuntimeTextObject(RuntimeScene& scene,
                                     const TextObject& textObject)
    : RuntimeObject(scene, textObject), opacity(255), angle(0) {
  ChangeFont(textObject.GetFontName());
  SetSmooth(textObject.IsSmoothed());
  SetColor(
      textObject.GetColorR(), textObject.GetColorG(), textObject.GetColorB());
  SetString(textObject.GetString());
  SetCharacterSize(textObject.GetCharacterSize());
  SetAngle(0);
  SetBold(textObject.IsBold());
  SetItalic(textObject.IsItalic());
  SetUnderlined(textObject.IsUnderlined());
}
开发者ID:Lizard-13,项目名称:GD,代码行数:14,代码来源:TextObject.cpp


示例12: SetImage

void Button::SetImage( const TextObject & strName, bool bCenter )
{
	if ( strName.GetUnicode() == L"" )
	{
		if ( m_Image )
		{
			delete m_Image;
			m_Image = NULL;
		}

		return;
	}

	if ( !m_Image )
	{
		m_Image = new ImagePanel( this );
	}

	m_Image->SetImage( strName );
	m_Image->SizeToContents();
	m_Image->SetMargin( Margin( 2, 0, 2, 0 ) );
	m_bCenterImage = bCenter;
	// Ugh.
	Padding padding = GetTextPadding();
	padding.left = m_Image->Right() + 2;
	SetTextPadding( padding );
}
开发者ID:DashAndSlash,项目名称:GWEN,代码行数:27,代码来源:Button.cpp


示例13: SetString

void Text::SetString( const TextObject& str )
{ 
	if ( m_String == str ) return;

	m_String = str.GetUnicode(); 
	m_bTextChanged = true;
	Invalidate();
}
开发者ID:r-lyeh,项目名称:moon9,代码行数:8,代码来源:Text.cpp


示例14: randomString

void LetterHunter::initializeText()
{
	ID2D1Factory*			D2DFactory		= d2d_->getD2DFactory();
	ID2D1HwndRenderTarget*	renderTarget	= d2d_->getD2DHwndRenderTarget();
	IDWriteFactory*			DWriteFactory	= d2d_->getDWriteFactory();

	for(int i = 0; i < TEXTCOUNT; ++i)
	{
		// Geneate a random string
		const int strLength = 1;
		wchar_t* strBuffer = new wchar_t[strLength + 1];
		randomString(strBuffer, strLength);

		TextObject* textObj = new TextObject(
			D2DFactory,
			renderTarget,
			DWriteFactory,
			strBuffer,
			100
			);

		SAFE_DELETE(strBuffer);

		// Generate 10 random numbers between 1 and 100
		float a[10] = {0};
		float velocityY = randomFloat(10.0f, 50.0f);
		D2D_VECTOR_2F velocity = {0, velocityY};

		// Set text position
		float windowWidth = (float)getwindowWidth();
		D2D1_RECT_F textBoundRect = textObj->getBoundaryRect();
		float maxRight = windowWidth - (textBoundRect.right -textBoundRect.left);

		float positionX = randomFloat(0, maxRight);
		D2D1_POINT_2F position = {positionX, 0};
		textObj->setPosition(position);

		// Set text velocity
		textObj->setVelocity(velocity);

		D2D1_COLOR_F fillColor = randomColor();
		textObj->setFillColor(fillColor);

		textBuffer_.push_back(textObj);
	}
}
开发者ID:BillyKim,项目名称:directxcode,代码行数:46,代码来源:LetterHunter.cpp


示例15: TextObject

void BinkPlayer::handleFrame() {
	MoviePlayer::handleFrame();

	if (!_showSubtitles || _subtitleIndex == _subtitles.end())
		return;

	unsigned int startFrame, endFrame, curFrame;
	startFrame = _subtitleIndex->_startFrame;
	endFrame = _subtitleIndex->_endFrame;
	curFrame = _videoDecoder->getCurFrame();
	if (startFrame <= curFrame && curFrame <= endFrame) {
		if (!_subtitleIndex->active) {
			TextObject *textObject = new TextObject();
			textObject->setDefaults(&g_grim->_sayLineDefaults);
			Color c(255, 255, 255);
			textObject->setFGColor(c);
			textObject->setIsSpeech();
			if (g_grim->getMode() == GrimEngine::SmushMode) {
				// TODO: How to center exactly and put the text exactly
				// at the bottom  even if there are multiple lines?
				textObject->setX(640 / 2);
				textObject->setY(40);
			}
			textObject->setText(g_localizer->localize(_subtitleIndex->_textId.c_str()));
			g_grim->setMovieSubtitle(textObject);
			_subtitleIndex->active = true;
		}
	} else if (endFrame < curFrame) {
		if (_subtitleIndex->active) {
			g_grim->setMovieSubtitle(NULL);
			_subtitleIndex->active = false;
			_subtitleIndex++;
		}
	}
}
开发者ID:Harrypoppins,项目名称:grim_mouse,代码行数:35,代码来源:bink.cpp


示例16: Render

void TextComponent_BullShit::Render()
{
	int charIndex = 0;
	TextObject* textObj;
	SpriteComponent * textSprite;
	while (text[charIndex] != '\0')
	{
		textObj = OpenGLRenderer::GetRenderer()->GetCharacterImage(text[charIndex]);
		
		textSprite = textObj->GetTextSprite();

		textSprite->SetHidden(false);
		textSprite->SetPosition(GetPosition() + Vect2(charIndex * CHAR_WIDTH, 0));
		textSprite->Render();
		textSprite->SetHidden(true);
	
		++charIndex;
	}
}
开发者ID:jahandideh-iman,项目名称:OpenGLES_ProjectCars,代码行数:19,代码来源:TextComponent_BullShit.cpp


示例17: drawText

	void OverlayRenderer::drawText(const TextObject & text)
	{
		glDisable(GL_DEPTH_TEST);

		text.getFont().getTexture().bind(0);

		textShader.enable();
		textShader.setUniformVec2f("offset", text.getPosition());
		textShader.setUniformVec4f("tint", text.getColor());
		textShader.setUniformInt("overlayTexture", 0);
		textShader.setUniformMatrix4x4f("projectionMatrix", projection);

		text.draw();

		textShader.disable();
		
		text.getFont().getTexture().unbind();

		glEnable(GL_DEPTH_TEST);


	}
开发者ID:azzuriel,项目名称:thesis-cuda-sparse-voxel-octree,代码行数:22,代码来源:OverlayRenderer.cpp


示例18: SetAccelerator

void MenuItem::SetAccelerator( const TextObject& strAccelerator )
{
	if ( m_Accelerator ) 
	{
		m_Accelerator->DelayedDelete();
		m_Accelerator = NULL;
	}
#ifndef GWEN_NO_UNICODE
	if ( strAccelerator.GetUnicode() == L"" )
		return;
#else
	if ( strAccelerator.Get() == "" )
		return;
#endif


	m_Accelerator = new Controls::Label( this );
	m_Accelerator->Dock( Pos::Right );
	m_Accelerator->SetAlignment( Pos::Right | Pos::CenterV );
	m_Accelerator->SetText( strAccelerator );
	m_Accelerator->SetMargin( Margin( 0, 0, 16, 0 ) );
	// TODO.
}
开发者ID:fpoussin,项目名称:ChibiOS-Gwen,代码行数:23,代码来源:MenuItem.cpp


示例19: recursiveSearch

void recursiveSearch( GroupObject* group, ofstream &out )
{
    if (!group) return;

    for( unsigned i=0; i<group->objectCount(); i++ )
        {
	    Object* object = group->object(i);
	    if( object->isText() )
	        {
	    	    TextObject* T = static_cast<TextObject*>(object);
		    if(T)
			{
//			    out << "  " << T->typeAsString() << " (" << T->listSize() << "): ";

			    bool	written = false;
			    for (int j=0; j<T->listSize(); j++)
				{
				    if (T->text(j).cstring().c_str()!=NULL
					&& T->text(j).cstring().c_str()[0]!='\0'
					&& strncmp(T->text(j).cstring().c_str(),"Click to edit",13)
					&& strncmp(T->text(j).cstring().c_str(),"Klikk for å redigere",20))
					{
					    if (!written)
						{
						    if (!textonly)
							{
							    if (T->type()==TextObject::Body || T->type()==TextObject::CenterBody
								|| T->type()==TextObject::HalfBody || T->type()==TextObject::QuarterBody)
								out << "<p>";
							    else if (T->type()==TextObject::Title || T->type()==TextObject::CenterTitle)
								out << "<h2>";
							    else out << "<div>";
							}

						    written = true;
						}

					    if (!textonly) out << "<span>";
					    out << T->text(j).cstring().c_str();
					    if (!textonly) out << "</span> ";
					}
				}

			    if (written && !textonly)
				{
				    if (T->type()==TextObject::Body || T->type()==TextObject::CenterBody
					|| T->type()==TextObject::HalfBody || T->type()==TextObject::QuarterBody)
					out << "</p>";
				    else if (T->type()==TextObject::Title || T->type()==TextObject::CenterTitle)
					out << "</h2>";
				    else out << "</div>";
				    out << endl;
				}
			    else
				out << endl;
			}
    		}

	    if( object->isGroup() )
	        recursiveSearch( static_cast<GroupObject*>(object), out );
	}
}
开发者ID:FlavioFalcao,项目名称:enterprise-search,代码行数:62,代码来源:ppt2html.cpp


示例20: getWorldPos

void Actor::draw() {
	for (Common::List<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); ++i) {
		Costume *c = *i;
		c->setupTextures();
	}

	if (!g_driver->isHardwareAccelerated() && g_grim->getFlagRefreshShadowMask()) {
		for (int l = 0; l < MAX_SHADOWS; l++) {
			if (!_shadowArray[l].active)
				continue;
			g_driver->setShadow(&_shadowArray[l]);
			g_driver->drawShadowPlanes();
			g_driver->setShadow(NULL);
		}
	}

	// FIXME: if isAttached(), factor in the joint & actor rotation as well.
	Math::Vector3d absPos = getWorldPos();
	if (!_costumeStack.empty()) {
		g_grim->getCurrSet()->setupLights(absPos);

		Costume *costume = _costumeStack.back();
		for (int l = 0; l < MAX_SHADOWS; l++) {
			if (!shouldDrawShadow(l))
				continue;
			g_driver->setShadow(&_shadowArray[l]);
			g_driver->setShadowMode();
			if (g_driver->isHardwareAccelerated())
				g_driver->drawShadowPlanes();
			g_driver->startActorDraw(absPos, _scale, _yaw, _pitch, _roll, _inOverworld, _alphaMode != AlphaOff ? _globalAlpha : 1.f);
			costume->draw();
			g_driver->finishActorDraw();
			g_driver->clearShadowMode();
			g_driver->setShadow(NULL);
		}

		bool isShadowCostume = costume->getFilename().equals("fx/dumbshadow.cos");
		if (!isShadowCostume || _shadowActive) {
			// normal draw actor
			g_driver->startActorDraw(absPos, _scale, _yaw, _pitch, _roll, _inOverworld, _alphaMode != AlphaOff ? _globalAlpha : 1.f);
			costume->draw();
			g_driver->finishActorDraw();
		}
	}

	if (_mustPlaceText) {
		int x1, y1, x2, y2;
		x1 = y1 = 1000;
		x2 = y2 = -1000;
		if (!_costumeStack.empty()) {
			g_driver->startActorDraw(absPos, _scale, _yaw, _pitch, _roll, _inOverworld, 1.f);
			_costumeStack.back()->getBoundingBox(&x1, &y1, &x2, &y2);
			g_driver->finishActorDraw();
		}

		TextObject *textObject = TextObject::getPool().getObject(_sayLineText);
		if (textObject) {
			if (x1 == 1000 || x2 == -1000 || y2 == -1000) {
				textObject->setX(640 / 2);
				textObject->setY(463);
			} else {
				textObject->setX((x1 + x2) / 2);
				textObject->setY(y1);
			}
			textObject->reset();
		}
		_mustPlaceText = false;
	}
}
开发者ID:gbraad,项目名称:residualvm,代码行数:69,代码来源:actor.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ TextOutput类代码示例发布时间:2022-05-31
下一篇:
C++ TextNode类代码示例发布时间: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