A 2D tile-based sandbox game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Animation.cc 362B

1234567891011121314151617181920212223242526272829
  1. #include "Animation.h"
  2. #include "Win.h"
  3. namespace Swan {
  4. void Animation::tick(float dt) {
  5. timer_ -= dt;
  6. if (timer_ <= 0) {
  7. timer_ += interval_;
  8. frame_ += 1;
  9. if (frame_ >= resource_.num_frames_)
  10. frame_ = 0;
  11. dirty_ = true;
  12. }
  13. }
  14. void Animation::draw(Win &win) {
  15. }
  16. void Animation::reset() {
  17. timer_ = interval_;
  18. frame_ = 0;
  19. dirty_ = true;
  20. }
  21. }