2020-03-18 13:45:01 -04:00
|
|
|
#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>
|
|
|
|
|
2022-11-04 11:44:26 -04:00
|
|
|
#include <memory>
|
|
|
|
|
2020-03-18 13:45:01 -04:00
|
|
|
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;
|
|
|
|
|
2020-03-19 11:42:45 -04:00
|
|
|
// Reset for each iteration of window pulling
|
2020-03-18 13:45:01 -04:00
|
|
|
float init_painter_x, init_painter_y;
|
2020-03-19 11:42:45 -04:00
|
|
|
|
2020-03-18 13:45:01 -04:00
|
|
|
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
|