2021-06-10 12:42:51 +00:00
|
|
|
#pragma once
|
2020-11-28 12:04:14 +00:00
|
|
|
|
2021-06-24 11:32:52 +00:00
|
|
|
#include "Atlas.hpp"
|
2020-11-28 13:10:25 +00:00
|
|
|
#include "Board.hpp"
|
|
|
|
#include "Direction.hpp"
|
|
|
|
#include "InputState.hpp"
|
|
|
|
#include "Position.hpp"
|
2020-11-28 12:04:14 +00:00
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
|
2021-07-05 12:10:01 +00:00
|
|
|
namespace pacman {
|
|
|
|
|
2020-11-28 12:04:14 +00:00
|
|
|
class PacManAnimation {
|
|
|
|
public:
|
2021-07-05 09:46:49 +00:00
|
|
|
[[nodiscard]] GridPosition animationFrame(Direction direction) const;
|
2021-07-07 09:24:12 +00:00
|
|
|
[[nodiscard]] GridPosition deathAnimationFrame() const;
|
2020-11-28 12:04:14 +00:00
|
|
|
|
2021-06-28 10:42:21 +00:00
|
|
|
void updateAnimationPosition(std::chrono::milliseconds time_delta, bool dead);
|
2021-06-24 07:46:58 +00:00
|
|
|
void pause();
|
|
|
|
|
2020-11-28 12:04:14 +00:00
|
|
|
private:
|
|
|
|
uint8_t animation_position = 0;
|
2021-07-05 09:40:10 +00:00
|
|
|
double animation_position_delta = 0.0;
|
2021-07-05 09:46:49 +00:00
|
|
|
const GridPosition down_animation[4]{ Atlas::pacman_down_wide, Atlas::pacman_down_narrow, Atlas::pacman_closed, Atlas::pacman_down_narrow };
|
|
|
|
const GridPosition left_animation[4]{ Atlas::pacman_left_wide, Atlas::pacman_left_narrow, Atlas::pacman_closed, Atlas::pacman_left_narrow };
|
|
|
|
const GridPosition right_animation[4]{ Atlas::pacman_right_wide, Atlas::pacman_right_narrow, Atlas::pacman_closed, Atlas::pacman_right_narrow };
|
|
|
|
const GridPosition up_animation[4]{ Atlas::pacman_up_wide, Atlas::pacman_up_narrow, Atlas::pacman_closed, Atlas::pacman_up_narrow };
|
2020-11-28 12:04:14 +00:00
|
|
|
};
|
2021-07-05 12:10:01 +00:00
|
|
|
|
|
|
|
} // namespace pacman
|