Tileset animations.

This commit is contained in:
2022-12-07 20:13:59 -08:00
parent 5b6f9124b5
commit eb6c4c8076
16 changed files with 262 additions and 165 deletions

View File

@ -11,7 +11,8 @@ using namespace Dawn;
PokerPlayerDisplay::PokerPlayerDisplay(UICanvas *canvas) :
UIEmpty(canvas),
labelName(canvas),
labelChips(canvas)
labelChips(canvas),
animChips(&animChipsValue)
{
this->font = getGame()->assetManager.get<TrueTypeAsset>("truetype_ark");
@ -36,6 +37,9 @@ PokerPlayerDisplay::PokerPlayerDisplay(UICanvas *canvas) :
0.0f
);
// Anim
this->animChips.easing = &easeOutQuart;
// Events
getScene()->eventSceneUnpausedUpdate.addListener(this, &PokerPlayerDisplay::onSceneUpdate);
}
@ -68,8 +72,8 @@ void PokerPlayerDisplay::onPlayerChipsChanged() {
std::cout << "Chips" << player->chips << std::endl;
this->animChips.clear();
this->animChips.addKeyframe(&this->animChipsValue, 0.0f, this->animChipsValue);
this->animChips.addKeyframe(&this->animChipsValue, 1.0f, this->player->chips);
this->animChips.addKeyframe(0.0f, this->animChipsValue);
this->animChips.addKeyframe(1.0f, this->player->chips);
this->animChips.restart();
}

View File

@ -9,12 +9,12 @@
#include "poker/PokerPlayer.hpp"
#include "asset/AssetManager.hpp"
#include "asset/assets/TrueTypeAsset.hpp"
#include "display/animation/Animation.hpp"
#include "display/animation/SimpleAnimation.hpp"
namespace Dawn {
class PokerPlayerDisplay : public UIEmpty {
private:
Animation<int32_t> animChips;
SimpleAnimation<int32_t> animChips;
int32_t animChipsValue;
protected: