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

Method IntervalTest

tests/cpp-tests/Source/IntervalTest/IntervalTest.cpp:41–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41IntervalTest::IntervalTest()
42{
43 _time0 = _time1 = _time2 = _time3 = _time4 = 0.0f;
44
45 auto s = Director::getInstance()->getWinSize();
46 // sun
47 auto sun = ParticleSun::create();
48 sun->setTexture(Director::getInstance()->getTextureCache()->addImage("Images/fire.png"));
49 sun->setPosition(VisibleRect::rightTop().x - 32, VisibleRect::rightTop().y - 32);
50
51 sun->setTotalParticles(130);
52 sun->setLife(0.6f);
53 this->addChild(sun);
54
55 // timers
56 _label0 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
57 _label1 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
58 _label2 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
59 _label3 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
60 _label4 = Label::createWithBMFont("fonts/bitmapFontTest4.fnt", "0");
61
62 scheduleUpdate();
63 schedule(
64 [&](float dt) {
65 _time1 += dt;
66
67 char tmp[10];
68 auto str = fmt::format_to_z(tmp, "{:2.1f}", _time1);
69 _label1->setString(str);
70 },
71 "step_1");
72
73 schedule(
74 [&](float dt) {
75 _time2 += dt;
76
77 char tmp[10];
78 auto str = fmt::format_to_z(tmp, "{:2.1f}", _time2);
79 _label2->setString(str);
80 },
81 0.5, "step_2");
82
83 schedule(
84 [&](float dt) {
85 _time3 += dt;
86
87 char tmp[10];
88 auto str = fmt::format_to_z(tmp, "{:2.1f}", _time3);
89 _label3->setString(str);
90 },
91 1, "step_3");
92
93 schedule(
94 [&](float dt) {
95 _time4 += dt;
96
97 char tmp[10];
98 auto str = fmt::format_to_z(tmp, "{:2.1f}", _time4);

Callers

nothing calls this directly

Calls 15

getInstanceFunction · 0.85
createFunction · 0.85
scheduleUpdateFunction · 0.85
format_to_zFunction · 0.85
leftFunction · 0.85
getTextureCacheMethod · 0.80
Vec2Function · 0.50
setTextureMethod · 0.45
addImageMethod · 0.45
setPositionMethod · 0.45
setTotalParticlesMethod · 0.45
addChildMethod · 0.45

Tested by

no test coverage detected