1 #ifndef LXGUI_GUI_BACKDROP_HPP
2 #define LXGUI_GUI_BACKDROP_HPP
4 #include "lxgui/gui_bounds2.hpp"
5 #include "lxgui/gui_material.hpp"
6 #include "lxgui/gui_quad.hpp"
7 #include "lxgui/gui_vertex_cache.hpp"
8 #include "lxgui/lxgui.hpp"
9 #include "lxgui/utils.hpp"
133 void set_edge(
const std::string& edge_file);
181 void update_cache_()
const;
182 void update_background_(
color c)
const;
183 void update_edge_(
color c)
const;
187 std::string background_file_;
189 std::shared_ptr<material> background_texture_;
190 bool is_background_tilling_ =
false;
191 float tile_size_ = 0.0f;
192 float original_tile_size_ = 0.0f;
195 std::string edge_file_;
197 std::shared_ptr<material> edge_texture_;
199 float edge_size_ = 0.0f;
200 float original_edge_size_ = 0.0f;
204 mutable bool is_cache_dirty_ =
true;
205 mutable float cache_alpha_ = std::numeric_limits<float>::quiet_NaN();
206 mutable std::vector<std::array<vertex, 4>> background_quads_;
207 mutable std::shared_ptr<vertex_cache> background_cache_;
208 mutable std::vector<std::array<vertex, 4>> edge_quads_;
209 mutable std::shared_ptr<vertex_cache> edge_cache_;
Draws borders and background of a frame.
bool is_background_tilling() const
Checks if tilling is enabled for the background texture.
backdrop(const backdrop &)=delete
Non-copiable.
float get_tile_size() const
Returns this backdrop's tile size.
color get_edge_color() const
Returns the edge color.
void set_tile_size(float tile_size)
Sets the apparent tile size.
void set_edge_color(const color &c)
Sets the edge color.
const bounds2f & get_edge_insets() const
Returns this backdrop's edge insets.
float get_edge_size() const
Returns this backdrop's edge size.
void set_edge_size(float edge_size)
Sets the apparent edge size.
void set_vertex_color(const color &c)
Sets the color to be multiplied to all drawn vertices.
const bounds2f & get_background_insets() const
Returns this backdrop's background insets.
const std::string & get_edge_file() const
Returns this backdrop's edge file.
void set_edge_insets(const bounds2f &insets)
Sets insets for the edge texture.
backdrop(frame &parent)
Constructor.
backdrop & operator=(const backdrop &)=delete
Non-copiable.
color get_background_color() const
Returns the background color.
void set_background_insets(const bounds2f &insets)
Sets insets for the background texture.
void copy_from(const backdrop &other)
Copies a backdrop's parameters into this one (inheritance).
void set_edge(const std::string &edge_file)
Sets the edge/corner texture.
const std::string & get_background_file() const
Returns this backdrop's background file.
void set_background(const std::string &background_file)
Sets the background texture.
backdrop(backdrop &&)=delete
Non-movable.
backdrop & operator=(backdrop &&)=delete
Non-movable.
void set_background_tilling(bool is_tilling)
Enables tilling for the background texture.
void set_background_color(const color &c)
Sets the background color.
void notify_borders_updated() const
Tells this backdrop that its parent frame has changed dimensions.
void render() const
Renders this backdrop on the current render target.
Holds a single color (float RGBA, 128 bits)
A region that can contain other regions and react to events.