pacman/lib/PacManAnimation.hpp

33 lines
1.1 KiB
C++
Raw Normal View History

2021-06-10 12:42:51 +00:00
#pragma once
2020-11-28 12:04:14 +00:00
#include "Board.hpp"
#include "Direction.hpp"
#include "InputState.hpp"
#include "Position.hpp"
2020-11-28 12:04:14 +00:00
#include <chrono>
class PacManAnimation {
public:
[[nodiscard]] PositionInt animationFrame(Direction direction) const;
2020-11-28 12:04:14 +00:00
void updateAnimationPosition(std::chrono::milliseconds time_delta);
private:
uint8_t animation_position = 0;
2021-05-10 13:14:38 +00:00
float animation_position_delta = 0.0;
const PositionInt right_wide = { 0, 0 };
const PositionInt right_narrow = { 1, 0 };
const PositionInt closed = { 2, 0 };
const PositionInt left_narrow = { 3, 0 };
const PositionInt left_wide = { 4, 0 };
const PositionInt up_wide = { 5, 0 };
const PositionInt up_narrow = { 6, 0 };
const PositionInt down_wide = { 7, 0 };
const PositionInt down_narrow = { 8, 0 };
const PositionInt down_animation[4]{ down_wide, down_narrow, closed, down_narrow };
const PositionInt left_animation[4]{ left_wide, left_narrow, closed, left_narrow };
const PositionInt right_animation[4]{ right_wide, right_narrow, closed, right_narrow };
const PositionInt up_animation[4]{ up_wide, up_narrow, closed, up_narrow };
2020-11-28 12:04:14 +00:00
};