You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB
C++

#ifndef RENDERER_H
#define RENDERER_H
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/ConvexShape.hpp>
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Window.hpp>
#include <memory>
class Level;
class Cell;
class Hero;
/// Represents functionality to draw game level onto window
class Renderer
{
private:
float cell_width, cell_height, cell_deviation;
unsigned int window_size;
// Reset for each iteration of window pulling
float init_painter_x, init_painter_y;
float painter_x, painter_y;
float vertical_shift, horizontal_shift;
sf::Text text_charges;
sf::Font font;
sf::RectangleShape brush_background;
sf::ConvexShape brush_cell;
sf::ConvexShape brush_wall;
bool drawCell(const std::unique_ptr<Cell> &cell, sf::RenderWindow &main_window);
public:
explicit Renderer();
bool render(const std::unique_ptr<Level> &level, const std::unique_ptr<Hero> &hero, sf::RenderWindow &main_window);
unsigned int windowSize() const;
};
#endif // RENDERER_H