Sets movie looping mode (0=play once and stop, non-zero=loop infinitely, adjusts startTime on loop for seamless).
Takes handle (movie handle from b2dLoadMovie, integer), loop (0 for no looping play once, non-zero for infinite looping).
Returns nothing.
2D Overlay
Parameters & Returns
Parameters
handleInt
loopInt
Returns
Void
Quick Summary
Sets movie looping mode (0=play once and stop, non-zero=loop infinitely, adjusts startTime on loop for seamless).
Takes handle (movie handle from b2dLoadMovie, integer), loop (0 for no looping play once, non-zero for infinite looping).
Returns nothing.
Technical Exegesis...
Sets movie looping mode (0=play once and stop, non-zero=loop infinitely, adjusts startTime on loop for seamless). Takes handle (movie handle from b2dLoadMovie, integer), loop (0 for no looping play once, non-zero for infinite looping). Returns nothing. Sets movie->loop flag (movie->loop = (loop != 0), stored as boolean), affects playback behavior (when reaching last frame, loops to frame 0 or sets finished=true).
Sets movie looping mode (0=play once and stop, non-zero=loop infinitely, adjusts startTime on loop for seamless). Takes handle (movie handle from b2dLoadMovie, integer), loop (0 for no looping play once, non-zero for infinite looping). Returns nothing. Sets movie->loop flag (movie->loop = (loop != 0), stored as boolean), affects playback behavior (when reaching last frame, loops to frame 0 or sets finished=true). Use to enable looping video (background videos, animated textures, continuous playback), disable looping (cutscenes, one-shot videos, stop after completion), or toggle looping dynamically (change during playback). Looping behavior: loop=0 play once (when reaching frameCount, sets playing=false, finished=true, stops automatically), loop=non-zero infinite loop (when reaching frameCount, wraps to frame 0, adjusts startTime for seamless continuation), can set before or during playback (change takes effect when reaching end of current iteration). Use cases: (1) Background video (b2dSetMovieLoop(bgMovie,1): b2dPlayMovie(bgMovie) infinite loop for animated background), (2) Cutscene (b2dSetMovieLoop(cutscene,0): b2dPlayMovie(cutscene) play once then stop), (3) Toggle loop (b2dSetMovieLoop(movie,loopEnabled) dynamically enable/disable looping), (4) Animated texture (b2dSetMovieLoop(fireMovie,1) continuous fire animation). Common patterns: enable loop = b2dSetMovieLoop(movie,1) loop forever; disable loop = b2dSetMovieLoop(movie,0) play once; toggle = b2dSetMovieLoop(movie,Not looping) toggle state. Loop timing mechanics: targetFrame calculation (targetFrame = floor(elapsed x fps), can exceed frameCount), loop detection (if targetFrame >= frameCount, loop triggered), startTime adjustment (startTime += duration of completed loops, maintains timing accuracy), frame wrapping (targetFrame = targetFrame % frameCount, wraps to 0-frameCount range), seamless playback (no visible stutter or jump when looping, timing mathematically continuous). Non-looping finish: sets playing=false (stops frame advancement automatically), sets finished=true (marks as completed, b2dMoviePlaying returns 0), clears g_activeMovieHandle (movie no longer active, no frame updates), requires b2dPlayMovie to restart (finished flag prevents b2dResumeMovie from working, must use b2dPlayMovie or b2dStopMovie first). Default state: loop=false initially (loaded movies default to no looping, must explicitly enable), can change anytime (before or during playback, takes effect at next loop point), persistent (remains set until changed, survives across play/stop/pause cycles). Performance: cost zero (simple flag assignment, no GPU/IO operations), immediate (takes effect immediately, no delay), lightweight (safe to call even during playback, no state disruption). Validation: silently ignores if handle<=0 or not found (negative, zero, or invalid handle), accepts any integer (0 treated as false, non-zero treated as true, common pattern for boolean flags). Related: b2dPlayMovie starts playback (respects loop setting when reaching end), b2dMoviePlaying queries state (returns 0 when non-looping movie finishes), b2dStopMovie stops playback (clears finished flag, allows replay after non-looping completion).