Skip to content

cf_video_sprite

Category: video
GitHub: cute_video.h


The picture currently being shown, as a sprite ready to draw.

CF_Sprite cf_video_sprite(CF_Video* video);
Parameters Description
video The video.

Return Value

Returns a sprite owned by the video, sized to the video.

Remarks

This is the short way to get a video on screen:

cf_video_update(video, CF_DELTA_TIME);
CF_Sprite sprite = cf_video_sprite(video);
cf_draw_sprite(&sprite);

Everything the draw API can do to a sprite works here -- transforms, tint, layers. The sprite is re-uploaded only when the frame actually changes. Do not call cf_easy_sprite_unload on it; cf_destroy_video handles it. Note what cf_easy_sprite_update_pixels says about cost: the first few updates after the image packs rebuild an atlas page, after which it migrates to a texture of its own and settles. If that matters, or if the frames are headed for a shader rather than the draw API, use cf_video_texture instead.

CF_Video
cf_video_texture
cf_video_update
cf_draw_sprite