about summary refs log tree commit diff stats
path: root/.gitmodules
blob: e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 (plain) (blame)

me.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#ifndef ANIMATION_SYSTEM_H_CCCC7CB8
#define ANIMATION_SYSTEM_H_CCCC7CB8

#include <string_view>
#include <vector>
#include "direction.h"
#include "system.h"
#include "timer.h"

class Game;

class AnimationSystem : public System {
public:

  static constexpr SystemKey Key = SystemKey::Animation;

  AnimationSystem(Game& game) : game_(game) {}

  void tick(double dt) override;

  void initSprite(int spriteId, std::string_view filename);

  void setSpriteDirection(int spriteId, Direction dir);

  void setSpriteAnimation(int spriteId, std::string_view name);

private:

  void updateAnimation(int spriteId);

  Game& game_;
  std::vector<Timer> animTimers_ = {{1000/5}, {1000/60}};//30fps * 1000 t/s;;
  Timer bobbingTimer_ {1000/7};
};

#endif /* end of include guard: ANIMATION_SYSTEM_H_CCCC7CB8 */