Fixed snake
This commit is contained in:
@@ -15,8 +15,6 @@ namespace snakeplusplus
|
||||
GameEngine();
|
||||
void StartGame(void);
|
||||
sf::Vector2f GetGameBoundaries(void);
|
||||
protected:
|
||||
;
|
||||
private:
|
||||
std::vector< std::vector<char> > gameBoard;
|
||||
PlayerInput controls;
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace snakeplusplus
|
||||
public:
|
||||
PlayerInput(void);
|
||||
PlayerDirection GetPlayerInput(void);
|
||||
protected:
|
||||
;
|
||||
private:
|
||||
PlayerDirection lastPlayerInput;
|
||||
};
|
||||
@@ -26,10 +24,8 @@ namespace snakeplusplus
|
||||
PlayerOutput(void);
|
||||
bool IsOpen(void);
|
||||
void CheckContinue(void);
|
||||
void DisplayGameState(std::vector< std::vector<char> >* gameBoard);
|
||||
void DisplayGameState(std::vector< std::vector<char> >& gameBoard);
|
||||
void StartGameWindow(void);
|
||||
protected:
|
||||
;
|
||||
private:
|
||||
void CheckWindowEvents(void);
|
||||
void DisplayEndScreen(void);
|
||||
@@ -40,7 +36,7 @@ namespace snakeplusplus
|
||||
sf::VideoMode gameVideoSettings;
|
||||
sf::RectangleShape drawObject;
|
||||
bool isWindowAlive;
|
||||
sf::Time delay = sf::milliseconds(120);
|
||||
sf::Time delay = sf::milliseconds(60);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+2
-9
@@ -13,15 +13,10 @@ namespace snakeplusplus
|
||||
struct Snake
|
||||
{
|
||||
public:
|
||||
Snake(void);
|
||||
sf::Vector2f headLocation;
|
||||
sf::Vector2f speed;
|
||||
std::queue< std::shared_ptr<char> > body;
|
||||
std::queue<char*> body;
|
||||
void Pop(void);
|
||||
protected:
|
||||
;
|
||||
private:
|
||||
;
|
||||
};
|
||||
|
||||
struct Food
|
||||
@@ -29,10 +24,8 @@ namespace snakeplusplus
|
||||
public:
|
||||
Food(void);
|
||||
sf::Vector2f location;
|
||||
std::shared_ptr<char> food;
|
||||
char* food;
|
||||
void GenerateNewFood(sf::Vector2f boundaries);
|
||||
protected:
|
||||
;
|
||||
private:
|
||||
std::default_random_engine generator;
|
||||
int GenerateRandomNumber(int generationLimit);
|
||||
|
||||
Reference in New Issue
Block a user