Beispiel #1
0
void ClippingRectangleNodeTest::setup()
{
    auto clipper = ClippingRectangleNode::create();
    clipper->setClippingRegion(Rect(this->getContentSize().width / 2 - 100, this->getContentSize().height / 2 - 100, 200, 200));
    clipper->setTag( kTagClipperNode );
    this->addChild(clipper);
    
    auto content = Sprite::create(s_back2);
    content->setTag( kTagContentNode );
    content->setAnchorPoint(  Vec2(0.5, 0.5) );
    content->setPosition(this->getContentSize().width / 2, this->getContentSize().height / 2);
    clipper->addChild(content);
}
Beispiel #2
0
bool LetterBoard::init()
{	
	setClippingRegion(Rect(0, 0, LETTERBOARD_WIDTH, LETTERBOARD_HEIGHT));
	setAnchorPoint(Point(0, 0));
	setPosition(Vec2(0, 0));

	_background = Sprite::create("letterboard/background.png");
	_background->setAnchorPoint(Point(0, 0));
	_background->setPosition(Vec2(0, 0));
	this->addChild(_background);

	_label = Label::createWithTTF("", _font, LETTER_SIZE, Size::ZERO, TextHAlignment::LEFT, TextVAlignment::CENTER);
	_label->setAnchorPoint(Point(0, 0.5));
	_label->setPosition(Vec2(LETTERBOARD_WIDTH, _background->getContentSize().height / 2));
	_background->addChild(_label);

	_state = MODULE_STATE::IDLE;
	
	return true;
}