#pragma once

#include <SFML/Graphics.hpp>
#include "IEntity.hpp"

class Renderer: public IEntity {
public:
	Renderer() = delete;
	Renderer(sf::RenderWindow* window);
	
	enum Mode {
		BG, FG, UI
	};
	
	void registerDrawable(sf::Drawable* drawable, unsigned z_index, Mode mode);
	void deregisterDrawable(sf::Drawable* drawable);
	void setFocus(int focus);
	int  getFocus() const;
	int  getPosition() const;
	void sort();
	void clear();
	void update(float delta) override;
	void render();

private:
	struct RenderObject {
		sf::Drawable* drawable;
		unsigned z_index;
		Mode mode;
	};
	sf::RenderWindow* m_window;
	sf::View m_view;
	int m_focus;
	std::vector<RenderObject> m_data;
};