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

Function SetCursor

engine/gamesys/src/gamesys/components/comp_sprite.cpp:2281–2298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2279 }
2280
2281 static void SetCursor(SpriteComponent* component, float cursor)
2282 {
2283 const dmGameSystemDDF::Playback playback = (dmGameSystemDDF::Playback)component->m_AnimationPlayback;
2284 cursor = dmMath::Clamp(cursor, 0.0f, 1.0f);
2285 if (playback == dmGameSystemDDF::PLAYBACK_ONCE_PINGPONG
2286 || playback == dmGameSystemDDF::PLAYBACK_LOOP_PINGPONG)
2287 {
2288 cursor /= 2.0f;
2289 }
2290 else if (playback == dmGameSystemDDF::PLAYBACK_ONCE_BACKWARD
2291 || playback == dmGameSystemDDF::PLAYBACK_LOOP_BACKWARD)
2292 {
2293 cursor = 1.0f - cursor;
2294 }
2295
2296 component->m_AnimTimer = cursor;
2297 component->m_DoTick = 1;
2298 }
2299
2300 static float GetCursor(SpriteComponent* component)
2301 {

Callers 3

PlayAnimationFunction · 0.70
CompSpriteSetPropertyFunction · 0.70
CompModelSetPropertyFunction · 0.70

Calls 1

ClampFunction · 0.50

Tested by

no test coverage detected