2023-04-06 19:27:10 -05:00
|
|
|
// Snake.h
|
|
|
|
#ifndef SNAKE_HPP
|
|
|
|
#define SNAKE_HPP
|
|
|
|
|
2023-04-06 22:22:06 -05:00
|
|
|
#include <SFML/System/Vector2.hpp>
|
2023-04-06 19:27:10 -05:00
|
|
|
#include <memory>
|
|
|
|
#include <queue>
|
|
|
|
#include <random>
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
|
|
|
namespace snakeplusplus
|
|
|
|
{
|
2023-04-06 22:22:06 -05:00
|
|
|
struct Snake
|
2023-04-06 19:27:10 -05:00
|
|
|
{
|
|
|
|
public:
|
2023-04-06 22:22:06 -05:00
|
|
|
sf::Vector2f headLocation;
|
|
|
|
sf::Vector2f speed;
|
2023-04-15 05:15:11 -05:00
|
|
|
std::queue<char*> body;
|
2023-04-06 19:27:10 -05:00
|
|
|
void Pop(void);
|
|
|
|
};
|
|
|
|
|
2023-04-06 22:22:06 -05:00
|
|
|
struct Food
|
2023-04-06 19:27:10 -05:00
|
|
|
{
|
|
|
|
public:
|
2023-04-06 22:22:06 -05:00
|
|
|
Food(void);
|
|
|
|
sf::Vector2f location;
|
2023-04-15 05:15:11 -05:00
|
|
|
char* food;
|
2023-04-06 19:27:10 -05:00
|
|
|
void GenerateNewFood(sf::Vector2f boundaries);
|
|
|
|
private:
|
|
|
|
std::default_random_engine generator;
|
|
|
|
int GenerateRandomNumber(int generationLimit);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|