当前位置: 首页>>代码示例>>C++>>正文


C++ Label::GetText方法代码示例

本文整理汇总了C++中Label::GetText方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::GetText方法的具体用法?C++ Label::GetText怎么用?C++ Label::GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Label的用法示例。


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

示例1: SetUpCombatantMap

void StatsPanel::SetUpCombatantMap(){
	int labelsPosX[] = {5,170,5,170,5,5};
	int labelsPosY[] = {160,160,230,230,300,370};
	std::string labelsString[] = {"Strength","Endure","Technique","Speed","Health","Endurance"};
	for (int x = 0; x < 6; x++){
		Label* element = new Label(labelsPosX[x],labelsPosY[x],"blank.png",Label::Fonts::Game,labelsString[x] + ":");
		AddCombatantElement(MyPair(std::to_string(x), element));
		if(x < 4){
			Label* valueElement = new Label(labelsPosX[x] + element->GetText()->getLocalBounds().width + 15,labelsPosY[x],"blank.png",Label::Fonts::Game,"null");
			AddCombatantElement(MyPair(labelsString[x] + "Value",valueElement));
		}
		else{
			float tempFloat = 1;
			ProgressBar* progBar = new ProgressBar(labelsPosX[x] + element->GetText()->getLocalBounds().width + 15,labelsPosY[x], 180, &tempFloat);
			AddCombatantElement(MyPair(labelsString[x] + "Bar",progBar));
		}
	}
	Button* tempButton = new Button(127.5,15,"attacktextures/background.png","attacktextures/default.png");
	tempButton->SetTarget(this);
	tempButton->SetFunction("none");
	tempButton->CenterForeground();
	AddCombatantElement(MyPair("Image",tempButton));
	Label* label = new Label(103,110,120,"menubackground.png",Label::Fonts::Game,"null");
	label->CenterText();
	AddCombatantElement(MyPair("Name",label));
    	Drawn* barPlaceHolder = new Drawn("blank.png");
	barPlaceHolder->SetPosition(sf::Vector2f(0,0));
	barPlaceHolder->texturePart.height = 35;
	barPlaceHolder->texturePart.width = GetSize().x;
	barPlaceHolder->SetRotation(0);
	barPlaceHolder->SetZ(2);
	combatantMap.insert(MyPair("barPlaceHolder",barPlaceHolder));
};
开发者ID:zachprinz,项目名称:2D_Graphics_Study,代码行数:33,代码来源:StatsPanel.cpp

示例2: SetOrgin

void RClickMenu::SetOrgin(Orgins orgin){
	for(int x = 0; x < labels.size(); x++){
		Label* tempLabel = labels[x];
		sf::Sprite* tempSprite = tempLabel->GetSprite();
		sf::Vector2f halfSize = sf::Vector2f(tempLabel->GetSize().x / 2,tempLabel->GetSize().y / 2);
		sf::Text* tempText = tempLabel->GetText();
		switch(orgin){
			case(TopLeft):
				tempLabel->SetOrgin(0,0);
				tempLabel->CenterText();
				break;
			case(TopRight):
				tempLabel->SetOrgin(halfSize.x * 2,0);
				tempLabel->CenterText();
				break;
			case(BottomLeft):
				tempLabel->SetOrgin(0,halfSize.y * 2);
				tempLabel->CenterText();
				break;
			case(BottomRight):
				tempLabel->SetOrgin(halfSize.x * 2,halfSize.y * 2);
				tempLabel->CenterText();
				break;
		}
	}
};
开发者ID:zachprinz,项目名称:2D_Graphics_Study,代码行数:26,代码来源:RClickMenu.cpp

示例3: BaseClass

	CGameChapterPanel( CNewGameDialog *parent, const char *name, const char *chapterName, int chapterIndex, const char *chapterNumber, const char *chapterConfigFile, bool bCommentary ) : BaseClass( parent, name )
	{
		Q_strncpy( m_szConfigFile, chapterConfigFile, sizeof(m_szConfigFile) );
		Q_strncpy( m_szChapter, chapterNumber, sizeof(m_szChapter) );

		m_pLevelPicBorder = SETUP_PANEL( new ImagePanel( this, "LevelPicBorder" ) );
		m_pLevelPic = SETUP_PANEL( new ImagePanel( this, "LevelPic" ) );
		m_pCommentaryIcon = NULL;
		m_bCommentaryMode = bCommentary;

		wchar_t text[32];
		wchar_t num[32];
		wchar_t *chapter = g_pVGuiLocalize->Find("#GameUI_Chapter");
		g_pVGuiLocalize->ConvertANSIToUnicode( chapterNumber, num, sizeof(num) );
		_snwprintf( text, sizeof(text), L"%s %s", chapter ? chapter : L"CHAPTER", num );

		if ( ModInfo().IsSinglePlayerOnly() )
		{
			m_pChapterLabel = new Label( this, "ChapterLabel", text );
			m_pChapterNameLabel = new Label( this, "ChapterNameLabel", chapterName );
		}
		else
		{
			m_pChapterLabel = new Label( this, "ChapterLabel", chapterName );
			m_pChapterNameLabel = new Label( this, "ChapterNameLabel", "#GameUI_LoadCommentary" );
		}

		SetPaintBackgroundEnabled( false );

		// the image has the same name as the config file
		char szMaterial[ MAX_PATH ];
		Q_snprintf( szMaterial, sizeof(szMaterial), "chapters/%s", chapterConfigFile );
		char *ext = strstr( szMaterial, "." );
		if ( ext )
		{
			*ext = 0;
		}
		m_pLevelPic->SetImage( szMaterial );

		KeyValues *pKeys = NULL;
		LoadControlSettings( "Resource/NewGameChapterPanel.res", NULL, pKeys );

		int px, py;
		m_pLevelPicBorder->GetPos( px, py );
		SetSize( m_pLevelPicBorder->GetWide(), py + m_pLevelPicBorder->GetTall() );

		// create a selection panel the size of the page
		CSelectionOverlayPanel *overlay = new CSelectionOverlayPanel( this, parent, chapterIndex );
		overlay->SetBounds(0, 0, GetWide(), GetTall());
		overlay->MoveToFront();

		// HACK: Detect new episode teasers by the "Coming Soon" text
		wchar_t w_szStrTemp[256];
		m_pChapterNameLabel->GetText( w_szStrTemp, sizeof(w_szStrTemp)  );
		m_bTeaserChapter = !wcscmp(w_szStrTemp, L"Coming Soon");
		m_bHasBonus = false;
	}
开发者ID:RubberWar,项目名称:Portal-2,代码行数:57,代码来源:vsingleplayer.cpp

示例4: GetLabel

//---------------------------------------
std::string Button::GetLabel() const
{
	std::string result;
	Label* labelElement = GetLabelElement();

	if( labelElement )
	{
		// Get the text of the label.
		result = labelElement->GetText();
	}
	else
	{
		WarnFail( "Could not get label for Button \"%s\" because no label element \"%s\" was found!", GetFullName().c_str(), mLabelElementName.GetCString() );
	}

	return result;
}
开发者ID:andrewtc,项目名称:AndroidWars,代码行数:18,代码来源:Button.cpp

示例5: InterpretType

void ReflectInterpreter::InterpretType(const std::vector<Reflect::Element*>& instances, Container* parent, i32 includeFlags, i32 excludeFlags, bool expandPanel)
{
  const Class* typeInfo = instances[0]->GetClass();
  
  // create a panel
  PanelPtr panel = m_Container->GetCanvas()->Create<Panel>(this);

  // parse
  ContainerPtr scriptOutput = m_Container->GetCanvas()->Create<Container>(this);

  tstring typeInfoUI;
  typeInfo->GetProperty( TXT( "UIScript" ), typeInfoUI );
  bool result = Script::Parse(typeInfoUI, this, parent->GetCanvas(), scriptOutput);

  // compute panel label
  tstring labelText;
  if (result)
  {
    V_Control::const_iterator itr = scriptOutput->GetControls().begin();
    V_Control::const_iterator end = scriptOutput->GetControls().end();
    for( ; itr != end; ++itr )
    {
      Label* label = Reflect::ObjectCast<Label>( *itr );
      if (label)
      {
          bool converted = Helium::ConvertString( label->GetText(), labelText );
          HELIUM_ASSERT( converted );
            
        if ( !labelText.empty() )
        {
          break;
        }
      }
    }
  }

  if (labelText.empty())
  {
    std::vector<Reflect::Element*>::const_iterator itr = instances.begin();
    std::vector<Reflect::Element*>::const_iterator end = instances.end();
    for ( ; itr != end; ++itr )
    {
      Reflect::Element* instance = *itr;

      if ( labelText.empty() )
      {
        labelText = instance->GetTitle();
      }
      else
      {
        if ( labelText != instance->GetTitle() )
        {
          labelText.clear();
          break;
        }
      }
    }

    if ( labelText.empty() )
    {
      labelText = typeInfo->m_UIName;
    }
  }

  tstring temp;
  bool converted = Helium::ConvertString( labelText, temp );
  HELIUM_ASSERT( converted );

  panel->SetText( temp );

  M_Panel panelsMap;
  panelsMap.insert( std::make_pair( TXT( "" ), panel) );

  // don't bother including Element's fields
  int offset = Reflect::GetClass<Element>()->m_LastFieldID;

  // for each field in the type
  M_FieldIDToInfo::const_iterator itr = typeInfo->m_FieldIDToInfo.find(offset + 1);
  M_FieldIDToInfo::const_iterator end = typeInfo->m_FieldIDToInfo.end();
  for ( ; itr != end; ++itr )
  {
    const Field* field = itr->second;

    bool noFlags = ( field->m_Flags == 0 && includeFlags == 0xFFFFFFFF );
    bool doInclude = ( field->m_Flags & includeFlags ) != 0;
    bool dontExclude = ( excludeFlags == 0 ) || !(field->m_Flags & excludeFlags );
    bool hidden = (field->m_Flags & Reflect::FieldFlags::Hide) != 0; 

    // if we don't have flags (or we are included, and we aren't excluded) then make UI
    if ( ( noFlags || doInclude ) && ( dontExclude ) )
    {
      //
      // Handle sub panels for grouping content
      // 

      bool groupExpanded = false;
      field->GetProperty( TXT( "UIGroupExpanded" ), groupExpanded );

      tstring fieldUIGroup;
      field->GetProperty( TXT( "UIGroup" ), fieldUIGroup );
//.........这里部分代码省略.........
开发者ID:pthiben,项目名称:Helium,代码行数:101,代码来源:ReflectInterpreter.cpp


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