mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-05 10:59:48 +00:00
adding the possibility to pause/resume an animation
This commit is contained in:
@@ -8,10 +8,11 @@
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex)
|
||||
AnimationsComponent::AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play)
|
||||
: WAL::Component(entity),
|
||||
_modelAnimation(std::move(modelAnimation)),
|
||||
_currentAnimIndex(animIndex)
|
||||
_currentAnimIndex(animIndex),
|
||||
_animDisabled(play)
|
||||
{
|
||||
this->_modelAnimation[this->_currentAnimIndex].setFrameCounter(0);
|
||||
}
|
||||
@@ -57,4 +58,14 @@ namespace BBM
|
||||
{
|
||||
this->_modelAnimation[this->_currentAnimIndex].incrementFrameCounter();
|
||||
}
|
||||
|
||||
void AnimationsComponent::setAnimDisabled(bool disable)
|
||||
{
|
||||
this->_animDisabled = disable;
|
||||
}
|
||||
|
||||
bool AnimationsComponent::isAnimDisabled() const
|
||||
{
|
||||
return this->_animDisabled;
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ namespace BBM
|
||||
RAY::ModelAnimations _modelAnimation;
|
||||
//! @brief The index of the
|
||||
int _currentAnimIndex;
|
||||
//! @brief Bool allowing to play pause an animation
|
||||
bool _animDisabled;
|
||||
public:
|
||||
//! @inherit
|
||||
WAL::Component *clone(WAL::Entity &entity) const override;
|
||||
@@ -43,8 +45,14 @@ namespace BBM
|
||||
//! @brief Increment the internal anim counter
|
||||
void incCurrentAnimFrameCounter();
|
||||
|
||||
//! @brief Allow to play pause animations
|
||||
void setAnimDisabled(bool disable);
|
||||
|
||||
//! @brief To know if the animation will be updated or not
|
||||
bool isAnimDisabled() const;
|
||||
|
||||
//! @brief ctor entity and the path of the animation file
|
||||
explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex);
|
||||
explicit AnimationsComponent(WAL::Entity &entity, RAY::ModelAnimations modelAnimation, int animIndex, bool play = true);
|
||||
//! @brief copy ctor
|
||||
AnimationsComponent(const AnimationsComponent &) = default;
|
||||
//! @brief dtor
|
||||
|
||||
Reference in New Issue
Block a user