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

C++ AddComponent函数代码示例

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

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



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

示例1: WindowActivity

ServerSaveActivity::ServerSaveActivity(SaveInfo save, bool saveNow, ServerSaveActivity::SaveUploadedCallback * callback) :
	WindowActivity(ui::Point(-1, -1), ui::Point(200, 50)),
	thumbnailRenderer(nullptr),
	save(save),
	callback(callback),
	saveUploadTask(NULL)
{
	ui::Label * titleLabel = new ui::Label(ui::Point(0, 0), Size, "Saving to server...");
	titleLabel->SetTextColour(style::Colour::InformationTitle);
	titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
	titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	AddComponent(titleLabel);

	AddAuthorInfo();

	saveUploadTask = new SaveUploadTask(this->save);
	saveUploadTask->AddTaskListener(this);
	saveUploadTask->Start();
}
开发者ID:simtr,项目名称:The-Powder-Toy,代码行数:19,代码来源:ServerSaveActivity.cpp


示例2: while

void test::TestEntityComponentAttachment() {
    auto entities = new stoked::EntityPool(2);
    auto componentPoolA = new stoked::ComponentPool<ComponentA>(4);
    auto componentPoolB = new stoked::ComponentPool<ComponentB>(4);

    while (entities->Available()) {
        auto e1 = entities->Create();
        auto a = componentPoolA->Get();
        auto b = componentPoolB->Get();

        bool resA = e1->AddComponent(a);
        bool resB = e1->AddComponent(b);

        assert(resA);
        assert(resB);
    }

    PASSED();
}
开发者ID:cdave1,项目名称:stoked,代码行数:19,代码来源:test.cpp


示例3: lock

			int Storage::AddRepo (const RepoInfo& ri)
			{
				Util::DBLock lock (DB_);
				try
				{
					lock.Init ();
				}
				catch (const std::runtime_error& e)
				{
					qWarning () << Q_FUNC_INFO
							<< "could not acquire DB lock";
					throw;
				}

				QueryAddRepo_.bindValue (":url", Slashize (ri.GetUrl ()).toEncoded ());
				QueryAddRepo_.bindValue (":name", ri.GetName ());
				QueryAddRepo_.bindValue (":description", ri.GetShortDescr ());
				QueryAddRepo_.bindValue (":longdescr", ri.GetLongDescr ());
				QueryAddRepo_.bindValue (":maint_name", ri.GetMaintainer ().Name_);
				QueryAddRepo_.bindValue (":maint_email", ri.GetMaintainer ().Email_);
				if (!QueryAddRepo_.exec ())
				{
					Util::DBLock::DumpError (QueryAddRepo_);
					throw std::runtime_error ("Query execution failed.");
				}

				QueryAddRepo_.finish ();

				int repoId = FindRepo (Slashize (ri.GetUrl ()));
				if (repoId == -1)
				{
					qWarning () << Q_FUNC_INFO
							<< "OH SHI~, just inserted repo cannot be found!";
					throw std::runtime_error ("Just inserted repo cannot be found.");
				}

				Q_FOREACH (const QString& component, ri.GetComponents ())
					AddComponent (repoId, component);

				lock.Good ();

				return repoId;
			}
开发者ID:grio,项目名称:leechcraft,代码行数:43,代码来源:storage.cpp


示例4: itLED

 void CDirectionalLEDEquippedEntity::Init(TConfigurationNode& t_tree) {
    try {
       /* Init parent */
       CComposableEntity::Init(t_tree);
       /* Go through the led entries */
       TConfigurationNodeIterator itLED("directional_led");
       for(itLED = itLED.begin(&t_tree);
           itLED != itLED.end();
           ++itLED) {
          /* Initialise the LED using the XML */
          CDirectionalLEDEntity* pcLED = new CDirectionalLEDEntity(this);
          pcLED->Init(*itLED);
          CVector3 cPositionOffset;
          GetNodeAttribute(*itLED, "position", cPositionOffset);
          CQuaternion cOrientationOffset;
          GetNodeAttribute(*itLED, "orientation", cOrientationOffset);
          /* Parse and look up the anchor */
          std::string strAnchorId;
          GetNodeAttribute(*itLED, "anchor", strAnchorId);
          /*
           * NOTE: here we get a reference to the embodied entity
           * This line works under the assumption that:
           * 1. the DirectionalLEDEquippedEntity has a parent;
           * 2. the parent has a child whose id is "body"
           * 3. the "body" is an embodied entity
           * If any of the above is false, this line will bomb out.
           */
          CEmbodiedEntity& cBody =
             GetParent().GetComponent<CEmbodiedEntity>("body");
          /* Add the LED to this container */
          m_vecInstances.emplace_back(*pcLED,
                                      cBody.GetAnchor(strAnchorId),
                                      cPositionOffset,
                                      cOrientationOffset);
          AddComponent(*pcLED);
       }
       UpdateComponents();
    }
    catch(CARGoSException& ex) {
       THROW_ARGOSEXCEPTION_NESTED("Failed to initialize directional LED equipped entity \"" <<
                                   GetContext() + GetId() << "\".", ex);
    }
 }
开发者ID:ilpincy,项目名称:argos3,代码行数:43,代码来源:directional_led_equipped_entity.cpp


示例5: VisTriggerTargetComponent_cl

void GameState::InitFunction()
{
  // Add target component
  VisTriggerTargetComponent_cl *pTargetComp = new VisTriggerTargetComponent_cl();
  AddComponent(pTargetComp);

  // Get trigger box entity
  VisBaseEntity_cl *pTriggerBoxEntity = Vision::Game.SearchEntity("TriggerBox");
  VASSERT(pTriggerBoxEntity);

  // Find source component
  VisTriggerSourceComponent_cl* pSourceComp = vstatic_cast<VisTriggerSourceComponent_cl*>(
    pTriggerBoxEntity->Components().GetComponentOfTypeAndName(VisTriggerSourceComponent_cl::GetClassTypeId(), "OnObjectEnter"));
  VASSERT(pSourceComp != NULL);

  // Link source and target component 
  IVisTriggerBaseComponent_cl::OnLink(pSourceComp, pTargetComp);
  
  m_eState = GAME_STATE_RUN;
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:20,代码来源:GameState.cpp


示例6: m_timer

    PlayerProjectile::PlayerProjectile(const float direction, const float speed)
        : uth::GameObject(),
          m_timer(0.f),
          m_direction()
    {
        // Load a texture and create a sprite component.
        auto tex = uthRS.LoadTexture("enemy.png");
        AddComponent(new uth::Sprite(tex));

        SetActive(true);

        // Compute a rotation vector from the given angle. (This doesn't currently work for some reason)
        const float sine = pmath::sin(direction);
        m_direction.x = sine * 1.f;
        m_direction.y = sine * m_direction.x + pmath::cos(direction) * 1.f;

        m_direction.normalize();
        m_direction.x *= speed;
        m_direction.y *= speed;
    }
开发者ID:Team-Innis,项目名称:Melee2D-Tutorial,代码行数:20,代码来源:PlayerProjectile.cpp


示例7: SetName

	void GameObject::LoadFloor()
	{
		SetName("Floor");
		auto meshComponent = MeshComponentPtr(
			new MeshComponent(
				MeshManager::Get().GetMesh("floor.mm"),
				PngManager::Get().GetPngTexture("MartEngine.png")
			)
		);

		SetScale(10.f);

		SetRotation(Quaternion(Vector3(0.0f, 0.0f, 0.0f), 0.0f));

		SetTranslation(Vector3(0.0f, 5.0f, 0.0f));

		AddComponent(meshComponent);

		//AddComponent(std::make_shared<Plane>(Vector3(0,0,0),Vector3(0,1,0)));
	}
开发者ID:Matt-Carey,项目名称:MartEngine,代码行数:20,代码来源:GameObject.cpp


示例8: AddComponent

bool PackAnimation::CreateFramePart(const ee::SprConstPtr& spr, Frame& frame)
{	
	const IPackNode* node = PackNodeFactory::Instance()->Create(spr);

	PackAnimation::Part part;

	CU_STR name;
	s2::SprNameMap::Instance()->IDToStr(spr->GetName(), name);
	if (Utility::IsNameValid(name.c_str())) {
		name = name;
	}

	bool force_mat = false;
	bool new_comp = AddComponent(node, name.c_str(), part.comp_idx, force_mat);
	PackAnimation::LoadSprTrans(spr, part.t, force_mat);

	frame.parts.push_back(part);

	return new_comp;
}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:20,代码来源:PackAnimation.cpp


示例9: UI_REGISTER

SelectionWindow::SelectionWindow(Rect dimensions):UIBase(){
    UI_REGISTER(SelectionWindow);
    box = dimensions;
    optionCounter = 0;
    mother = nullptr;
    box.x = dimensions.x;
    box.y = dimensions.y;
    OnMousePress = [=](UIBase*w,int button,Point pos){
        SetFocused(true);
    };
    selectedOption = -1;
    arrow = Text(style.fontfile,style.fontSize,style.txtstyle,">", {style.fg[0],style.fg[1],style.fg[2]} );
    Back = [=](UIBase *b){
    };
    title = new Label(Point(dimensions.w/2 -16,2),std::string(""),this);
    title->style.fg[0] = 255;
    title->style.txtstyle = TEXT_BLENDED;
    AddComponent(title);


}
开发者ID:mockthebear,项目名称:bear-engine,代码行数:21,代码来源:selectionwindow.cpp


示例10: UIDiscreteSliderComponent

void UIDiscreteSlider::AddCells( unsigned int maxValue, unsigned int startValue, float cellSpacing )
{
	MaxValue = maxValue;
	StartValue = startValue;

	DiscreteSliderComponent = new UIDiscreteSliderComponent( *this, StartValue );
	OVR_ASSERT( DiscreteSliderComponent );
	AddComponent( DiscreteSliderComponent );

	float cellOffset = 0.0f;
	const float pixelCellSpacing = cellSpacing * VRMenuObject::DEFAULT_TEXEL_SCALE;

	VRMenuFontParms fontParms( HORIZONTAL_CENTER, VERTICAL_CENTER, false, false, false, 1.0f );
	Vector3f defaultScale( 1.0f );
	
	for ( unsigned int cellIndex = 0; cellIndex <= MaxValue; ++cellIndex )
	{
		const Posef pose( Quatf( Vector3f( 0.0f, 1.0f, 0.0f ), 0.0f ),
			Vector3f( cellOffset, 0.f, 0.0f ) );

		cellOffset += pixelCellSpacing;

		VRMenuObjectParms cellParms( VRMENU_BUTTON, Array< VRMenuComponent* >(), VRMenuSurfaceParms(),
			"", pose, defaultScale, fontParms, Menu->AllocId(),
			VRMenuObjectFlags_t(), VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );

		UICell * cellObject = new UICell( GuiSys );
		cellObject->AddToDiscreteSlider( Menu, this, cellParms );
		cellObject->SetImage( 0, SURFACE_TEXTURE_DIFFUSE, CellOffTexture );
		UICellComponent * cellComp = new UICellComponent( *DiscreteSliderComponent, cellIndex );

		VRMenuObject * object = cellObject->GetMenuObject();
		OVR_ASSERT( object );
		object->AddComponent( cellComp );

		DiscreteSliderComponent->AddCell( cellObject );
	}

	DiscreteSliderComponent->HighlightCells( StartValue );
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:40,代码来源:UIDiscreteSlider.cpp


示例11: commandField

ConsoleView::ConsoleView():
	ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, 150)),
	commandField(NULL)
{
	class CommandHighlighter: public ui::TextboxAction
	{
		ConsoleView * v;
	public:
		CommandHighlighter(ConsoleView * v_) { v = v_; }
		virtual void TextChangedCallback(ui::Textbox * sender)
		{
			sender->SetDisplayText(v->c->FormatCommand(sender->GetText()));
		}
	};
	commandField = new ui::Textbox(ui::Point(7, Size.Y-16), ui::Point(Size.X, 16), "");
	commandField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	commandField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	commandField->SetActionCallback(new CommandHighlighter(this));
	AddComponent(commandField);
	FocusComponent(commandField);
	commandField->SetBorder(false);
}
开发者ID:RCAProduction,项目名称:The-Alliance-Toy,代码行数:22,代码来源:ConsoleView.cpp


示例12: CDirectionalLEDEntity

 void CDirectionalLEDEquippedEntity::AddLED(const CVector3& c_position,
                                            const CQuaternion& c_orientation,
                                            SAnchor& s_anchor,
                                            const CRadians& c_observable_angle,
                                            const CColor& c_color) {
    /* create the new directional LED entity */
    CDirectionalLEDEntity* pcLED =
       new CDirectionalLEDEntity(this,
                                 "directional_led_" + std::to_string(m_vecInstances.size()),
                                 c_position,
                                 c_orientation,
                                 c_observable_angle,
                                 c_color);
    /* add it to the instances vector */
    m_vecInstances.emplace_back(*pcLED,
                                s_anchor,
                                c_position,
                                c_orientation);
    /* inform the base class about the new entity */
    AddComponent(*pcLED);
    UpdateComponents();
 }
开发者ID:ilpincy,项目名称:argos3,代码行数:22,代码来源:directional_led_equipped_entity.cpp


示例13: GetNodeAttribute

/**
 * Load the sphere configuration from its XML tag
 */
void CSphereEntity::Init(TConfigurationNode &t_tree)
{
	try
	{
		// Init parent
		CComposableEntity::Init(t_tree);

		// Parse XML to get the radius (required)
		GetNodeAttribute(t_tree, "radius", m_fRadius);

		// Parse XML to get the movable attribute (optional: defaults to true)
		bool bMovable;
		GetNodeAttributeOrDefault(t_tree, "movable", bMovable, true);

		// Get the mass from XML if the sphere is movable
		if (bMovable)
		{
			// Parse XML to get the mass (optional, defaults to 1)
			GetNodeAttributeOrDefault(t_tree, "mass", m_fMass, 1.0f);
		}
		else
		{
			m_fMass = 0.0f;
		}

		// Create embodied entity using parsed data
		m_pcEmbodiedEntity = new CEmbodiedEntity(this);

		m_pcEmbodiedEntity->Init(GetNode(t_tree, "body"));
		m_pcEmbodiedEntity->SetMovable(bMovable);
		AddComponent(*m_pcEmbodiedEntity);

		UpdateComponents();
	}
	catch (CARGoSException &ex)
	{
		THROW_ARGOSEXCEPTION_NESTED("Failed to initialize the ball entity.", ex);
	}
}
开发者ID:richard-redpath,项目名称:bullet-for-argos,代码行数:42,代码来源:CSphereEntity.cpp


示例14: FAILED_CHECK

HRESULT CBaseUI::Initialize(void)
{
	FAILED_CHECK(AddComponent());

	m_fX = 150.f;
	m_fY = 50.f;
	m_fSizeX = 140.f;
	m_fSizeY = 42.f;

	//
	CRenderMgr::GetInstance()->AddRenderGroup(TYPE_UI, this);

	m_pFont->m_eType = FONT_TYPE_OUTLINE;
	m_pFont->m_wstrText = L" ";//여기에 아이디 넣자고하면 수정.
	m_pFont->m_fSize = 20.f;
	m_pFont->m_nColor = 0xFF008AFF;
	m_pFont->m_nFlag = FW1_CENTER | FW1_VCENTER | FW1_RESTORESTATE;
	m_pFont->m_vPos = D3DXVECTOR2(m_fX, m_fY + 150);
	m_pFont->m_fOutlineSize = 1.f;
	m_pFont->m_nOutlineColor = 0xFF000000 /*0xFFFFFFFF*/;

	return S_OK;
}
开发者ID:korleinster,项目名称:gamebusdriver,代码行数:23,代码来源:BaseUI.cpp


示例15: MeshRendererGameComponent

void CubesGame::Initialize()
{
	Game::Initialize();

	MediaManager::Instance().AddSearchPath("../../examples/resources");
	MediaManager::Instance().AddSearchPath("../../examples/resources/textures");
	MediaManager::Instance().AddSearchPath("../../examples/resources/models");
	MediaManager::Instance().AddSearchPath("../../examples/resources/shaders");
	MediaManager::Instance().AddSearchPath("../../examples/resources/spriteSheet");
	MediaManager::Instance().AddSearchPath("../../examples/resources/script");
	MediaManager::Instance().AddSearchPath("../../examples/resources/fonts");


// 	Line2DRendererComponent *m_pLine2DRenderer = NEW_AO Line2DRendererComponent(this);
// 	Line3DRendererComponent *m_pLine3DRenderer = NEW_AO Line3DRendererComponent(this);
	MeshRendererGameComponent *m_pModelRenderer = NEW_AO MeshRendererGameComponent(this);
	//DebugSystem *m_pDebugSystem = NEW_AO DebugSystem(this);

// 	AddComponent(m_pLine2DRenderer);
// 	AddComponent(m_pLine3DRenderer);	
	AddComponent(m_pModelRenderer);
	//AddComponent(m_pDebugSystem);
}
开发者ID:xcasadio,项目名称:casaengine,代码行数:23,代码来源:CubesGame.cpp


示例16: UNREFERENCED_PARAMETER

void SkyBoxTestScene::Initialize(const GameContext& gameContext)
{
    UNREFERENCED_PARAMETER(gameContext);

    auto skinnedDiffuseMaterial = new SkinnedDiffuseMaterial();
    skinnedDiffuseMaterial->SetDiffuseTexture(L"./Resources/Textures/Knight.jpg");
    gameContext.pMaterialManager->AddMaterial(skinnedDiffuseMaterial, 115);

    m_pModel = new ModelComponent(L"./Resources/Meshes/Knight.ovm");
    m_pModel->SetMaterial(115);
    auto obj = new GameObject();
    obj->AddComponent(m_pModel);
    AddChild(obj);

    obj->GetTransform()->Scale(0.1f, 0.1f, 0.1f);

    auto myMaterial = new SkyBoxMaterial();
    myMaterial->SetDiffuseTexture(L"./Resources/Textures/SkyBox.dds");
    gameContext.pMaterialManager->AddMaterial(myMaterial, 110);
    auto skycube = new SkyBoxPrefab(110);
    AddChild(skycube);

}
开发者ID:BartyTurbo,项目名称:Arctic-Defence-3D-,代码行数:23,代码来源:SkyBoxTestScene.cpp


示例17: vHavokBehaviorComponent

void BG_DarkWarriorEntity::InitFunction()
{
	BG_WarriorEntity::InitFunction();

	m_havokBehavior = new vHavokBehaviorComponent();
	m_havokBehavior->m_projectName = "HavokAnimation/BG_Warriors.hkt";
	m_havokBehavior->m_characterName = "Dark_Warrior.hkt";
	m_havokBehavior->m_behaviorName = "Dark_Warrior.hkt";
	AddComponent(m_havokBehavior);

	VTextureObject *textureHandler = Vision::TextureManager.Load2DTexture("Assets/Models/Textures/Dark_Warrior/Dark_Warrior_cloth_d.png");
	GetMesh()->GetSurface(3)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_Diffuse, textureHandler);
	textureHandler = Vision::TextureManager.Load2DTexture("Assets/Models/Textures/Dark_Warrior/Dark_Warrior_cloth_n.png");
	GetMesh()->GetSurface(3)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_NormalMap, textureHandler);

	textureHandler = Vision::TextureManager.Load2DTexture("Assets/Models/Textures/Dark_Warrior/Dark_Warrior_bones_d.png");
	GetMesh()->GetSurface(1)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_Diffuse, textureHandler);
	textureHandler = Vision::TextureManager.Load2DTexture("Assets/Models/Textures/Dark_Warrior/Dark_Warrior_bones_n.png");
	GetMesh()->GetSurface(1)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_NormalMap, textureHandler);

	textureHandler = Vision::TextureManager.Load2DTexture("Assets/Models/Textures/Dark_Warrior/Dark_Warrior_wepons_d.tga");
	GetMesh()->GetSurface(2)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_Diffuse, textureHandler);
	GetMesh()->GetSurface(0)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_Diffuse, textureHandler);
	textureHandler = Vision::TextureManager.Load2DTexture("Assets/Models/Textures/Dark_Warrior/Dark_Warrior_wepons_n.tga");
	GetMesh()->GetSurface(2)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_NormalMap, textureHandler);
	GetMesh()->GetSurface(0)->SetTexture(VisSurfaceTextures_cl::VTextureType_e::VTT_NormalMap, textureHandler);

	m_collisionRadius = 30;
	m_collisionHeight = 160;
	m_sensorSize = 64;
	m_desiredSpeed = 80;

	PostInitialize();

	SetDirection(hkvVec3(-1,0,0));
}
开发者ID:SoulReaper13,项目名称:Board-game-Platform,代码行数:36,代码来源:DarkWarriorEntity.cpp


示例18: OnDamage

	//! called when the HQ has taken damage
	bool HQ::OnDamage(float fDamage)
	{
		if (m_fExplosionTimer > 0.0f)
			return true;

		m_fHitPoints -= fDamage;

		m_HealthBG->SetVisible(true);
		m_HealthBar->SetProgress(m_fHitPoints / m_fMaxHitPoints);

		if(m_fHitPoints < 0.0f)
		{
			auto explosionVisitor = static_cast<ExplosionVisitor*>(m_ExplosionVisitor->Copy());
			auto explosionEntity = static_cast<Entity3D*>(m_ExplosionEntity->Copy());
			explosionEntity->SetScale(Vector3::One * 2.0f);

			// add explosion visitor
			explosionVisitor->SetDefaultIntensity(m_fExplosionIntensity);
			explosionVisitor->SetDefaultDuration(m_fExplosionDuration);
			auto mesh = static_cast<Entity3D*>(GetChildByName("HQMesh"));
			mesh->AddComponent(explosionVisitor);

			// add explosion entity
			AddChild(explosionEntity);
			explosionEntity->SetPosition(mesh->GetPosition());

			AUDIOMGR->Play(AudioManager::S_ExplosionNuclear);
			m_fExplosionTimer = m_fExplosionDuration;
			m_HealthBG->SetVisible(false);

			GAMECAM->Shake(.5f, .02f, m_fExplosionDuration / 2.0f);
			return true;
		}

		return false;
	}
开发者ID:aminere,项目名称:StarportsPublic,代码行数:37,代码来源:HQ.cpp


示例19: loginButton

LoginView::LoginView():
	ui::Window(ui::Point(-1, -1), ui::Point(200, 87)),
	loginButton(new ui::Button(ui::Point(200-100, 87-17), ui::Point(100, 17), "Sign in")),
	cancelButton(new ui::Button(ui::Point(0, 87-17), ui::Point(101, 17), "Cancel")),
	titleLabel(new ui::Label(ui::Point(4, 5), ui::Point(200-16, 16), "Server login")),
	usernameField(new ui::Textbox(ui::Point(8, 25), ui::Point(200-16, 17), Client::Ref().GetAuthUser().Username, "[username]")),
	passwordField(new ui::Textbox(ui::Point(8, 46), ui::Point(200-16, 17), "", "[password]")),
	infoLabel(new ui::Label(ui::Point(8, 67), ui::Point(200-16, 16), "")),
	targetSize(0, 0)
{
	targetSize = Size;
	FocusComponent(usernameField);
	
	infoLabel->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;	infoLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	infoLabel->Visible = false;
	AddComponent(infoLabel);
	
	AddComponent(loginButton);
	SetOkayButton(loginButton);
	loginButton->Appearance.HorizontalAlign = ui::Appearance::AlignRight;
	loginButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	loginButton->Appearance.TextInactive = style::Colour::ConfirmButton;
	loginButton->SetActionCallback(new LoginAction(this));
	AddComponent(cancelButton);
	SetCancelButton(cancelButton);
	cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	cancelButton->SetActionCallback(new CancelAction(this));
	AddComponent(titleLabel);
	titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;	titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	
	AddComponent(usernameField);
	usernameField->Appearance.icon = IconUsername;
	usernameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;	usernameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	AddComponent(passwordField);
	passwordField->Appearance.icon = IconPassword;
	passwordField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;	passwordField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	passwordField->SetHidden(true);
}
开发者ID:Ares26,项目名称:The-Powder-Toy,代码行数:39,代码来源:LoginView.cpp


示例20: WindowActivity

ServerSaveActivity::ServerSaveActivity(SaveInfo save, ServerSaveActivity::SaveUploadedCallback * callback) :
	WindowActivity(ui::Point(-1, -1), ui::Point(440, 200)),
	thumbnail(NULL),
	save(save),
	callback(callback),
	saveUploadTask(NULL)
{
	titleLabel = new ui::Label(ui::Point(4, 5), ui::Point((Size.X/2)-8, 16), "");
	titleLabel->SetTextColour(style::Colour::InformationTitle);
	titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	AddComponent(titleLabel);
	CheckName(save.GetName()); //set titleLabel text

	ui::Label * previewLabel = new ui::Label(ui::Point((Size.X/2)+4, 5), ui::Point((Size.X/2)-8, 16), "Preview:");
	previewLabel->SetTextColour(style::Colour::InformationTitle);
	previewLabel->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	previewLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	AddComponent(previewLabel);

	nameField = new ui::Textbox(ui::Point(8, 25), ui::Point((Size.X/2)-16, 16), save.GetName(), "[save name]");
	nameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	nameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	nameField->SetActionCallback(new NameChangedAction(this));
	AddComponent(nameField);
	FocusComponent(nameField);

	descriptionField = new ui::Textbox(ui::Point(8, 65), ui::Point((Size.X/2)-16, Size.Y-(65+16+4)), save.GetDescription(), "[save description]");
	descriptionField->SetMultiline(true);
	descriptionField->SetLimit(254);
	descriptionField->Appearance.VerticalAlign = ui::Appearance::AlignTop;
	descriptionField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	AddComponent(descriptionField);

	publishedCheckbox = new ui::Checkbox(ui::Point(8, 45), ui::Point((Size.X/2)-80, 16), "Publish", "");
	if(Client::Ref().GetAuthUser().Username != save.GetUserName())
	{
		//Save is not owned by the user, disable by default
		publishedCheckbox->SetChecked(false);	
	}
	else
	{
		//Save belongs to the current user, use published state already set
		publishedCheckbox->SetChecked(save.GetPublished());
	}
	AddComponent(publishedCheckbox);

	pausedCheckbox = new ui::Checkbox(ui::Point(160, 45), ui::Point(55, 16), "Paused", "");
	pausedCheckbox->SetChecked(save.GetGameSave()->paused);
	AddComponent(pausedCheckbox);

	ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point((Size.X/2)-75, 16), "Cancel");
	cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	cancelButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	cancelButton->Appearance.BorderInactive = ui::Colour(200, 200, 200);
	cancelButton->SetActionCallback(new CancelAction(this));
	AddComponent(cancelButton);
	SetCancelButton(cancelButton);

	ui::Button * okayButton = new ui::Button(ui::Point((Size.X/2)-76, Size.Y-16), ui::Point(76, 16), "Save");
	okayButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
	okayButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	okayButton->Appearance.TextInactive = style::Colour::InformationTitle;
	okayButton->SetActionCallback(new SaveAction(this));
	AddComponent(okayButton);
	SetOkayButton(okayButton);

	ui::Button * PublishingInfoButton = new ui::Button(ui::Point((Size.X*3/4)-75, Size.Y-42), ui::Point(150, 16), "Publishing Info");
	PublishingInfoButton->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
	PublishingInfoButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	PublishingInfoButton->Appearance.TextInactive = style::Colour::InformationTitle;
	PublishingInfoButton->SetActionCallback(new PublishingAction(this));
	AddComponent(PublishingInfoButton);

	ui::Button * RulesButton = new ui::Button(ui::Point((Size.X*3/4)-75, Size.Y-22), ui::Point(150, 16), "Save Uploading Rules");
	RulesButton->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;
	RulesButton->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
	RulesButton->Appearance.TextInactive = style::Colour::InformationTitle;
	RulesButton->SetActionCallback(new RulesAction(this));
	AddComponent(RulesButton);

	if(save.GetGameSave())
		RequestBroker::Ref().RenderThumbnail(save.GetGameSave(), false, true, (Size.X/2)-16, -1, this);
}
开发者ID:30P0I,项目名称:The-Powder-Toy,代码行数:84,代码来源:ServerSaveActivity.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ AddControllerPitchInput函数代码示例发布时间:2022-05-30
下一篇:
C++ AddCommandScripts函数代码示例发布时间: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