68 lines
1.5 KiB
C++
68 lines
1.5 KiB
C++
#ifndef HOLESOME_GAME_H
|
|
#define HOLESOME_GAME_H
|
|
|
|
|
|
#include <memory>
|
|
#include "../logging/easylogging++.h"
|
|
#include "game_object.h"
|
|
#include "input/input_mapper.h"
|
|
#include "camera/tracking_view.h"
|
|
#include "level/level_config.hpp"
|
|
#include "frame_counter.hpp"
|
|
#include "time/countdown.hpp"
|
|
|
|
class TrackingView;
|
|
|
|
|
|
class Game
|
|
{
|
|
public:
|
|
static std::shared_ptr<Game> constructInstance(const std::shared_ptr<sf::RenderWindow> &window);
|
|
|
|
static std::shared_ptr<Game> getInstance();
|
|
|
|
explicit Game(std::shared_ptr<sf::RenderWindow> window);
|
|
|
|
void run();
|
|
|
|
void exit();
|
|
|
|
void clearGameObjects();
|
|
|
|
void setLevel(LevelConfig levelConfig);
|
|
|
|
void startCountdown(int durationInSeconds);
|
|
|
|
[[nodiscard]] bool isLevelLoaded() const;
|
|
|
|
void addGameObject(const std::shared_ptr<GameObject> &gameObject);
|
|
|
|
std::shared_ptr<sf::RenderWindow> window;
|
|
|
|
void showJoinScreen();
|
|
|
|
void generateNewLevel();
|
|
|
|
private:
|
|
static inline std::shared_ptr<Game> singletonInstance = nullptr;
|
|
std::vector<std::shared_ptr<GameObject>> gameObjects = {};
|
|
std::vector<std::shared_ptr<GameObject>> gameObjectsBuffer = {};
|
|
|
|
LevelConfig loadedLevelConfig = {};
|
|
|
|
std::shared_ptr<FrameCounter> frameCounter = std::make_shared<FrameCounter>();
|
|
std::shared_ptr<Countdown> countdown = std::make_shared<Countdown>();
|
|
|
|
void drawFrame();
|
|
|
|
void update();
|
|
|
|
std::shared_ptr<Player> checkForWinner();
|
|
|
|
void handleWinning();
|
|
|
|
void showLoadingScreen(const std::string &message = "Loading...");
|
|
};
|
|
|
|
|
|
#endif //HOLESOME_GAME_H
|