MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / update

Method update

src/components/AnimationComponent.cpp:37–77  ·  view source on GitHub ↗

this should really be fixed at the system loop level...

Source from the content-addressed store, hash-verified

35
36//this should really be fixed at the system loop level...
37void AnimationComponent::update(int deltaTime)
38{
39 mAccumulator += deltaTime;
40 while(mAccumulator >= ANIMATION_TICK_SPEED)
41 {
42 mAccumulator -= ANIMATION_TICK_SPEED;
43
44 if(mMoveX != 0 || mMoveY != 0)
45 {
46 Eigen::Vector2i offset(mMoveX, mMoveY);
47 if(abs(offset.x()) > mMoveSpeed)
48 offset.x() = mMoveSpeed * (offset.x() > 0 ? 1 : -1);
49 if(abs(offset.y()) > mMoveSpeed)
50 offset.y() = mMoveSpeed * (offset.y() > 0 ? 1 : -1);
51
52 moveChildren(offset.x(), offset.y());
53
54 mMoveX -= offset.x();
55 mMoveY -= offset.y();
56 }
57
58 if(mFadeRate != 0)
59 {
60 int opacity = (int)mOpacity + mFadeRate;
61 if(opacity > 255)
62 {
63 mFadeRate = 0;
64 opacity = 255;
65 }
66
67 if(opacity < 0)
68 {
69 mFadeRate = 0;
70 opacity = 0;
71 }
72
73 mOpacity = (unsigned char)opacity;
74 setChildrenOpacity((unsigned char)opacity);
75 }
76 }
77}
78
79void AnimationComponent::addChild(GuiComponent* gui)
80{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected