Gorgon Game Engine
basic_TextureAnimationProvider< T_, A_, F_ > Class Template Reference
Inheritance diagram for basic_TextureAnimationProvider< T_, A_, F_ >:
[legend]

Public Types

using AnimationType = basic_TextureAnimation< T_, basic_TextureAnimationProvider< T_, A_, F_ >, F_ >
 
using ConstIterator = typename std::vector< basic_AnimationFrame< T_ > >::const_iterator
 
using FrameType = F_
 
using Iterator = typename std::vector< basic_AnimationFrame< T_ > >::iterator
 

Public Member Functions

 basic_TextureAnimationProvider ()=default
 
template<class C_ >
 basic_TextureAnimationProvider (C_ &&other)
 
 basic_TextureAnimationProvider (const basic_TextureAnimationProvider &)=delete
 
 ~basic_TextureAnimationProvider ()
 
void Add (const F_ &frame)
 
void Add (const Gorgon::Animation::Frame &frame) override
 
void Add (T_ &&image, unsigned duration=42)
 Adds the given image to the end of the animation. More...
 
void Add (T_ &image, unsigned duration=42, bool own=false)
 Adds the given image to the end of the animation. More...
 
Iterator begin ()
 Returns an iterator to the beginning of the animation frames. More...
 
ConstIterator begin () const
 Returns an iterator to the beginning of the animation frames. More...
 
void Clear () override
 Removes all images from the animation. More...
 
virtual AnimationTypeCreateAnimation (bool create=true) const override
 Creates a new animation from this resource. More...
 
virtual AnimationTypeCreateAnimation (Gorgon::Animation::ControllerBase &controller) const override
 Creates a new animation from this resource. More...
 
basic_TextureAnimationProvider Duplicate () const
 
Iterator end ()
 Returns an iterator to the end of the animation frames. More...
 
ConstIterator end () const
 Returns an iterator to the end of the animation frames. More...
 
const F_ & FrameAt (int index) const override
 Returns the frame at specific point. More...
 
unsigned FrameIndexAt (unsigned time) const
 Returns which frame is at the given time. More...
 
int GetCount () const override
 Returns number of frames. More...
 
unsigned GetDuration () const override
 Returns the duration of the animation. More...
 
unsigned GetDuration (unsigned frame) const override
 Returns the duration of the given frame. More...
 
int GetHeight () const
 Returns the size of the first image. More...
 
Geometry::Size GetSize () const override
 Returns the size of the first image. More...
 
int GetWidth () const
 Returns the size of the first image. More...
 
T_ & ImageAt (unsigned time) const
 Returns the image that is to be shown at the given time. More...
 
void Insert (const F_ &frm, int before)
 Inserts the given image before the given frame. More...
 
void Insert (const Gorgon::Animation::Frame &frame, int before) override
 Inserts the given image before the given frame. More...
 
void Insert (T_ &&img, int before, unsigned duration=42)
 Inserts the given image before the given frame. More...
 
void Insert (T_ &image, int before, unsigned duration=42)
 Inserts the given image before the given frame. More...
 
void MoveBefore (unsigned index, int before) override
 Moves a frame that has the index before the given position. More...
 
virtual auto MoveOutProvider () -> decltype(*this) override
 
template<class C_ >
basic_TextureAnimationProvideroperator= (C_ &&other)
 
basic_TextureAnimationProvideroperator= (const basic_TextureAnimationProvider &)=delete
 
T_ & operator[] (int frame) const
 Returns the image at the given frame. More...
 
void Own (T_ &image)
 Owns the given image so that it would be destroyed with this animation. More...
 
void ReleaseAll ()
 Releases ownership of all images in the animation without destroying them. More...
 
void Remove (ConstIterator it)
 Removes an image from the animation. More...
 
void Remove (unsigned frame) override
 Removes an image from the animation. More...
 
unsigned StartOf (unsigned frame) const override
 Returns the starting time of the given frame. More...
 

Protected Attributes

Containers::Collection< T_ > destroylist
 
unsigned duration
 
std::vector< basic_AnimationFrame< T_ > > frames
 

Member Typedef Documentation

◆ AnimationType

◆ ConstIterator

using ConstIterator = typename std::vector<basic_AnimationFrame<T_> >::const_iterator

◆ FrameType

using FrameType = F_

◆ Iterator

using Iterator = typename std::vector<basic_AnimationFrame<T_> >::iterator

Constructor & Destructor Documentation

◆ basic_TextureAnimationProvider() [1/3]

◆ basic_TextureAnimationProvider() [2/3]

◆ basic_TextureAnimationProvider() [3/3]

◆ ~basic_TextureAnimationProvider()

Member Function Documentation

◆ Add() [1/4]

◆ Add() [2/4]

void Add ( const Gorgon::Animation::Frame frame)
override

◆ Add() [3/4]

void Add ( T_ &&  image,
unsigned  duration = 42 
)

Adds the given image to the end of the animation.

This version owns the given image by moving it in the ownership list

References basic_TextureAnimationProvider< T_, A_, F_ >::destroylist, basic_TextureAnimationProvider< T_, A_, F_ >::duration, and basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ Add() [4/4]

void Add ( T_ &  image,
unsigned  duration = 42,
bool  own = false 
)

◆ begin() [1/2]

Iterator begin ( )

Returns an iterator to the beginning of the animation frames.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ begin() [2/2]

ConstIterator begin ( ) const

Returns an iterator to the beginning of the animation frames.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ Clear()

void Clear ( )
override

◆ CreateAnimation() [1/2]

virtual AnimationType& CreateAnimation ( bool  create = true) const
overridevirtual

Creates a new animation from this resource.

◆ CreateAnimation() [2/2]

virtual AnimationType& CreateAnimation ( Gorgon::Animation::ControllerBase controller) const
overridevirtual

Creates a new animation from this resource.

◆ Duplicate()

◆ end() [1/2]

Iterator end ( )

Returns an iterator to the end of the animation frames.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ end() [2/2]

ConstIterator end ( ) const

Returns an iterator to the end of the animation frames.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ FrameAt()

const F_& FrameAt ( int  index) const
override

Returns the frame at specific point.

References ASSERT, and basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ FrameIndexAt()

unsigned FrameIndexAt ( unsigned  time) const

Returns which frame is at the given time.

If the given time is larger than the animation duration, last frame is returned.

References ASSERT, and basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ GetCount()

int GetCount ( ) const
override

Returns number of frames.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ GetDuration() [1/2]

unsigned GetDuration ( ) const
override

Returns the duration of the animation.

References basic_TextureAnimationProvider< T_, A_, F_ >::duration.

◆ GetDuration() [2/2]

unsigned GetDuration ( unsigned  frame) const
override

Returns the duration of the given frame.

References ASSERT, and basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ GetHeight()

int GetHeight ( ) const

Returns the size of the first image.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ GetSize()

Geometry::Size GetSize ( ) const
override

Returns the size of the first image.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ GetWidth()

int GetWidth ( ) const

Returns the size of the first image.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ ImageAt()

T_& ImageAt ( unsigned  time) const

Returns the image that is to be shown at the given time.

If the given time is larger than the animation duration, animation is assumed to be looping.

References ASSERT, basic_TextureAnimationProvider< T_, A_, F_ >::duration, basic_TextureAnimationProvider< T_, A_, F_ >::FrameAt(), basic_TextureAnimationProvider< T_, A_, F_ >::frames, and basic_TextureAnimationProvider< T_, A_, F_ >::GetDuration().

◆ Insert() [1/4]

void Insert ( const F_ &  frm,
int  before 
)

◆ Insert() [2/4]

void Insert ( const Gorgon::Animation::Frame frame,
int  before 
)
override

Inserts the given image before the given frame.

References basic_TextureAnimationProvider< T_, A_, F_ >::Insert().

◆ Insert() [3/4]

void Insert ( T_ &&  img,
int  before,
unsigned  duration = 42 
)

◆ Insert() [4/4]

void Insert ( T_ &  image,
int  before,
unsigned  duration = 42 
)

◆ MoveBefore()

void MoveBefore ( unsigned  index,
int  before 
)
override

Moves a frame that has the index before the given position.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ MoveOutProvider()

virtual auto MoveOutProvider ( ) -> decltype(*this)
overridevirtual

Reimplemented in Animation.

◆ operator=() [1/2]

◆ operator=() [2/2]

basic_TextureAnimationProvider& operator= ( const basic_TextureAnimationProvider< T_, A_, F_ > &  )
delete

◆ operator[]()

T_& operator[] ( int  frame) const

Returns the image at the given frame.

References ASSERT, and basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ Own()

void Own ( T_ &  image)

Owns the given image so that it would be destroyed with this animation.

References basic_TextureAnimationProvider< T_, A_, F_ >::destroylist.

◆ ReleaseAll()

void ReleaseAll ( )

Releases ownership of all images in the animation without destroying them.

References basic_TextureAnimationProvider< T_, A_, F_ >::destroylist.

◆ Remove() [1/2]

void Remove ( ConstIterator  it)

Removes an image from the animation.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

◆ Remove() [2/2]

◆ StartOf()

unsigned StartOf ( unsigned  frame) const
override

Returns the starting time of the given frame.

References basic_TextureAnimationProvider< T_, A_, F_ >::frames.

Member Data Documentation

◆ destroylist

Containers::Collection<T_> destroylist
protected

◆ duration

unsigned duration
protected

◆ frames

std::vector<basic_AnimationFrame<T_> > frames
protected

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