snakeplusplus/include/display.h

61 lines
1.4 KiB
C
Raw Normal View History

#ifndef DISPLAY_H
#define DISPLAY_H
#include <SFML/Graphics.hpp>
2023-03-17 20:13:50 -05:00
const int kGridSize = 25;
class DisplayInterface
{
public:
sf::Vector2f gameBoundaries;
DisplayInterface(void);
bool IsOpen(void);
virtual void CheckContinue(void) = 0;
2023-03-17 20:13:50 -05:00
virtual void DisplayGameState(std::vector< std::vector<char> >* gameBoard) = 0;
virtual void DisplayEndScreen(void) = 0;
2023-03-17 20:13:50 -05:00
virtual void StartGameWindow(void) = 0;
protected:
bool isWindowAlive;
private:
;
};
class CommandLine : public DisplayInterface
{
public:
CommandLine(void);
void CheckContinue(void);
2023-03-17 20:13:50 -05:00
void DisplayGameState(std::vector< std::vector<char> >* gameBoard);
void DisplayEndScreen(void);
2023-03-17 20:13:50 -05:00
void StartGameWindow(void);
protected:
;
private:
2023-03-17 20:13:50 -05:00
;
};
class SFML : public DisplayInterface
{
public:
SFML(void);
void CheckContinue(void);
2023-03-17 20:13:50 -05:00
void DisplayGameState(std::vector< std::vector<char> >* gameBoard);
void DisplayEndScreen(void);
2023-03-17 20:13:50 -05:00
void StartGameWindow(void);
void UpdateResolution(sf::Vector2i newResolution);
protected:
;
private:
2023-03-17 20:13:50 -05:00
void CheckWindowEvents(void);
void DrawEmpty(sf::Vector2f location);
void DrawFood(sf::Vector2f location);
void DrawSnake(sf::Vector2f location);
sf::Time delay;
sf::RenderWindow gameWindow;
sf::VideoMode gameVideoSettings;
2023-03-17 20:13:50 -05:00
sf::RectangleShape drawObject;
};
#endif