Give function a shorter name to fit on a slide :)
This commit is contained in:
parent
628f01b276
commit
9644229061
4 changed files with 5 additions and 5 deletions
|
@ -53,7 +53,7 @@ void GameWindow::renderPellets(const Pellets & pellets) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameWindow::renderPacMan(const PacMan & pac_man) const {
|
void GameWindow::renderPacMan(const PacMan & pac_man) const {
|
||||||
Position maze_position = pac_man.currentPosition();
|
Position maze_position = pac_man.position();
|
||||||
SDL_Rect maze_rect = targetRect(maze_position, 8 * SCALE_FACTOR);
|
SDL_Rect maze_rect = targetRect(maze_position, 8 * SCALE_FACTOR);
|
||||||
SDL_Rect sprite_rect = pac_man.currentSprite();
|
SDL_Rect sprite_rect = pac_man.currentSprite();
|
||||||
renderTexture(sprite_texture.get(), &sprite_rect, &maze_rect);
|
renderTexture(sprite_texture.get(), &sprite_rect, &maze_rect);
|
||||||
|
|
|
@ -7,7 +7,7 @@ SDL_Rect PacMan::currentSprite() const {
|
||||||
return pacManAnimation.animationFrame(direction);
|
return pacManAnimation.animationFrame(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Position PacMan::currentPosition() const {
|
Position PacMan::position() const {
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] SDL_Rect currentSprite() const;
|
[[nodiscard]] SDL_Rect currentSprite() const;
|
||||||
|
|
||||||
[[nodiscard]] Position currentPosition() const;
|
[[nodiscard]] Position position() const;
|
||||||
|
|
||||||
void update(std::chrono::milliseconds time_delta, InputState state, const Board & board);
|
void update(std::chrono::milliseconds time_delta, InputState state, const Board & board);
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
TEST(PacManTest, InitialPosition) {
|
TEST(PacManTest, InitialPosition) {
|
||||||
Board board;
|
Board board;
|
||||||
PacMan pacMan(board);
|
PacMan pacMan(board);
|
||||||
EXPECT_EQ(pacMan.currentPosition().x, 14);
|
EXPECT_EQ(pacMan.position().x, 14);
|
||||||
EXPECT_EQ(pacMan.currentPosition().y, 23);
|
EXPECT_EQ(pacMan.position().y, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
Loading…
Reference in a new issue