45 lines
890 B
C++
45 lines
890 B
C++
#ifndef GAME_H
|
|
#define GAME_H
|
|
|
|
#include <memory>
|
|
|
|
#include <SFML/System/Time.hpp>
|
|
|
|
#include "hero.h"
|
|
#include "level.h"
|
|
#include "audio.h"
|
|
#include "renderer.h"
|
|
|
|
/// The main class where all the process happens
|
|
class Game
|
|
{
|
|
private:
|
|
// Game entities
|
|
std::unique_ptr<Hero> hero;
|
|
std::unique_ptr<Level> level;
|
|
std::unique_ptr<Audio> audio;
|
|
std::unique_ptr<Renderer> renderer; // wer is `using RendererPrt = ...` A?A?A?
|
|
|
|
int current_level;
|
|
|
|
// SFML entities
|
|
sf::RenderWindow main_window;
|
|
|
|
/// Convert pressed key into a game direction
|
|
Direction getDirection(sf::Keyboard::Key &key) const;
|
|
|
|
/// Move player by pressed key
|
|
void onMoving(sf::Keyboard::Key &key);
|
|
|
|
/// Prepare map and hero for a game level
|
|
//void loadLevel(int level_index = 1);
|
|
|
|
public:
|
|
explicit Game();
|
|
|
|
/// Start the game loop
|
|
int run();
|
|
};
|
|
|
|
#endif // GAME_H
|