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

Method update

tests/cpp-tests/Source/SpriteTest/SpriteTest.cpp:5514–5540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5512}
5513
5514void SpriteSlice9Test5::update(float dt)
5515{
5516 _elapsed += dt;
5517
5518 float angle = _elapsed;
5519
5520 // cap the value between 0 and 0.8
5521 float x = ((cos(angle) + sin(angle * 3)) + 2) / 5.0f;
5522 float y1 = (sin(angle) + 1) / 2.5;
5523 float y2 = (sin(angle + M_PI_2) + 1) / 2.5;
5524 float y = y1;
5525 for (int i = 0; i < 3; ++i)
5526 {
5527 if (i == 1)
5528 {
5529 x = 0.8 - x;
5530 y = y2;
5531 }
5532 else if (i == 2)
5533 {
5534 y = 0.8 - y;
5535 }
5536
5537 Rect rect(x, y, 0.2, 0.2);
5538 _sprites[i]->setCenterRectNormalized(rect);
5539 }
5540}
5541
5542//------------------------------------------------------------------
5543//

Callers

nothing calls this directly

Calls 3

isFlippedXMethod · 0.80
setFlippedXMethod · 0.45

Tested by

no test coverage detected