SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SDL::AnimationRef Struct Reference

Animated image support. More...

Inheritance diagram for SDL::AnimationRef:
Inheritance graph
[legend]

Public Member Functions

int GetWidth () const
 Get the width in pixels.
 
int GetHeight () const
 Get the height in pixels.
 
Point GetSize () const
 Get the size in pixels.
 
int GetCount () const
 Return the number of frames.
 
SurfaceRef GetFrame (int index) const
 Return the frame image under given index.
 
int GetDelay (int index) const
 Return the frame delay under given index.
 
constexpr Resource (T resource={})
 Constructs from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< T > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
- Public Member Functions inherited from SDL::Resource< IMG_Animation * >
constexpr Resource (IMG_Animation * resource={})
 Constructs from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< IMG_Animation * > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr operator value_type () const
 Converts back to underlying type.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr IMG_Animation * get () const
 Return contained resource;.
 
constexpr const IMG_Animation * operator-> () const
 Access to fields.
 
constexpr IMG_Animation * operator-> ()
 Access to fields.
 

Static Public Member Functions

static void reset (IMG_Animation *resource)
 Dispose of an AnimationRef and free its resources.
 

Additional Inherited Members

- Public Types inherited from SDL::Resource< IMG_Animation * >
using value_type = IMG_Animation *
 The raw resource type.
 

Detailed Description

Currently only animated GIFs and WEBP images are supported.

Category:
Resource
See also
Animation

Member Function Documentation

◆ GetDelay()

int SDL::AnimationRef::GetDelay ( int  index) const
inline
Parameters
indexthe index to get frame, within [0, GetCount() - 1]

◆ GetFrame()

SurfaceRef SDL::AnimationRef::GetFrame ( int  index) const
inline
Parameters
indexthe index to get frame, within [0, GetCount() - 1]

◆ reset()

static void SDL::AnimationRef::reset ( IMG_Animation *  resource)
inlinestatic

The provided anim pointer is not valid once this call returns.

Parameters
resourceAnimationRef to dispose of.
Since
This function is available since SDL_image 3.0.0.
See also
Animation.Load
Animation.LoadTyped

The documentation for this struct was generated from the following file: