cirno-puzzle/src/game.h

46 lines
850 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;
2020-02-25 11:53:57 -05:00
int current_level;
2020-02-20 13:34:41 -05:00
// 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-25 11:53:57 -05:00
/// Prepare map and hero for a game level
2020-03-15 17:57:39 -04:00
//void loadLevel(int level_index = 1);
2020-02-25 11:53:57 -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