| 2458 | } |
| 2459 | |
| 2460 | Coroutine 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 | } |
nothing calls this directly
no test coverage detected