cirno-puzzle/game.h

41 lines
736 B
C
Raw Normal View History

2020-02-19 12:50:09 -05:00
#ifndef GAME_H
#define GAME_H
#include <memory>
#include <SFML/Graphics/RenderWindow.hpp>
2020-02-19 12:50:09 -05:00
#include <SFML/System/Time.hpp>
#include <SFML/Window.hpp>
2020-02-20 13:34:41 -05:00
#include "hero.h"
#include "level.h"
/// The main class where all the process happens
2020-02-19 12:50:09 -05:00
class Game
{
private:
2020-02-20 13:34:41 -05:00
// Game entities
std::unique_ptr<Hero> hero;
std::unique_ptr<Level> level;
// SFML entities
sf::RenderWindow main_window;
2020-02-19 12:50:09 -05:00
2020-02-20 13:34:41 -05:00
/// Convert pressed key into a game direction
Direction getDirection(sf::Keyboard::Key &key) const;
/// Move player by pressed key
2020-02-21 12:34:28 -05:00
void onMoving(sf::Keyboard::Key &key);
/// Render game state
2020-02-21 12:34:28 -05:00
void renderMap();
2020-02-20 13:34:41 -05:00
2020-02-19 12:50:09 -05:00
public:
explicit Game();
2020-02-20 13:34:41 -05:00
/// Start the game loop
2020-02-19 12:50:09 -05:00
int run();
};
#endif // GAME_H