diff --git a/lib/Board.cpp b/lib/Board.cpp index 8b1994d..18cfb79 100644 --- a/lib/Board.cpp +++ b/lib/Board.cpp @@ -48,7 +48,7 @@ Board::Board() { board_state[row][column] = board[row][column]; } -bool Board::isWalkable(Position point, float_t position_delta, Direction direction) const { +bool Board::isWalkable(Position point, float position_delta, Direction direction) const { switch (direction) { case Direction::LEFT: return board_state[int(point.y)][int(point.x - position_delta)] != 0; diff --git a/lib/Board.hpp b/lib/Board.hpp index 53f41b6..7518a07 100644 --- a/lib/Board.hpp +++ b/lib/Board.hpp @@ -15,7 +15,7 @@ class Board { public: Board(); - [[nodiscard]] bool isWalkable(Position point, float_t d, Direction direction) const; + [[nodiscard]] bool isWalkable(Position point, float d, Direction direction) const; [[nodiscard]] std::vector initialPelletPositions() const; diff --git a/lib/GameWindow.cpp b/lib/GameWindow.cpp index 1b1e718..ca08d23 100644 --- a/lib/GameWindow.cpp +++ b/lib/GameWindow.cpp @@ -38,7 +38,7 @@ void GameWindow::renderSuperPellets(const SuperPellets & superPellets) const { SDL_Rect sprite_rect = superPellets.currentSprite(); std::vector superPelletPositions = superPellets.currentPositions(); for (const auto & pos : superPelletPositions) { - SDL_Rect maze_rect = targetRect({float_t(pos.x), float_t(pos.y)}, 8 * SCALE_FACTOR); + SDL_Rect maze_rect = targetRect({float(pos.x), float(pos.y)}, 8 * SCALE_FACTOR); renderTexture(sprite_texture.get(), &sprite_rect, &maze_rect); } } @@ -47,7 +47,7 @@ void GameWindow::renderPellets(const Pellets & pellets) const { SDL_Rect sprite_rect = pellets.currentSprite(); std::vector pelletPositions = pellets.currentPositions(); for (const auto & pos : pelletPositions) { - SDL_Rect maze_rect = targetRect({float_t(pos.x), float_t(pos.y)}, 8 * SCALE_FACTOR); + SDL_Rect maze_rect = targetRect({float(pos.x), float(pos.y)}, 8 * SCALE_FACTOR); renderTexture(sprite_texture.get(), &sprite_rect, &maze_rect); } } diff --git a/lib/PacMan.cpp b/lib/PacMan.cpp index 770400a..2e8726d 100644 --- a/lib/PacMan.cpp +++ b/lib/PacMan.cpp @@ -33,7 +33,7 @@ void PacMan::updateAnimationPosition(std::chrono::milliseconds time_delta) { } void PacMan::updateMazePosition(std::chrono::milliseconds time_delta, const Board & board) { - float_t position_delta = (time_delta.count() / 128.0); + float position_delta = (time_delta.count() / 128.0); if (board.isWalkable(pos, position_delta, desired_direction)) { direction = desired_direction; diff --git a/lib/PacManAnimation.hpp b/lib/PacManAnimation.hpp index be24c5e..1857981 100644 --- a/lib/PacManAnimation.hpp +++ b/lib/PacManAnimation.hpp @@ -18,7 +18,7 @@ public: private: uint8_t animation_position = 0; - float_t animation_position_delta = 0.0; + float animation_position_delta = 0.0; const SDL_Rect right_wide = {0 * 32, 0 * 32, 32, 32}; const SDL_Rect right_narrow = {1 * 32, 0 * 32, 32, 32}; const SDL_Rect closed = {2 * 32, 0 * 32, 32, 32}; diff --git a/lib/Position.hpp b/lib/Position.hpp index 483acd2..ee633d5 100644 --- a/lib/Position.hpp +++ b/lib/Position.hpp @@ -4,8 +4,8 @@ #include struct Position { - float_t x; - float_t y; + float x; + float y; }; #endif //PACMAN_POSITION_H diff --git a/solution/SOLUTION.md b/solution/SOLUTION.md index e10d705..138fc8f 100644 --- a/solution/SOLUTION.md +++ b/solution/SOLUTION.md @@ -3,9 +3,9 @@ ## Make Pac-Man go slower Increase the number you divide the delta with in [PacMan.cpp](../lib/PacMan.cpp) ~~~ -float_t position_delta = (time_delta.count() / 128.0); +float position_delta = (time_delta.count() / 128.0); ~~~ Example ~~~ -float_t position_delta = (time_delta.count() / 256.0); +float position_delta = (time_delta.count() / 256.0); ~~~