MCPcopy Create free account
hub / github.com/axmolengine/axmol / coroutineCallback

Method coroutineCallback

tests/cpp-tests/Source/ActionsTest/ActionsTest.cpp:2460–2482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2458}
2459
2460Coroutine ActionCoroutineTest::coroutineCallback()
2461{
2462 auto s = Director::getInstance()->getWinSize();
2463
2464 auto label1 =
2465 Label::createWithTTF(fmt::format("First ({})", _frameCount), "fonts/Marker Felt.ttf", 16.0f);
2466 label1->setPosition(s.width / 4 * 1, s.height / 2);
2467 addChild(label1);
2468 co_yield DelayTime::create(3.0f); // delay 3s
2469
2470 auto label2 =
2471 Label::createWithTTF(fmt::format("after 3sec ({})", _frameCount), "fonts/Marker Felt.ttf", 16.0f);
2472 label2->setPosition(s.width / 4 * 2, s.height / 2);
2473 addChild(label2);
2474 co_yield nullptr; // next frame
2475
2476 auto label3 =
2477 Label::createWithTTF(fmt::format("next frame ({})", _frameCount), "fonts/Marker Felt.ttf", 16.0f);
2478 label3->setPosition(s.width / 4 * 3, s.height / 2);
2479 addChild(label3);
2480
2481 // co_return; // return coroutine
2482}

Callers

nothing calls this directly

Calls 4

getInstanceFunction · 0.85
createFunction · 0.85
formatFunction · 0.50
setPositionMethod · 0.45

Tested by

no test coverage detected