Пример #1
0
/*
==================
SoundLayer::LoadButton
==================
*/
void SoundLayer::LoadButton() {
	Pim::Sprite *norm = new Pim::Sprite;
	norm->rect = Pim::Rect(0,60,80,30);
	norm->UseBatchNode(buttonSheet);
	
	Pim::Sprite *press = new Pim::Sprite;
	press->UseBatchNode(buttonSheet);
	press->rect = Pim::Rect(0,30,80,30);

	playButton = new PlayButton(norm, press, font);
	playButton->position = Pim::Vec2(400,400);
	AddChild(playButton);

	playButton->SetText("play");
	playButton->SetCallback(this);
}
Пример #2
0
/*
==================
HUDLayer::LoadResources
==================
*/
void HUDLayer::LoadResources()
{
	Pim::SpriteBatchNode *batch = new Pim::SpriteBatchNode("hudbutton.png");
	AddChild(batch);

	Pim::Sprite *spr = new Pim::Sprite;
	spr->rect = Pim::Rect(0,0,40,100);
	spr->UseBatchNode(batch);
	
	buttonNext = new MyButton(spr,NULL,NULL,NULL);
	buttonNext->SetCallback((DemoScene*)GetParentScene());
	buttonNext->position = Pim::Vec2(780,300);
	batch->AddChild(buttonNext);

	spr = new Pim::Sprite;
	spr->scale.x = -1;
	spr->rect = Pim::Rect(0,0,40,100);
	spr->UseBatchNode(batch);

	buttonPrev = new MyButton(spr, NULL, NULL, NULL);
	buttonPrev->SetCallback((DemoScene*)GetParentScene());
	buttonPrev->position = Pim::Vec2(20,300);
	batch->AddChild(buttonPrev);
}
Пример #3
0
/*
==================
SoundLayer::LoadSliders
==================
*/
void SoundLayer::LoadSliders() {
	Pim::Sprite *back;
	Pim::Sprite *nrm;
	Pim::Sprite *prs;
	Pim::Label  *lbl;

	// VOLUME SLIDER
	back = new Pim::Sprite;
	back->UseBatchNode(buttonSheet);
	back->rect = Pim::Rect(0,0,120,30);

	lbl = new Pim::Label(font);
	lbl->SetTextAlignment(Pim::Label::TEXT_LEFT);
	lbl->color = Pim::Color(0.f, 0.f, 0.f, 1.f);
	lbl->position = Pim::Vec2(70.f, 0.f);
	lbl->SetText("Volume");
	back->AddChild(lbl);

	nrm = new Pim::Sprite;
	nrm->UseBatchNode(buttonSheet);
	nrm->rect = Pim::Rect(81,30,11,38);

	prs = new Pim::Sprite;
	prs->UseBatchNode(buttonSheet);
	prs->rect = Pim::Rect(92,30,11,38);

	volumeSlider = new Pim::Slider(
		Pim::Vec2(-45,0), Pim::Vec2(45,0),
		back, nrm, NULL, prs, NULL
		);

	volumeSlider->position = Pim::Vec2(400, 350);
	volumeSlider->SetMinMaxValues(0.f, 1.f);
	volumeSlider->SetCallback(this);
	AddChild(volumeSlider);

	// PAN SLIDER
	back = new Pim::Sprite;
	back->UseBatchNode(buttonSheet);
	back->rect = Pim::Rect(0,0,120,30);

	lbl = new Pim::Label(font);
	lbl->SetTextAlignment(Pim::Label::TEXT_LEFT);
	lbl->color = Pim::Color(0.f, 0.f, 0.f, 1.f);
	lbl->position = Pim::Vec2(70.f, 0.f);
	lbl->SetText("Pan");
	back->AddChild(lbl);

	nrm = new Pim::Sprite;
	nrm->UseBatchNode(buttonSheet);
	nrm->rect = Pim::Rect(81,30,11,38);

	prs = new Pim::Sprite;
	prs->UseBatchNode(buttonSheet);
	prs->rect = Pim::Rect(92,30,11,38);

	panSlider = new Pim::Slider(
		Pim::Vec2(-45,0), Pim::Vec2(45,0),
		back, nrm, NULL, prs, NULL
		);

	panSlider->position = Pim::Vec2(400, 300);
	panSlider->SetMinMaxValues(-1.f, 1.f);
	panSlider->SetHandlePosition(0.f);
	panSlider->SetCallback(this);
	AddChild(panSlider);
}