69 lines
850 B
C++
69 lines
850 B
C++
#pragma once
|
|
|
|
#include <Util.h>
|
|
#include <Player.h>
|
|
#include <Fruit.h>
|
|
#include <GameConfig.h>
|
|
#include <SFML/Graphics.hpp>
|
|
#include <SFML/Audio.hpp>
|
|
#include <imgui-SFML.h>
|
|
#include <imgui.h>
|
|
|
|
|
|
class Game
|
|
{
|
|
public:
|
|
Game(bool useImgui_in);
|
|
|
|
void run();
|
|
|
|
bool init();
|
|
|
|
private:
|
|
void imgui();
|
|
|
|
void render();
|
|
|
|
void input();
|
|
|
|
void collision();
|
|
|
|
void movement();
|
|
|
|
void resetGame();
|
|
|
|
bool parseConfigFile();
|
|
|
|
void soundSystem();
|
|
|
|
void scoreSystem();
|
|
|
|
void failState();
|
|
|
|
void winState();
|
|
|
|
|
|
private:
|
|
GameConfig config;
|
|
sf::Clock clock;
|
|
sf::RenderWindow window;
|
|
sf::Font font;
|
|
sf::Text score;
|
|
|
|
sf::SoundBuffer failSoundBuffer;
|
|
|
|
sf::RectangleShape tempRect;
|
|
|
|
//sf::Sound failSound;
|
|
|
|
Player player{};
|
|
Fruit fruit{};
|
|
|
|
sf::Vector2u gridCount;
|
|
|
|
size_t frameCount{};
|
|
bool useImgui;
|
|
bool fail{};
|
|
bool win{};
|
|
bool running{true};
|
|
}; |