38 lines
677 B
C++
38 lines
677 B
C++
#ifndef GAME_H
|
|
#define GAME_H
|
|
|
|
#include <memory>
|
|
|
|
#include <SFML/System/Time.hpp>
|
|
#include <SFML/Window.hpp>
|
|
|
|
#include "hero.h"
|
|
#include "level.h"
|
|
|
|
/// The main class where all the process happens
|
|
class Game
|
|
{
|
|
private:
|
|
// Game entities
|
|
std::unique_ptr<Hero> hero;
|
|
std::unique_ptr<Level> level;
|
|
|
|
// SFML entities
|
|
std::unique_ptr<sf::Clock> clock;
|
|
sf::Window 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);
|
|
|
|
public:
|
|
explicit Game();
|
|
|
|
/// Start the game loop
|
|
int run();
|
|
};
|
|
|
|
#endif // GAME_H
|