首页 > 代码库 > Cocos2d-x Render-NewCulling
Cocos2d-x Render-NewCulling
.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);
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。