From fe32b18d0cee98cc3abc694bffba945ad1a93bcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Waage?= Date: Mon, 6 Sep 2021 15:38:40 +0200 Subject: [PATCH] Isolating SFML to the Canvas class. --- lib/include/Board.hpp | 2 -- lib/include/Canvas.hpp | 5 +++++ lib/include/Game.hpp | 2 +- lib/include/Position.hpp | 7 ------- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/include/Board.hpp b/lib/include/Board.hpp index 783a344..fe30302 100644 --- a/lib/include/Board.hpp +++ b/lib/include/Board.hpp @@ -1,7 +1,5 @@ #pragma once -#include - #include "Direction.hpp" #include "Position.hpp" #include diff --git a/lib/include/Canvas.hpp b/lib/include/Canvas.hpp index 04231c7..eb315b2 100644 --- a/lib/include/Canvas.hpp +++ b/lib/include/Canvas.hpp @@ -1,5 +1,7 @@ #pragma once +#include + #include "GameState.hpp" #include "Position.hpp" #include "Score.hpp" @@ -7,6 +9,9 @@ namespace pacman { +using Rect = sf::Rect; +using Sprite = sf::Sprite; + class Canvas { public: Canvas(); diff --git a/lib/include/Game.hpp b/lib/include/Game.hpp index 74d7d48..db1e224 100644 --- a/lib/include/Game.hpp +++ b/lib/include/Game.hpp @@ -1,8 +1,8 @@ #pragma once -#include "Canvas.hpp" #include "GameState.hpp" #include "InputState.hpp" +#include "Canvas.hpp" namespace pacman { diff --git a/lib/include/Position.hpp b/lib/include/Position.hpp index c77bfc8..85c6563 100644 --- a/lib/include/Position.hpp +++ b/lib/include/Position.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include namespace pacman { @@ -16,10 +15,6 @@ struct GridPosition { constexpr GridPosition(size_t x, size_t y) : x(x), y(y) {} }; -using Rect = sf::Rect; - -using Sprite = sf::Sprite; - inline GridPosition positionToGridPosition(Position pos) { return { size_t(std::round(pos.x)), size_t(std::round(pos.y)) }; } @@ -44,6 +39,4 @@ constexpr bool operator!=(const Position & a, const Position & b) { return !(a == b); } - - } // namespace pacman