Isolating SFML to the Canvas class.
This commit is contained in:
parent
aa22b91e8b
commit
fe32b18d0c
4 changed files with 6 additions and 10 deletions
|
@ -1,7 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SFML/Graphics.hpp>
|
|
||||||
|
|
||||||
#include "Direction.hpp"
|
#include "Direction.hpp"
|
||||||
#include "Position.hpp"
|
#include "Position.hpp"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <SFML/Graphics.hpp>
|
||||||
|
|
||||||
#include "GameState.hpp"
|
#include "GameState.hpp"
|
||||||
#include "Position.hpp"
|
#include "Position.hpp"
|
||||||
#include "Score.hpp"
|
#include "Score.hpp"
|
||||||
|
@ -7,6 +9,9 @@
|
||||||
|
|
||||||
namespace pacman {
|
namespace pacman {
|
||||||
|
|
||||||
|
using Rect = sf::Rect<int>;
|
||||||
|
using Sprite = sf::Sprite;
|
||||||
|
|
||||||
class Canvas {
|
class Canvas {
|
||||||
public:
|
public:
|
||||||
Canvas();
|
Canvas();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Canvas.hpp"
|
|
||||||
#include "GameState.hpp"
|
#include "GameState.hpp"
|
||||||
#include "InputState.hpp"
|
#include "InputState.hpp"
|
||||||
|
#include "Canvas.hpp"
|
||||||
|
|
||||||
namespace pacman {
|
namespace pacman {
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SFML/Graphics.hpp>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace pacman {
|
namespace pacman {
|
||||||
|
@ -16,10 +15,6 @@ struct GridPosition {
|
||||||
constexpr GridPosition(size_t x, size_t y) : x(x), y(y) {}
|
constexpr GridPosition(size_t x, size_t y) : x(x), y(y) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
using Rect = sf::Rect<int>;
|
|
||||||
|
|
||||||
using Sprite = sf::Sprite;
|
|
||||||
|
|
||||||
inline GridPosition positionToGridPosition(Position pos) {
|
inline GridPosition positionToGridPosition(Position pos) {
|
||||||
return { size_t(std::round(pos.x)), size_t(std::round(pos.y)) };
|
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);
|
return !(a == b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace pacman
|
} // namespace pacman
|
||||||
|
|
Loading…
Reference in a new issue