snake/include/Player.h

40 lines
611 B
C++

#pragma once
#include <SFML/Graphics.hpp>
#include <Util.h>
enum class Direction
{
up,
down,
left,
right
};
struct SnakeNode
{
SnakeNode(sf::Vector2u gridPos_in, const sf::Color& color_in = sf::Color::White);
// sf::Vector2f windowPos{};
sf::Vector2u gridPos{};
sf::Vector2u previousGridPos{};
Color color{};
sf::Vector2f windowPos(float gridSize_in);
};
struct Player
{
Player() = default;
SnakeNode& head();
std::vector<SnakeNode> body;
int score{};
Direction facing{Direction::up};
Direction inputBuffer{};
bool left{false};
bool right{false};
bool up{false};
bool down{false};
};