add Animation constructor with just frame length parameter
This commit is contained in:
parent
0e4f06d779
commit
27ab95037f
@ -32,10 +32,10 @@ public:
|
||||
Animation();
|
||||
|
||||
/*!
|
||||
* @deprecated It is preferable to use the default constructor, provide a frame length using Animation::frame_length(float), and
|
||||
* omit the callback function. This is because storing the callback function in this object can create copying issues when
|
||||
* std::bind is used to create the callback. Instead, check the return value of Animation::update(float) to determine whether or
|
||||
* not to call the desired callback externally.
|
||||
* @deprecated It is preferable to use Animation::Animation() or Animation::Animation(float) and omit the callback function,
|
||||
* which will eventually be removed from this object. This is because storing the callback function can create copying issues
|
||||
* when std::bind is used to create the callback and the bound object is destroyed before the callback is called. Instead,
|
||||
* check the return value of Animation::update(float) to determine whether or not to call the desired callback externally.
|
||||
*
|
||||
* Create an Animation object by supplying a function and interval at which the function should run. Run Animation::update(float)
|
||||
* regularly with an updated timestamp from Game::update(float), and the function will be launched automatically at the given
|
||||
@ -49,6 +49,17 @@ public:
|
||||
timer.off();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Create an Animation object with a specific amount of time in seconds between each frame. Animation::update(float) will only
|
||||
* return true when it is time to display another frame.
|
||||
*
|
||||
* @param frame_length seconds between each frame
|
||||
*/
|
||||
Animation(float frame_length) : _frame_length(frame_length)
|
||||
{
|
||||
timer.off();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Set the duration in seconds of each frame of the animation.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user