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
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
#include "Direction.hpp"
|
||||
#include "Position.hpp"
|
||||
#include <array>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
#include "GameState.hpp"
|
||||
#include "Position.hpp"
|
||||
#include "Score.hpp"
|
||||
|
@ -7,6 +9,9 @@
|
|||
|
||||
namespace pacman {
|
||||
|
||||
using Rect = sf::Rect<int>;
|
||||
using Sprite = sf::Sprite;
|
||||
|
||||
class Canvas {
|
||||
public:
|
||||
Canvas();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "Canvas.hpp"
|
||||
#include "GameState.hpp"
|
||||
#include "InputState.hpp"
|
||||
#include "Canvas.hpp"
|
||||
|
||||
namespace pacman {
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <cmath>
|
||||
|
||||
namespace pacman {
|
||||
|
@ -16,10 +15,6 @@ struct GridPosition {
|
|||
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) {
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue