Cleaned up naming of files; setup more structure
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "Common.h"
|
||||
#include "common.h"
|
||||
|
||||
// Test for collision between two object positions
|
||||
bool GlobalCollision(sf::Vector2f object1Position, sf::Vector2f object2Position)
|
||||
@@ -0,0 +1 @@
|
||||
#include "game.cpp"
|
||||
@@ -1,15 +1,19 @@
|
||||
// GameState.cpp
|
||||
#include <SFML\Graphics.hpp>
|
||||
#include <SFML\System.hpp>
|
||||
#include "Common.h"
|
||||
#include "Snake.h"
|
||||
#include "GameState.h"
|
||||
#include "common.h"
|
||||
#include "gamestate.h"
|
||||
|
||||
GameState::GameState()
|
||||
{
|
||||
delay = sf::milliseconds(75);
|
||||
gameVideoSettings = sf::VideoMode(1025, 725);
|
||||
gameWindow.create(gameVideoSettings, "SnakePlusPlus");
|
||||
if (useSFML)
|
||||
graphics.reset(new GameWindow());
|
||||
else
|
||||
graphics.reset(new CommandLine());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +46,8 @@ void GameState::DisplayEndScreen(void)
|
||||
gameWindow.display();
|
||||
if (!PlayerWantsToContinue())
|
||||
return;
|
||||
player.Reset();
|
||||
player = Snake();
|
||||
playerFood.GenerateNewFood(GetGameBoundaries());
|
||||
gameWindow.clear();
|
||||
return;
|
||||
}
|
||||
@@ -2,9 +2,9 @@
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <SFML\Graphics.hpp>
|
||||
#include "Common.h"
|
||||
#include "Snake.h"
|
||||
#include "SnakeFood.h"
|
||||
#include "common.h"
|
||||
#include "snake.h"
|
||||
#include "snakeFood.h"
|
||||
|
||||
// General constructor for snake class
|
||||
Snake::Snake(void)
|
||||
@@ -79,14 +79,6 @@ void Snake::MoveSnake(SnakeFood* snakeFood)
|
||||
return;
|
||||
}
|
||||
|
||||
void Snake::Reset(void)
|
||||
{
|
||||
snakeBody.clear();
|
||||
gameFinished = false;
|
||||
CreateHead();
|
||||
snakeDirection = kRight;
|
||||
}
|
||||
|
||||
void Snake::UpdateDirection(int newDirection)
|
||||
{
|
||||
snakeDirection = newDirection;
|
||||
@@ -1,8 +1,8 @@
|
||||
// SnakeFood.cpp
|
||||
#include <iostream>
|
||||
#include <SFML\Graphics.hpp>
|
||||
#include "Common.h"
|
||||
#include "SnakeFood.h"
|
||||
#include "common.h"
|
||||
#include "snakeFood.h"
|
||||
|
||||
|
||||
SnakeFood::SnakeFood()
|
||||
Reference in New Issue
Block a user