Cocos2d-x Render-NewCulling
来源:未知 责任编辑:责任编辑 发表时间:2014-05-20 18:26 点击:次
.cpp
layout->setBackGroundImageScale9Enabled(true); layout->setBackGroundImage("green_edit.png"); layout->setPosition(Point(0,0)); addChild(layout); alert = Text::create("Layout", "fonts/Marker Felt.ttf", 30 ); alert->setColor(Color3B(159, 168, 176)); alert->setPosition(Point(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getSize().height * 3.075f)); layout->addChild(alert); auto size = Director::getInstance()->getWinSize(); /**************************************************************/ auto sprite = Sprite::create("btn-about-normal-vertical.png"); sprite->setRotation(5); sprite->setPosition(Point(size.width/2,size.height/3)); sprite->setScale(2); layout-> addChild(sprite); auto sprite2 = Sprite::create("btn-about-normal-vertical.png"); sprite2->setRotation(-85); sprite2->setPosition(Point(size.width/2,size.height * 2/3)); sprite2->setScale(2); layout->addChild(sprite2); auto listener = EventListenerTouchOneByOne::create(); listener->setSwallowTouches(true); listener->onTouchBegan = [=](Touch* touch, Event *event) { auto pos = touch->getLocation(); _lastPos = pos; return true; }; listener->onTouchMoved = [=](Touch* touch, Event *event) { auto pos = touch->getLocation(); auto offset = pos - _lastPos; auto layerPos = getPosition(); auto newPos = layerPos + offset; layout->setPosition(newPos); _lastPos = pos; }; _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>