2022-07-25 15:40:45 -05:00
|
|
|
//Snake.h
|
|
|
|
#ifndef SNAKE_H
|
|
|
|
#define SNAKE_H
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
bool SnakeCollision(sf::RectangleShape object1, sf::RectangleShape object2);
|
2022-07-26 19:03:55 -05:00
|
|
|
int SnakeMovement();
|
|
|
|
sf::Vector2f CalculateNewPosition(int direction, sf::Vector2f position);
|
2022-07-25 15:40:45 -05:00
|
|
|
|
|
|
|
class Snake
|
|
|
|
{
|
|
|
|
private:
|
2022-07-25 16:06:06 -05:00
|
|
|
std::deque<sf::RectangleShape> snakeBody;
|
2022-07-26 19:47:08 -05:00
|
|
|
int snakeDirection = 0;
|
2022-07-25 15:40:45 -05:00
|
|
|
public:
|
2022-07-26 16:56:26 -05:00
|
|
|
Snake();
|
|
|
|
Snake(sf::Vector2f head);
|
2022-07-26 19:03:55 -05:00
|
|
|
sf::Vector2f GetSnakeHeadPosition();
|
|
|
|
sf::RectangleShape GetSnakeHead();
|
|
|
|
void DisplaySnake(sf::RenderWindow& window);
|
2022-07-27 15:07:28 -05:00
|
|
|
void MoveSnake(sf::RectangleShape& snakeFood);
|
2022-07-26 19:47:08 -05:00
|
|
|
void CheckDirection();
|
|
|
|
bool CheckBoundaries();
|
2022-07-25 15:40:45 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|