MCPcopy Create free account
hub / github.com/MyGUI/mygui / animate

Method animate

UnitTests/UnitTest_TextureAnimations/WobbleNodeAnimator.cpp:51–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 }
50
51 size_t WobbleNodeAnimator::animate(
52 bool _update,
53 size_t _quad_count,
54 MyGUI::VectorQuadData& _data,
55 float _time,
56 MyGUI::IVertexBuffer* _buffer,
57 MyGUI::ITexture* _texture,
58 const MyGUI::RenderTargetInfo& _info,
59 const MyGUI::IntCoord& _coord,
60 bool& _isAnimate)
61 {
62 if (mDestroy)
63 {
64 return _quad_count;
65 }
66
67 // проверяем смещения виджета
68 if (mOldCoord.empty())
69 {
70 // do nothing
71 }
72 else if (mOldCoord.size() != _coord.size() && mOldCoord.point() != _coord.point())
73 {
74 mInertiaPoint.set(0.5, 0.5);
75 mInertiaMode = false;
76
77 addInertia(MyGUI::FloatPoint((float)_coord.left - mOldCoord.left, (float)_coord.top - mOldCoord.top));
78 }
79 else if (mOldCoord.size() != _coord.size())
80 {
81 mInertiaMode = true;
82
83 addInertia(
84 MyGUI::FloatPoint((float)_coord.width - mOldCoord.width, (float)_coord.height - mOldCoord.height));
85 }
86 else if (mOldCoord.point() != _coord.point())
87 {
88 const MyGUI::IntPoint& point = MyGUI::InputManager::getInstance().getMousePosition();
89 mInertiaPoint = MyGUI::FloatPoint(
90 (float)(point.left - _coord.left) / (float)_coord.width,
91 (float)(point.top - _coord.top) / (float)_coord.height);
92 mInertiaMode = false;
93
94 addInertia(MyGUI::FloatPoint((float)_coord.left - mOldCoord.left, (float)_coord.top - mOldCoord.top));
95 }
96
97 mOldCoord = _coord;
98
99 addTime(_time);
100
101 bool anim_update = squaredLength(mDragOffset) >= 0.3f;
102
103 if (!anim_update)
104 {
105 return _quad_count;
106 }
107
108 _isAnimate = true;

Callers

nothing calls this directly

Calls 7

squaredLengthFunction · 0.85
FloatPointFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
pointMethod · 0.45
setMethod · 0.45
getMousePositionMethod · 0.45

Tested by

no test coverage detected