MCPcopy Create free account
hub / github.com/defold/defold / InsertAnimation

Function InsertAnimation

engine/gui/src/gui.cpp:1863–1876  ·  view source on GitHub ↗

This function assumes the size of the array has already grown 1 element

Source from the content-addressed store, hash-verified

1861
1862 // This function assumes the size of the array has already grown 1 element
1863 static inline uint32_t InsertAnimation(dmArray<Animation>& animations, Animation* anim)
1864 {
1865 Animation* begin = animations.Begin();
1866 // We use the fact that the actual end pointer is actually valid here (it's just uninitialized)
1867 Animation* last = animations.End()-1;
1868 Animation* current = std::lower_bound(begin, last, anim->m_Value, AnimCompare);
1869 if (current != last && current->m_Value != anim->m_Value) // anim.m_Value >= value
1870 {
1871 // Move all one step to the "right"
1872 memmove(current+1, current, sizeof(Animation) * (last-current));
1873 }
1874 *current = *anim;
1875 return (uint32_t)(current - begin);
1876 }
1877
1878 static inline void CompleteAnimation(HScene scene, Animation* anim, bool finished)
1879 {

Callers 1

AnimateComponentFunction · 0.85

Calls 2

BeginMethod · 0.45
EndMethod · 0.45

Tested by

no test coverage detected