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
+36
View File
@@ -0,0 +1,36 @@
#ifndef DISPLAY_H
#define DISPLAY_H
class DisplayInterface
{
public:
DisplayInterface(void);
protected:
virtual void DisplayGameState(void) = 0;
private:
;
};
class CommandLine : public DisplayInterface
{
public:
CommandLine(void) = default;
void DisplayGameState(void);
protected:
;
private:
;
};
class GameWindow : public DisplayInterface
{
public:
GameWindow(void) = default;
void DisplayGameState(void);
protected:
;
private:
;
};
#endif
View File
+6 -1
View File
@@ -2,12 +2,16 @@
#ifndef GAMESTATE_H
#define GAMESTATE_H
#include <memory>
#include <SFML\Graphics.hpp>
#include "Snake.h"
#include "snake.h"
#include "display.h"
class GameState
{
public:
std::vector< std::vector<char> > gameBoard;
bool useSFML = 1;
GameState();
GameState(int newHorizontal, int newVertical);
void StartGame(void);
@@ -15,6 +19,7 @@ public:
protected:
;
private:
std::unique_ptr<DisplayInterface> graphics;
sf::RenderWindow gameWindow;
sf::VideoMode gameVideoSettings;
SnakeFood playerFood;
+1 -2
View File
@@ -4,7 +4,7 @@
#include <deque>
#include <SFML\Graphics.hpp>
#include "SnakeFood.h"
#include "snakefood.h"
class Snake
@@ -17,7 +17,6 @@ public:
sf::Vector2f GetSnakeHeadPosition(void);
bool IsTouchingObject(sf::RectangleShape object);
void MoveSnake(SnakeFood* playerFood);
void Reset(void);
void UpdateDirection(int newDirection);
protected:
;