Cleaned up naming of files; setup more structure

This commit is contained in:
2023-03-13 21:10:52 -05:00
parent 3ee01d936b
commit a76d9ccfb5
13 changed files with 65 additions and 25 deletions
+1 -1
View File
@@ -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)
View File
+1
View File
@@ -0,0 +1 @@
#include "game.cpp"
+9 -4
View File
@@ -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;
}
+3 -11
View File
@@ -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;
+2 -2
View File
@@ -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()