Example #1
0
//----------------------------------------------------------------------------
UIButton::UIButton ()
{
	SetName("UIButton");

	UIPicBox *picNormal = new0 UIPicBox();
	picNormal->SetName("Normal");
	picNormal->SetPicBoxType(UIPicBox::PBT_NINE);
	picNormal->SetTexture("Data/engine/common.xml", "buttonNormal");

	UIPicBox *picOver = new0 UIPicBox();
	picOver->SetName("Over");
	picOver->SetPicBoxType(UIPicBox::PBT_NINE);
	picOver->SetTexture("Data/engine/common.xml", "buttonOver");

	UIPicBox *picDown = new0 UIPicBox();
	picDown->SetName("Down");
	picDown->SetPicBoxType(UIPicBox::PBT_NINE);
	picDown->SetTexture("Data/engine/common.xml", "buttonDown");

	SetPicBox(BS_NORMAL, picNormal);
	SetPicBox(BS_OVER, picOver);
	SetPicBox(BS_DOWN, picDown);

	SetButtonState(BS_NORMAL);
}
Example #2
0
//----------------------------------------------------------------------------
UIButton::UIButton() :
mAfterReleasedType(ART_NORMAL),
mIsRecoverBegin(false),
mAfterReleasedRecoverTime(6.0f),
mRecoverBeginTimeimg(0.0f),
mDoublePressedCount(0),
mDoublePressedTimeLimit(0.3f),
mDoublePressedTimeimg(0.0f)
{
	SetName("UIButton");

	if (BT_COLOR == mButType)
	{
		UIPicBox *picNormal = new0 UIPicBox("Data/engine/white.png");
		picNormal->SetName("Normal");
		SetPicBox(BS_NORMAL, picNormal);
	}
	else
	{
		UIPicBox *picNormal = new0 UIPicBox("Data/engine/white.png");
		picNormal->SetName("Normal");
		SetPicBox(BS_NORMAL, picNormal);

		UIPicBox *picOver = new0 UIPicBox("Data/engine/white.png");
		picOver->SetName("Over");
		SetPicBox(BS_HOVERED, picOver);

		UIPicBox *picDown = new0 UIPicBox("Data/engine/white.png");
		picDown->SetName("Down");
		SetPicBox(BS_PRESSED, picDown);

		UIPicBox *picDis = new0 UIPicBox("Data/engine/white.png");
		picDis->SetName("Dis");
		SetPicBox(BS_DISABLED, picDis);
	}

	SetButtonState(BS_NORMAL);

	SetSize(40.0f, 40.0f);
}