Esempio n. 1
0
bool CControlViewBasicTest::init()
{
	CControlViewTestSceneBase::init();
	setTitle("CControlViewBasicTest");
	setDescription("control the icon to move");

	m_pIcon = Sprite::create("icon.png");
	m_pIcon->setPosition(Vec2(480, 320));
	m_pWindow->addChild(m_pIcon);

	CControlView* pView = CControlView::create(
		"control_baseboard.png", "control_joystick.png");
	pView->setPosition(Vec2(100, 100));
	pView->setRadius(pView->getContentSize().width / 2);
	pView->setOnControlListener(this, ccw_control_selector(CControlViewBasicTest::onTouched));
	pView->setAnchorPoint(Vec2::ZERO);
	pView->setScale(1.5f);
	pView->setOpacity(200);
	m_pWindow->addChild(pView);

	CControlView* pView2 = CControlView::create();
	pView2->setBaseBoardImage("control_baseboard.png");
	pView2->setPosition(Vec2(860, 100));
	pView2->setRadius(pView2->getContentSize().width / 2);
	pView2->setOnControlListener(this, ccw_control_selector(CControlViewBasicTest::onTouched));
	pView2->setAnchorPoint(Vec2(1, 0));
	pView2->setScale(1.5f);
	pView2->setOpacity(200);
	m_pWindow->addChild(pView2);

	return true;
}
Esempio n. 2
0
CControlView* TuiManager::createControl(float tag,const char* baseboard,const char* joystick,float x,float y,float rotation){
	CControlView* pView = NULL;
	if(m_isUseSpriteFrame){
		pView = CControlView::create();
		pView->setBaseBoardSpriteFrameName(baseboard);
		pView->setJoystickSpriteFrameName(joystick);
	}else{
		pView = CControlView::create(baseboard,joystick);
	}
	pView->setPosition(Point(x, -y));
	pView->setRadius(pView->getContentSize().width / 2);
	pView->setRotation(rotation);
	pView->setTag(tag);
	return pView;
}