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

Handle to a non owned animation. More...

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

Public Member Functions

constexpr AnimationRef (const AnimationRef &other)
 Copy constructor.
 
constexpr AnimationRef (AnimationRef &&other)
 Move constructor.
 
constexpr ~AnimationRef ()=default
 Default constructor.
 
AnimationRefoperator= (AnimationRef other)
 Assignment operator.
 
void reset (IMG_Animation *newResource={})
 Dispose of an AnimationBase and free its resources.
 
 AnimationBase (StringParam file)
 Load an animation from a file.
 
 AnimationBase (IOStreamBase &src)
 Load an animation from an IOStreamBase.
 
 AnimationBase (IOStreamBase &src, StringParam type)
 Load an animation from an SDL datasource.
 
- Public Member Functions inherited from SDL::AnimationBase
 AnimationBase (StringParam file)
 Load an animation from a file.
 
 AnimationBase (IOStreamBase &src)
 Load an animation from an IOStreamBase.
 
 AnimationBase (IOStreamBase &src, StringParam type)
 Load an animation from an SDL datasource.
 
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 the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< IMG_Animation * >
constexpr Resource (IMG_Animation * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
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 IMG_Animation * release (IMG_Animation * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const IMG_Animation * operator-> () const
 Access to fields.
 
constexpr IMG_Animation * operator-> ()
 Access to fields.
 

Detailed Description

Category:
Resource
See also
AnimationBase
Animation

Member Function Documentation

◆ AnimationBase() [1/3]

SDL::AnimationBase::AnimationBase ( IOStreamBase src)
inline
Parameters
srcan IOStreamBase that data will be read from.
Postcondition
a new AnimationBase, or nullptr on error.
Since
This function is available since SDL_image 3.0.0.
See also
AnimationRef.reset

◆ AnimationBase() [2/3]

SDL::AnimationBase::AnimationBase ( IOStreamBase src,
StringParam  type 
)
inline

Even though this function accepts a file type, SDL_image may still try other decoders that are capable of detecting file type from the contents of the image data, but may rely on the caller-provided type string for formats that it cannot autodetect. If type is nullptr, SDL_image will rely solely on its ability to guess the format.

Parameters
srcan SDL_IOStream that data will be read from.
typea filename extension that represent this data ("GIF", etc).
Postcondition
a new AnimationBase, or nullptr on error.
Since
This function is available since SDL_image 3.0.0.
See also
AnimationRef.reset

◆ AnimationBase() [3/3]

SDL::AnimationBase::AnimationBase ( StringParam  file)
inline
Parameters
filepath on the filesystem containing an animated image.
Postcondition
a new Animation, or nullptr on error.
Since
This function is available since SDL_image 3.0.0.
See also
AnimationRef.reset

◆ reset()

void SDL::AnimationRef::reset ( IMG_Animation *  newResource = {})
inline
Since
This function is available since SDL_image 3.0.0.
See also
AnimationBase.AnimationBase
AnimationBase.AnimationBase
AnimationBase.AnimationBase

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