lxgui
Loading...
Searching...
No Matches
gui_sfml_render_target.hpp
1#ifndef LXGUI_GUI_SFML_RENDER_TARGET_HPP
2#define LXGUI_GUI_SFML_RENDER_TARGET_HPP
3
4#include "lxgui/gui_render_target.hpp"
5#include "lxgui/impl/gui_sfml_material.hpp"
6#include "lxgui/utils.hpp"
7
8#include <memory>
9
12namespace sf {
13
14class RenderTexture;
15
16}
20namespace lxgui::gui::sfml {
21
23class render_target final : public gui::render_target {
24public:
31
33 void begin() override;
34
36 void end() override;
37
42 void clear(const color& c) override;
43
48 bounds2f get_rect() const override;
49
56 bool set_dimensions(const vector2ui& dimensions) override;
57
64 void save_to_file(std::string filename) const override;
65
75
80 std::weak_ptr<sfml::material> get_material();
81
86 sf::RenderTexture* get_render_texture();
87
88private:
89 void update_view_matrix_() const;
90
91 std::shared_ptr<sfml::material> texture_;
92 sf::RenderTexture* render_texture_ = nullptr;
93};
94
95} // namespace lxgui::gui::sfml
96
97#endif
Holds a single color (float RGBA, 128 bits)
Definition gui_color.hpp:13
A place to render things (the screen, a texture, ...)
A place to render things (the screen, a texture, ...)
void clear(const color &c) override
Clears the content of this render_target.
render_target(const vector2ui &dimensions, material::filter filt=material::filter::none)
Constructor.
bounds2f get_rect() const override
Returns this render target's pixel rect.
void end() override
Ends rendering on this target.
void save_to_file(std::string filename) const override
Saves the content of this render target into a file.
std::weak_ptr< sfml::material > get_material()
Returns the associated texture for rendering.
void begin() override
Begins rendering on this target.
sf::RenderTexture * get_render_texture()
Returns the underlying SFML render texture object. return The underlying SFML render texture object.
bool set_dimensions(const vector2ui &dimensions) override
Sets this render target's dimensions.
vector2ui get_canvas_dimensions() const override
Returns this render target's canvas dimension.