コード例 #1
0
ファイル: UIScrollBar.cpp プロジェクト: BitYorkie/KlayGE
	void UIScrollBar::InitDefaultElements()
	{
		UIElement Element;

		// Track
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ScrollBar, 0));
			Element.TextureColor().States[UICS_Disabled] = Color(200.0f / 255, 200.0f / 255, 200.0f / 255, 1);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Up Arrow
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ScrollBar, 1));
			Element.TextureColor().States[UICS_Disabled] = Color(200.0f / 255, 200.0f / 255, 200.0f / 255, 1);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Down Arrow
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ScrollBar, 2));
			Element.TextureColor().States[UICS_Disabled] = Color(200.0f / 255, 200.0f / 255, 200.0f / 255, 1);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Button
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ScrollBar, 3));

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}
	}
コード例 #2
0
	void UIPolylineEditBox::InitDefaultElements()
	{
		UIElement Element;

		// Background
		{
			Element.TextureColor().States[UICS_Normal] = Color(0.7f, 0.7f, 0.7f, 1.0f);
			Element.TextureColor().SetState(UICS_Normal);
			elements_.push_back(MakeUniquePtr<UIElement>(Element));
		}

		// Coord line
		{
			Element.TextureColor().States[UICS_Normal] = Color(0.6f, 0.6f, 0.6f, 1.0f);
			Element.TextureColor().SetState(UICS_Normal);
			elements_.push_back(MakeUniquePtr<UIElement>(Element));
		}

		// Polyline
		{
			Element.TextureColor().States[UICS_Normal] = Color(0, 1, 0, 1);
			Element.TextureColor().States[UICS_MouseOver] = Color(1, 0, 0, 1);
			Element.TextureColor().SetState(UICS_Normal);
			elements_.push_back(MakeUniquePtr<UIElement>(Element));
		}

		// Control points
		{
			Element.TextureColor().States[UICS_Normal] = Color(1, 1, 1, 1);
			Element.TextureColor().States[UICS_MouseOver] = Color(1, 0, 0, 1);
			Element.TextureColor().SetState(UICS_Normal);
			elements_.push_back(MakeUniquePtr<UIElement>(Element));
		}
	}
コード例 #3
0
ファイル: UIButton.cpp プロジェクト: BitYorkie/KlayGE
	void UIButton::InitDefaultElements()
	{
		UIElement Element;

		// Button
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_Button, 0));
			Element.SetFont(0);
			Element.TextureColor().States[UICS_Normal] = Color(1, 1, 1, 150.0f / 255);
			Element.TextureColor().States[UICS_Pressed] = Color(1, 1, 1, 200.0f / 255);
			Element.FontColor().States[UICS_MouseOver] = Color(0, 0, 0, 1.0f);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Fill layer
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_Button, 1), Color(1, 1, 1, 0));
			Element.TextureColor().States[UICS_MouseOver] = Color(1, 1, 1, 160.0f / 255);
			Element.TextureColor().States[UICS_Pressed] = Color(0, 0, 0, 60.0f / 255);
			Element.TextureColor().States[UICS_Focus] = Color(1, 1, 1, 30.0f / 255);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}
	}
コード例 #4
0
ファイル: UIProgressBar.cpp プロジェクト: Chenmxs/KlayGE
	void UIProgressBar::InitDefaultElements()
	{
		UIElement Element;

		// Background
		{
			Element.TextureColor().States[UICS_Normal] = Color(1.0f, 1.0f, 1.0f, 1.0f);
			Element.TextureColor().SetState(UICS_Normal);
			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Bar
		{
			Element.TextureColor().States[UICS_Normal] = Color(0.2f, 0.4f, 0.6f, 1.0f);
			Element.TextureColor().SetState(UICS_Normal);
			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}
	}
コード例 #5
0
ファイル: UISlider.cpp プロジェクト: Chenmxs/KlayGE
	void UISlider::InitDefaultElements()
	{
		UIElement Element;

		// Track
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_Slider, 0));
			Element.TextureColor().States[UICS_Normal] = Color(1, 1, 1, 150.0f / 255);
			Element.TextureColor().States[UICS_Focus] = Color(1, 1, 1, 200.0f / 255);
			Element.TextureColor().States[UICS_Disabled] = Color(1, 1, 1, 70.0f / 255);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Button
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_Slider, 1));

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}
	}
コード例 #6
0
ファイル: UICheckBox.cpp プロジェクト: Chenmxs/KlayGE
	void UICheckBox::InitDefaultElements()
	{
		UIElement Element;

		// Box
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_CheckBox, 0));
			Element.SetFont(0, Color(1, 1, 1, 1), Font::FA_Hor_Left | Font::FA_Ver_Middle);
			Element.FontColor().States[UICS_Disabled] = Color(200.0f / 255, 200.0f / 255, 200.0f / 255, 200.0f / 255);
			Element.TextureColor().States[UICS_Normal] = Color(1, 1, 1, 150.0f / 255);
			Element.TextureColor().States[UICS_Focus] = Color(1, 1, 1, 200.0f / 255);
			Element.TextureColor().States[UICS_Pressed] = Color(1, 1, 1, 1);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Check
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_CheckBox, 1));

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}
	}
コード例 #7
0
ファイル: UIComboBox.cpp プロジェクト: BobLChen/KlayGE
	void UIComboBox::InitDefaultElements()
	{
		UIElement Element;

		// Main
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ComboBox, 0));
			Element.SetFont(0);
			Element.TextureColor().States[UICS_Normal] = Color(200.0f / 255, 200.0f / 255, 200.0f / 255, 150.0f / 255);
			Element.TextureColor().States[UICS_Focus] = Color(230.0f / 255, 230.0f / 255, 230.0f / 255, 170.0f / 255);
			Element.TextureColor().States[UICS_Disabled] = Color(200.0f / 255, 200.0f / 255, 200.0f / 255, 70.0f / 255);
			Element.FontColor().States[UICS_MouseOver] = Color(0, 0, 0, 1);
			Element.FontColor().States[UICS_Pressed] = Color(0, 0, 0, 1);
			Element.FontColor().States[UICS_Disabled] = Color(200.0f / 255, 200.0f / 255, 200.0f / 255, 200.0f / 255);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Button
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ComboBox, 1));
			Element.TextureColor().States[UICS_Normal] = Color(1, 1, 1, 150.0f / 255);
			Element.TextureColor().States[UICS_Pressed] = Color(150.0f / 255, 150.0f / 255, 150.0f / 255, 1);
			Element.TextureColor().States[UICS_Focus] = Color(1, 1, 1, 200.0f / 255);
			Element.TextureColor().States[UICS_Disabled] = Color(1, 1, 1, 70.0f / 255);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Dropdown
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ComboBox, 2));
			Element.SetFont(0, Color(0, 0, 0, 1), Font::FA_Hor_Left | Font::FA_Ver_Top);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}

		// Selection
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_ComboBox, 3));
			Element.SetFont(0, Color(1, 1, 1, 1), Font::FA_Hor_Left | Font::FA_Ver_Top);

			elements_.push_back(MakeSharedPtr<UIElement>(Element));
		}
	}
コード例 #8
0
ファイル: UITexButton.cpp プロジェクト: zsnake1209/KlayGE
	void UITexButton::InitDefaultElements()
	{
		UIElement Element;

		// Fill layer
		for (int i = 0; i < 9; ++ i)
		{
			Element.SetTexture(0, UIManager::Instance().ElementTextureRect(UICT_TexButton, i), Color(1, 1, 1, 0));
			Element.TextureColor().States[UICS_MouseOver] = Color(1, 1, 1, 1);
			Element.TextureColor().States[UICS_Pressed] = Color(0, 0, 0, 60.0f / 255);
			Element.TextureColor().States[UICS_Focus] = Color(1, 1, 1, 30.0f / 255);

			elements_.push_back(MakeUniquePtr<UIElement>(Element));
		}

		// Button
		{
			TexturePtr const & tex = UIManager::Instance().GetTexture(tex_index_);

			if (tex)
			{
				Element.SetTexture(static_cast<uint32_t>(tex_index_), IRect(0, 0, tex->Width(0), tex->Height(0)));
			}
			else
			{
				Element.SetTexture(static_cast<uint32_t>(tex_index_), IRect(0, 0, 1, 1));
			}
			Element.SetFont(0);
			Element.TextureColor().States[UICS_MouseOver] = Color(1, 1, 1, 1);
			Element.TextureColor().States[UICS_Normal] = Color(1, 1, 1, 1);
			Element.TextureColor().States[UICS_Pressed] = Color(1, 1, 1, 1);
			Element.FontColor().States[UICS_MouseOver] = Color(0, 0, 0, 1);

			elements_.push_back(MakeUniquePtr<UIElement>(Element));
		}
	}