本文整理汇总了C++中TestScene::scheduleUpdate方法的典型用法代码示例。如果您正苦于以下问题:C++ TestScene::scheduleUpdate方法的具体用法?C++ TestScene::scheduleUpdate怎么用?C++ TestScene::scheduleUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestScene
的用法示例。
在下文中一共展示了TestScene::scheduleUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
Scene* TestScene::create()
{
TestScene* scene = TestScene::createWithPhysics();
scene->getPhysicsWorld()->setGravity(Vect(0.0f, -700.0f));
scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL);
scene->scheduleUpdate();
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
PhysicsBody* edgeBody = PhysicsBody::createEdgeBox(visibleSize, PhysicsMaterial(0.1f, 0.0f, 0.5f), 3);
Node* edgeNode = Node::create();
edgeNode->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
edgeNode->setPhysicsBody(edgeBody);
scene->addChild(edgeNode);
Player* sprite = Player::create();
sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
/*Sprite* sprite = Sprite::create("testSprite.png");
sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
MyBodyParser::getInstance()->parseJsonFile("test.json");
auto spriteBody = MyBodyParser::getInstance()->bodyFormJson(sprite, "Test", PhysicsMaterial(1, 1, 0));
if (spriteBody != nullptr)
{
spriteBody->setDynamic(true);
sprite->setPhysicsBody(spriteBody);
}*/
scene->addChild(sprite);
return scene;
}